From 255d76f2a13a8378ded9f0cf1c2bb172f7f07a5b Mon Sep 17 00:00:00 2001 From: Umherirrender Date: Mon, 1 Jan 2018 14:10:16 +0100 Subject: [PATCH] build: Updating mediawiki/mediawiki-codesniffer to 15.0.0 Clean up use of @codingStandardsIgnore - @codingStandardsIgnoreFile -> phpcs:ignoreFile - @codingStandardsIgnoreLine -> phpcs:ignore - @codingStandardsIgnoreStart -> phpcs:disable - @codingStandardsIgnoreEnd -> phpcs:enable For phpcs:disable always the necessary sniffs are provided. Some start/end pairs are changed to line ignore Change-Id: I92ef235849bcc349c69e53504e664a155dd162c8 --- .phpcs.xml | 4 ++- autoload.php | 2 +- composer.json | 2 +- includes/DeprecatedGlobal.php | 5 +-- includes/HistoryBlob.php | 3 +- includes/PHPVersionCheck.php | 8 +++-- includes/Setup.php | 3 +- includes/api/ApiBlock.php | 4 +-- includes/api/ApiErrorFormatter.php | 3 +- includes/api/ApiRevisionDelete.php | 3 +- includes/cache/CacheHelper.php | 2 +- includes/changetags/ChangeTagsLogList.php | 3 +- .../changetags/ChangeTagsRevisionList.php | 3 +- includes/content/TextContentHandler.php | 2 -- includes/exception/MWExceptionHandler.php | 4 +-- includes/htmlform/fields/HTMLEditTools.php | 3 +- includes/installer/Installer.php | 3 +- includes/installer/OracleInstaller.php | 4 +-- includes/jobqueue/JobQueueFederated.php | 3 +- includes/libs/JavaScriptMinifier.php | 2 +- includes/libs/jsminplus.php | 2 +- includes/libs/lockmanager/ScopedLock.php | 2 +- includes/libs/objectcache/MemcachedClient.php | 2 +- .../libs/rdbms/loadbalancer/LoadBalancer.php | 2 +- includes/libs/xmp/XMP.php | 4 +-- includes/libs/xmp/XMPValidate.php | 4 +-- includes/media/Bitmap_ClientOnly.php | 3 +- includes/page/ImagePage.php | 4 +-- includes/parser/Parser.php | 15 +++----- includes/parser/Preprocessor_DOM.php | 15 +++----- includes/parser/Preprocessor_Hash.php | 33 ++++++------------ includes/poolcounter/PoolCounter.php | 3 +- includes/poolcounter/PoolCounterRedis.php | 4 +-- includes/shell/Command.php | 6 ++-- includes/skins/SkinFallbackTemplate.php | 3 +- includes/specialpage/QueryPage.php | 3 +- includes/specials/SpecialEditTags.php | 6 ++-- includes/specials/SpecialExport.php | 2 -- includes/specials/SpecialRecentchanges.php | 2 -- includes/specials/SpecialRevisiondelete.php | 3 +- includes/specials/pagers/ImageListPager.php | 4 --- includes/upload/UploadBase.php | 3 +- includes/utils/AutoloadGenerator.php | 5 ++- .../search/BasicSearchResultSetWidget.php | 7 ++-- includes/widget/search/SearchFormWidget.php | 34 +++++++++---------- .../search/SimpleSearchResultSetWidget.php | 20 +++++------ index.php | 3 +- languages/Language.php | 6 ++-- languages/LanguageConverter.php | 3 +- languages/classes/LanguageBe_tarask.php | 3 +- languages/classes/LanguageKk_cyrl.php | 3 +- languages/classes/LanguageKu_ku.php | 3 +- languages/classes/LanguageZh_hans.php | 3 +- .../benchmarks/bench_utf8_title_check.php | 4 +-- maintenance/commandLine.inc | 15 ++++---- maintenance/deleteBatch.php | 3 +- maintenance/doMaintenance.php | 2 +- maintenance/generateSitemap.php | 6 ++-- maintenance/language/checkLanguage.inc | 7 ++-- maintenance/mergeMessageFileList.php | 3 +- maintenance/moveBatch.php | 3 +- maintenance/storage/compressOld.php | 3 +- maintenance/update.php | 2 -- maintenance/userOptions.php | 6 ++-- mw-config/index.php | 5 ++- profileinfo.php | 32 +++++++---------- tests/common/TestsAutoLoader.php | 4 +-- tests/parser/ParserTestParserHook.php | 3 +- tests/parser/editTests.php | 3 +- tests/phan/stubs/hhvm.php | 2 +- tests/phan/stubs/mail.php | 2 +- tests/phan/stubs/memcached.php | 2 +- tests/phan/stubs/tideways.php | 2 +- tests/phan/stubs/wikidiff.php | 2 +- tests/phpunit/includes/LinkerTest.php | 24 ++++++------- tests/phpunit/includes/OutputPageTest.php | 8 ++--- tests/phpunit/includes/PathRouterTest.php | 4 +-- tests/phpunit/includes/SampleTest.php | 6 ++-- .../includes/api/ApiComparePagesTest.php | 5 ++- .../includes/api/format/ApiFormatPhpTest.php | 4 +-- .../includes/api/format/ApiFormatXmlTest.php | 8 ++--- .../changes/ChangesListFilterGroupTest.php | 4 +-- .../changes/ChangesListFilterTest.php | 6 ++-- .../content/CssContentHandlerTest.php | 4 +-- .../includes/content/CssContentTest.php | 4 +-- .../content/JavaScriptContentHandlerTest.php | 4 +-- .../content/JavaScriptContentTest.php | 9 +++-- tests/phpunit/includes/import/ImportTest.php | 16 ++++----- tests/phpunit/includes/libs/CSSMinTest.php | 4 +-- .../includes/libs/XmlTypeCheckTest.php | 3 +- .../libs/rdbms/database/DatabaseSQLTest.php | 4 +-- .../phpunit/includes/media/ExifBitmapTest.php | 9 ++--- tests/phpunit/includes/media/GIFTest.php | 8 ++--- tests/phpunit/includes/media/JpegTest.php | 3 +- tests/phpunit/includes/media/PNGTest.php | 8 ++--- .../media/SVGMetadataExtractorTest.php | 4 +-- tests/phpunit/includes/media/TiffTest.php | 3 +- tests/phpunit/includes/media/WebPTest.php | 4 +-- .../includes/page/WikiPageDbTestBase.php | 4 +-- .../includes/parser/ParserOutputTest.php | 4 +-- .../includes/parser/PreprocessorTest.php | 12 +++---- .../includes/password/BcryptPasswordTest.php | 4 +-- .../password/EncryptedPasswordTest.php | 5 ++- .../LayeredParameterizedPasswordTest.php | 6 ++-- .../ResourceLoaderClientHtmlTest.php | 8 ++--- .../ResourceLoaderSkinModuleTest.php | 4 +-- .../includes/shell/FirejailCommandTest.php | 3 +- .../phpunit/includes/site/DBSiteStoreTest.php | 4 +-- tests/phpunit/includes/site/SiteListTest.php | 4 +-- .../phpunit/includes/tidy/RemexDriverTest.php | 4 +-- .../includes/upload/UploadBaseTest.php | 4 +-- .../includes/utils/MWCryptHKDFTest.php | 4 +-- .../includes/utils/MWCryptHashTest.php | 6 ++-- tests/phpunit/languages/LanguageTest.php | 4 +-- .../classes/LanguageBe_taraskTest.php | 4 +-- .../maintenance/backupPrefetchTest.php | 3 +- 116 files changed, 266 insertions(+), 369 deletions(-) diff --git a/.phpcs.xml b/.phpcs.xml index 3170381fda..7f90f2788b 100644 --- a/.phpcs.xml +++ b/.phpcs.xml @@ -21,12 +21,14 @@ - + + + diff --git a/autoload.php b/autoload.php index c37d9f71f3..884dbbef32 100644 --- a/autoload.php +++ b/autoload.php @@ -1,6 +1,6 @@ version = $version; } - // @codingStandardsIgnoreStart - // PSR2.Methods.MethodDeclaration.Underscore - // PSR2.Classes.PropertyDeclaration.ScopeMissing + // phpcs:ignore PSR2.Methods.MethodDeclaration.Underscore,PSR2.Classes.PropertyDeclaration.ScopeMissing function _newObject() { /* Put the caller offset for wfDeprecated as 6, as * that gives the function that uses this object, since: @@ -56,5 +54,4 @@ class DeprecatedGlobal extends StubObject { wfDeprecated( '$' . $this->global, $this->version, false, 6 ); return parent::_newObject(); } - // @codingStandardsIgnoreEnd } diff --git a/includes/HistoryBlob.php b/includes/HistoryBlob.php index 5193168bb0..075b48d225 100644 --- a/includes/HistoryBlob.php +++ b/includes/HistoryBlob.php @@ -700,7 +700,7 @@ class DiffHistoryBlob implements HistoryBlob { } -// @codingStandardsIgnoreStart +// phpcs:ignore Generic.CodeAnalysis.UnconditionalIfStatement.Found if ( false ) { // Blobs generated by MediaWiki < 1.5 on PHP 4 were serialized with the // class name coerced to lowercase. We can improve efficiency by adding @@ -711,4 +711,3 @@ if ( false ) { class_alias( 'HistoryBlobCurStub', 'historyblobcurstub' ); class_alias( 'HistoryBlobStub', 'historyblobstub' ); } -// @codingStandardsIgnoreEnd diff --git a/includes/PHPVersionCheck.php b/includes/PHPVersionCheck.php index a862903d52..0a9bba8520 100644 --- a/includes/PHPVersionCheck.php +++ b/includes/PHPVersionCheck.php @@ -1,7 +1,5 @@ upgrading your copy of {$phpInfo['implementation']}. @@ -140,6 +139,7 @@ class PHPVersionCheck { See ourcompatibility page for details of which versions are compatible with prior versions of {$phpInfo['implementation']}. HTML; + // phpcs:enable $this->triggerError( "Supported {$phpInfo['implementation']} versions", $shortText, @@ -164,12 +164,14 @@ HTML; . "https://www.mediawiki.org/wiki/Download_from_Git#Fetch_external_libraries\n" . "for help on installing the required components."; + // phpcs:ignore Generic.Files.LineLength $longHtml = <<mediawiki.org for help on installing the required components. HTML; + // phpcs:enable $this->triggerError( 'External dependencies', $shortText, $longText, $longHtml ); } diff --git a/includes/Setup.php b/includes/Setup.php index d6f4b2fe4c..4936b0b11a 100644 --- a/includes/Setup.php +++ b/includes/Setup.php @@ -370,9 +370,8 @@ if ( $wgRCFilterByAge ) { // Note that we allow 1 link higher than the max for things like 56 days but a 60 day link. sort( $wgRCLinkDays ); - // @codingStandardsIgnoreStart Generic.CodeAnalysis.ForLoopWithTestFunctionCall.NotAllowed + // phpcs:ignore Generic.CodeAnalysis.ForLoopWithTestFunctionCall for ( $i = 0; $i < count( $wgRCLinkDays ); $i++ ) { - // @codingStandardsIgnoreEnd if ( $wgRCLinkDays[$i] >= $rcMaxAgeDays ) { $wgRCLinkDays = array_slice( $wgRCLinkDays, 0, $i + 1, false ); break; diff --git a/includes/api/ApiBlock.php b/includes/api/ApiBlock.php index 366a6df98f..df30a2de75 100644 --- a/includes/api/ApiBlock.php +++ b/includes/api/ApiBlock.php @@ -182,14 +182,14 @@ class ApiBlock extends ApiBase { } protected function getExamplesMessages() { - // @codingStandardsIgnoreStart Generic.Files.LineLength + // phpcs:disable Generic.Files.LineLength return [ 'action=block&user=192.0.2.5&expiry=3%20days&reason=First%20strike&token=123ABC' => 'apihelp-block-example-ip-simple', 'action=block&user=Vandal&expiry=never&reason=Vandalism&nocreate=&autoblock=&noemail=&token=123ABC' => 'apihelp-block-example-user-complex', ]; - // @codingStandardsIgnoreEnd + // phpcs:enable } public function getHelpUrls() { diff --git a/includes/api/ApiErrorFormatter.php b/includes/api/ApiErrorFormatter.php index 183f7e2bb3..1749ce7f68 100644 --- a/includes/api/ApiErrorFormatter.php +++ b/includes/api/ApiErrorFormatter.php @@ -361,9 +361,8 @@ class ApiErrorFormatter { * @deprecated Only for backwards compatibility, do not use * @ingroup API */ -// @codingStandardsIgnoreStart Squiz.Classes.ValidClassName.NotCamelCaps +// phpcs:ignore Squiz.Classes.ValidClassName.NotCamelCaps class ApiErrorFormatter_BackCompat extends ApiErrorFormatter { - // @codingStandardsIgnoreEnd /** * @param ApiResult $result Into which data will be added diff --git a/includes/api/ApiRevisionDelete.php b/includes/api/ApiRevisionDelete.php index 5a51b2843a..d7bc931e28 100644 --- a/includes/api/ApiRevisionDelete.php +++ b/includes/api/ApiRevisionDelete.php @@ -116,11 +116,10 @@ class ApiRevisionDelete extends ApiBase { } $list->reloadFromMaster(); - // @codingStandardsIgnoreStart Avoid function calls in a FOR loop test part + // phpcs:ignore Generic.CodeAnalysis.ForLoopWithTestFunctionCall for ( $item = $list->reset(); $list->current(); $item = $list->next() ) { $data['items'][$item->getId()] += $item->getApiData( $this->getResult() ); } - // @codingStandardsIgnoreEnd $data['items'] = array_values( $data['items'] ); ApiResult::setIndexedTagName( $data['items'], 'i' ); diff --git a/includes/cache/CacheHelper.php b/includes/cache/CacheHelper.php index 8c70be24a1..e77e251586 100644 --- a/includes/cache/CacheHelper.php +++ b/includes/cache/CacheHelper.php @@ -273,7 +273,7 @@ class CacheHelper implements ICacheHelper { $itemKey = array_keys( array_slice( $this->cachedChunks, 0, 1 ) ); $itemKey = array_shift( $itemKey ); - if ( !is_integer( $itemKey ) ) { + if ( !is_int( $itemKey ) ) { wfWarn( "Attempted to get item with non-numeric key while " . "the next item in the queue has a key ($itemKey) in " . __METHOD__ ); } elseif ( is_null( $itemKey ) ) { diff --git a/includes/changetags/ChangeTagsLogList.php b/includes/changetags/ChangeTagsLogList.php index e6d918a63c..6977172619 100644 --- a/includes/changetags/ChangeTagsLogList.php +++ b/includes/changetags/ChangeTagsLogList.php @@ -72,9 +72,8 @@ class ChangeTagsLogList extends ChangeTagsList { * @return Status */ public function updateChangeTagsOnAll( $tagsToAdd, $tagsToRemove, $params, $reason, $user ) { - // @codingStandardsIgnoreStart Generic.CodeAnalysis.ForLoopWithTestFunctionCall.NotAllowed + // phpcs:ignore Generic.CodeAnalysis.ForLoopWithTestFunctionCall for ( $this->reset(); $this->current(); $this->next() ) { - // @codingStandardsIgnoreEnd $item = $this->current(); $status = ChangeTags::updateTagsWithChecks( $tagsToAdd, $tagsToRemove, null, null, $item->getId(), $params, $reason, $user ); diff --git a/includes/changetags/ChangeTagsRevisionList.php b/includes/changetags/ChangeTagsRevisionList.php index 61259b4192..19b7e20d0e 100644 --- a/includes/changetags/ChangeTagsRevisionList.php +++ b/includes/changetags/ChangeTagsRevisionList.php @@ -80,9 +80,8 @@ class ChangeTagsRevisionList extends ChangeTagsList { * @return Status */ public function updateChangeTagsOnAll( $tagsToAdd, $tagsToRemove, $params, $reason, $user ) { - // @codingStandardsIgnoreStart Generic.CodeAnalysis.ForLoopWithTestFunctionCall.NotAllowed + // phpcs:ignore Generic.CodeAnalysis.ForLoopWithTestFunctionCall for ( $this->reset(); $this->current(); $this->next() ) { - // @codingStandardsIgnoreEnd $item = $this->current(); $status = ChangeTags::updateTagsWithChecks( $tagsToAdd, $tagsToRemove, null, $item->getId(), null, $params, $reason, $user ); diff --git a/includes/content/TextContentHandler.php b/includes/content/TextContentHandler.php index ced2a665ac..4a7944caea 100644 --- a/includes/content/TextContentHandler.php +++ b/includes/content/TextContentHandler.php @@ -30,11 +30,9 @@ */ class TextContentHandler extends ContentHandler { - // @codingStandardsIgnoreStart T59585 public function __construct( $modelId = CONTENT_MODEL_TEXT, $formats = [ CONTENT_FORMAT_TEXT ] ) { parent::__construct( $modelId, $formats ); } - // @codingStandardsIgnoreEnd /** * Returns the content's text as-is. diff --git a/includes/exception/MWExceptionHandler.php b/includes/exception/MWExceptionHandler.php index 9b591918d4..f3d61f0cdd 100644 --- a/includes/exception/MWExceptionHandler.php +++ b/includes/exception/MWExceptionHandler.php @@ -279,7 +279,7 @@ class MWExceptionHandler { // HHVM: Class undefined: foo // PHP5: Class 'foo' not found if ( preg_match( "/Class (undefined: \w+|'\w+' not found)/", $msg ) ) { - // @codingStandardsIgnoreStart Generic.Files.LineLength.TooLong + // phpcs:disable Generic.Files.LineLength $msg = <<mediawiki.org for help on installing the required components. TXT; - // @codingStandardsIgnoreEnd + // phpcs:enable } // We can't just create an exception and log it as it is likely that diff --git a/includes/htmlform/fields/HTMLEditTools.php b/includes/htmlform/fields/HTMLEditTools.php index 1b5d1fb4ea..4019f8133c 100644 --- a/includes/htmlform/fields/HTMLEditTools.php +++ b/includes/htmlform/fields/HTMLEditTools.php @@ -8,8 +8,7 @@ class HTMLEditTools extends HTMLFormField { public function getTableRow( $value ) { $msg = $this->formatMsg(); - return - '' . + return '' . '
' . $msg->parseAsBlock() . "
\n"; diff --git a/includes/installer/Installer.php b/includes/installer/Installer.php index 2bb15b8ce0..5ea9bfea32 100644 --- a/includes/installer/Installer.php +++ b/includes/installer/Installer.php @@ -595,11 +595,10 @@ abstract class Installer { global $wgAutoloadClasses; $wgAutoloadClasses = []; - // @codingStandardsIgnoreStart // LocalSettings.php should not call functions, except wfLoadSkin/wfLoadExtensions // Define the required globals here, to ensure, the functions can do it work correctly. + // phpcs:ignore MediaWiki.VariableAnalysis.UnusedGlobalVariables global $wgExtensionDirectory, $wgStyleDirectory; - // @codingStandardsIgnoreEnd MediaWiki\suppressWarnings(); $_lsExists = file_exists( "$IP/LocalSettings.php" ); diff --git a/includes/installer/OracleInstaller.php b/includes/installer/OracleInstaller.php index 05f078fab7..e5418e43cc 100644 --- a/includes/installer/OracleInstaller.php +++ b/includes/installer/OracleInstaller.php @@ -335,11 +335,11 @@ class OracleInstaller extends DatabaseInstaller { * @return bool Whether the connection string is valid. */ public static function checkConnectStringFormat( $connect_string ) { - // @@codingStandardsIgnoreStart Long lines with regular expressions. + // phpcs:disable Generic.Files.LineLength // @todo Very long regular expression. Make more readable? $isValid = preg_match( '/^[[:alpha:]][\w\-]*(?:\.[[:alpha:]][\w\-]*){0,2}$/', $connect_string ); // TNS name $isValid |= preg_match( '/^(?:\/\/)?[\w\-\.]+(?::[\d]+)?(?:\/(?:[\w\-\.]+(?::(pooled|dedicated|shared))?)?(?:\/[\w\-\.]+)?)?$/', $connect_string ); // EZConnect - // @@codingStandardsIgnoreEnd + // phpcs:enable return (bool)$isValid; } } diff --git a/includes/jobqueue/JobQueueFederated.php b/includes/jobqueue/JobQueueFederated.php index e74331113d..118b0f9525 100644 --- a/includes/jobqueue/JobQueueFederated.php +++ b/includes/jobqueue/JobQueueFederated.php @@ -184,9 +184,8 @@ class JobQueueFederated extends JobQueue { // Try to insert the jobs and update $partitionsTry on any failures. // Retry to insert any remaning jobs again, ignoring the bad partitions. $jobsLeft = $jobs; - // @codingStandardsIgnoreStart Generic.CodeAnalysis.ForLoopWithTestFunctionCall.NotAllowed + // phpcs:ignore Generic.CodeAnalysis.ForLoopWithTestFunctionCall for ( $i = $this->maxPartitionsTry; $i > 0 && count( $jobsLeft ); --$i ) { - // @codingStandardsIgnoreEnd try { $partitionRing->getLiveRing(); } catch ( UnexpectedValueException $e ) { diff --git a/includes/libs/JavaScriptMinifier.php b/includes/libs/JavaScriptMinifier.php index ea4755efcc..e0bbb59250 100644 --- a/includes/libs/JavaScriptMinifier.php +++ b/includes/libs/JavaScriptMinifier.php @@ -1,5 +1,5 @@ $paths ] : $paths; + $pathsByType = is_int( $type ) ? [ $type => $paths ] : $paths; $lockStatus = $manager->lockByType( $pathsByType, $timeout ); $status->merge( $lockStatus ); if ( $lockStatus->isOK() ) { diff --git a/includes/libs/objectcache/MemcachedClient.php b/includes/libs/objectcache/MemcachedClient.php index 5cb49a9972..20e30c5551 100644 --- a/includes/libs/objectcache/MemcachedClient.php +++ b/includes/libs/objectcache/MemcachedClient.php @@ -1,5 +1,5 @@ value * @throws RuntimeException */ - // @codingStandardsIgnoreEnd + // phpcs:enable private function doAttribs( $attribs ) { // first check for rdf:parseType attribute, as that can change // how the attributes are interperted. diff --git a/includes/libs/xmp/XMPValidate.php b/includes/libs/xmp/XMPValidate.php index 76ae279f32..7aec28e635 100644 --- a/includes/libs/xmp/XMPValidate.php +++ b/includes/libs/xmp/XMPValidate.php @@ -262,14 +262,12 @@ class XMPValidate implements LoggerAwareInterface { return; } $res = []; - // @codingStandardsIgnoreStart Long line that cannot be broken if ( !preg_match( /* ahh! scary regex... */ + // phpcs:ignore Generic.Files.LineLength '/^([0-3]\d{3})(?:-([01]\d)(?:-([0-3]\d)(?:T([0-2]\d):([0-6]\d)(?::([0-6]\d)(?:\.\d+)?)?([-+]\d{2}:\d{2}|Z)?)?)?)?$/D', $val, $res ) ) { - // @codingStandardsIgnoreEnd - $this->logger->info( __METHOD__ . " Expected date but got $val" ); $val = null; } else { diff --git a/includes/media/Bitmap_ClientOnly.php b/includes/media/Bitmap_ClientOnly.php index 3ec87723e9..fa5b0a61c6 100644 --- a/includes/media/Bitmap_ClientOnly.php +++ b/includes/media/Bitmap_ClientOnly.php @@ -29,9 +29,8 @@ * * @ingroup Media */ -// @codingStandardsIgnoreStart Squiz.Classes.ValidClassName.NotCamelCaps +// phpcs:ignore Squiz.Classes.ValidClassName.NotCamelCaps class BitmapHandler_ClientOnly extends BitmapHandler { - // @codingStandardsIgnoreEnd /** * @param File $image diff --git a/includes/page/ImagePage.php b/includes/page/ImagePage.php index 8724c454e0..b5ff80594e 100644 --- a/includes/page/ImagePage.php +++ b/includes/page/ImagePage.php @@ -539,13 +539,13 @@ class ImagePage extends Article { // The dirmark, however, must not be immediately adjacent // to the filename, because it can get copied with it. // See T27277. - // @codingStandardsIgnoreStart Ignore long line + // phpcs:disable Generic.Files.LineLength $out->addWikiText( <<{$medialink} $dirmark$longDesc
$warning
EOT ); - // @codingStandardsIgnoreEnd + // phpcs:enable } else { $out->addWikiText( <<{$medialink} {$dirmark}$longDesc diff --git a/includes/parser/Parser.php b/includes/parser/Parser.php index e7e7aa02df..b871735121 100644 --- a/includes/parser/Parser.php +++ b/includes/parser/Parser.php @@ -96,10 +96,9 @@ class Parser { # at least one character of a host name (embeds EXT_LINK_URL_CLASS) const EXT_LINK_ADDR = '(?:[0-9.]+|\\[(?i:[0-9a-f:.]+)\\]|[^][<>"\\x00-\\x20\\x7F\p{Zs}\x{FFFD}])'; # RegExp to make image URLs (embeds IPv6 part of EXT_LINK_ADDR) - // @codingStandardsIgnoreStart Generic.Files.LineLength + // phpcs:ignore Generic.Files.LineLength const EXT_IMAGE_REGEX = '/^(http:\/\/|https:\/\/)((?:\\[(?i:[0-9a-f:.]+)\\])?[^][<>"\\x00-\\x20\\x7F\p{Zs}\x{FFFD}]+) \\/([A-Za-z0-9_.,~%\\-+&;#*?!=()@\\x80-\\xFF]+)\\.((?i)gif|png|jpg|jpeg)$/Sxu'; - // @codingStandardsIgnoreEnd # Regular expression for a non-newline space const SPACE_NOT_NL = '(?:\t| |&\#0*160;|&\#[Xx]0*[Aa]0;|\p{Zs})'; @@ -2139,11 +2138,8 @@ class Parser { $useSubpages = $this->areSubpagesAllowed(); - // @codingStandardsIgnoreStart Squiz.WhiteSpace.SemicolonSpacing.Incorrect # Loop for each link for ( ; $line !== false && $line !== null; $a->next(), $line = $a->current() ) { - // @codingStandardsIgnoreEnd - # Check for excessive memory usage if ( $holders->isBig() ) { # Too big @@ -3577,9 +3573,8 @@ class Parser { $deps = []; # Loop to fetch the article, with up to 1 redirect - // @codingStandardsIgnoreStart Generic.CodeAnalysis.ForLoopWithTestFunctionCall.NotAllowed + // phpcs:ignore Generic.CodeAnalysis.ForLoopWithTestFunctionCall for ( $i = 0; $i < 2 && is_object( $title ); $i++ ) { - // @codingStandardsIgnoreEnd # Give extensions a chance to select the revision instead $id = false; # Assume current Hooks::run( 'BeforeParserFetchTemplateAndtitle', @@ -4253,9 +4248,8 @@ class Parser { $anchor = $safeHeadline; $fallbackAnchor = $fallbackHeadline; if ( isset( $refers[$arrayKey] ) ) { - // @codingStandardsIgnoreStart + // phpcs:ignore Generic.CodeAnalysis.ForLoopWithTestFunctionCall,Generic.Formatting.DisallowMultipleStatements for ( $i = 2; isset( $refers["${arrayKey}_$i"] ); ++$i ); - // @codingStandardsIgnoreEnd $anchor .= "_$i"; $linkAnchor .= "_$i"; $refers["${arrayKey}_$i"] = true; @@ -4263,9 +4257,8 @@ class Parser { $refers[$arrayKey] = true; } if ( $fallbackHeadline !== false && isset( $refers[$fallbackArrayKey] ) ) { - // @codingStandardsIgnoreStart + // phpcs:ignore Generic.CodeAnalysis.ForLoopWithTestFunctionCall,Generic.Formatting.DisallowMultipleStatements for ( $i = 2; isset( $refers["${fallbackArrayKey}_$i"] ); ++$i ); - // @codingStandardsIgnoreEnd $fallbackAnchor .= "_$i"; $refers["${fallbackArrayKey}_$i"] = true; } else { diff --git a/includes/parser/Preprocessor_DOM.php b/includes/parser/Preprocessor_DOM.php index 5368125f35..79021dda23 100644 --- a/includes/parser/Preprocessor_DOM.php +++ b/includes/parser/Preprocessor_DOM.php @@ -24,9 +24,8 @@ /** * @ingroup Parser */ -// @codingStandardsIgnoreStart Squiz.Classes.ValidClassName.NotCamelCaps +// phpcs:ignore Squiz.Classes.ValidClassName.NotCamelCaps class Preprocessor_DOM extends Preprocessor { - // @codingStandardsIgnoreEnd /** * @var Parser @@ -1024,9 +1023,8 @@ class PPDPart { * An expansion frame, used as a context to expand the result of preprocessToObj() * @ingroup Parser */ -// @codingStandardsIgnoreStart Squiz.Classes.ValidClassName.NotCamelCaps +// phpcs:ignore Squiz.Classes.ValidClassName.NotCamelCaps class PPFrame_DOM implements PPFrame { - // @codingStandardsIgnoreEnd /** * @var Preprocessor @@ -1642,9 +1640,8 @@ class PPFrame_DOM implements PPFrame { * Expansion frame with template arguments * @ingroup Parser */ -// @codingStandardsIgnoreStart Squiz.Classes.ValidClassName.NotCamelCaps +// phpcs:ignore Squiz.Classes.ValidClassName.NotCamelCaps class PPTemplateFrame_DOM extends PPFrame_DOM { - // @codingStandardsIgnoreEnd public $numberedArgs, $namedArgs; @@ -1821,9 +1818,8 @@ class PPTemplateFrame_DOM extends PPFrame_DOM { * Expansion frame with custom arguments * @ingroup Parser */ -// @codingStandardsIgnoreStart Squiz.Classes.ValidClassName.NotCamelCaps +// phpcs:ignore Squiz.Classes.ValidClassName.NotCamelCaps class PPCustomFrame_DOM extends PPFrame_DOM { - // @codingStandardsIgnoreEnd public $args; @@ -1874,9 +1870,8 @@ class PPCustomFrame_DOM extends PPFrame_DOM { /** * @ingroup Parser */ -// @codingStandardsIgnoreStart Squiz.Classes.ValidClassName.NotCamelCaps +// phpcs:ignore Squiz.Classes.ValidClassName.NotCamelCaps class PPNode_DOM implements PPNode { - // @codingStandardsIgnoreEnd /** * @var DOMElement diff --git a/includes/parser/Preprocessor_Hash.php b/includes/parser/Preprocessor_Hash.php index 145fbbc592..468b009aa9 100644 --- a/includes/parser/Preprocessor_Hash.php +++ b/includes/parser/Preprocessor_Hash.php @@ -39,9 +39,8 @@ * * @ingroup Parser */ -// @codingStandardsIgnoreStart Squiz.Classes.ValidClassName.NotCamelCaps +// phpcs:ignore Squiz.Classes.ValidClassName.NotCamelCaps class Preprocessor_Hash extends Preprocessor { - // @codingStandardsIgnoreEnd /** * @var Parser @@ -789,9 +788,8 @@ class Preprocessor_Hash extends Preprocessor { * Stack class to help Preprocessor::preprocessToObj() * @ingroup Parser */ -// @codingStandardsIgnoreStart Squiz.Classes.ValidClassName.NotCamelCaps +// phpcs:ignore Squiz.Classes.ValidClassName.NotCamelCaps class PPDStack_Hash extends PPDStack { - // @codingStandardsIgnoreEnd public function __construct() { $this->elementClass = 'PPDStackElement_Hash'; @@ -803,9 +801,8 @@ class PPDStack_Hash extends PPDStack { /** * @ingroup Parser */ -// @codingStandardsIgnoreStart Squiz.Classes.ValidClassName.NotCamelCaps +// phpcs:ignore Squiz.Classes.ValidClassName.NotCamelCaps class PPDStackElement_Hash extends PPDStackElement { - // @codingStandardsIgnoreEnd public function __construct( $data = [] ) { $this->partClass = 'PPDPart_Hash'; @@ -857,9 +854,8 @@ class PPDStackElement_Hash extends PPDStackElement { /** * @ingroup Parser */ -// @codingStandardsIgnoreStart Squiz.Classes.ValidClassName.NotCamelCaps +// phpcs:ignore Squiz.Classes.ValidClassName.NotCamelCaps class PPDPart_Hash extends PPDPart { - // @codingStandardsIgnoreEnd public function __construct( $out = '' ) { if ( $out !== '' ) { @@ -875,9 +871,8 @@ class PPDPart_Hash extends PPDPart { * An expansion frame, used as a context to expand the result of preprocessToObj() * @ingroup Parser */ -// @codingStandardsIgnoreStart Squiz.Classes.ValidClassName.NotCamelCaps +// phpcs:ignore Squiz.Classes.ValidClassName.NotCamelCaps class PPFrame_Hash implements PPFrame { - // @codingStandardsIgnoreEnd /** * @var Parser @@ -1475,9 +1470,8 @@ class PPFrame_Hash implements PPFrame { * Expansion frame with template arguments * @ingroup Parser */ -// @codingStandardsIgnoreStart Squiz.Classes.ValidClassName.NotCamelCaps +// phpcs:ignore Squiz.Classes.ValidClassName.NotCamelCaps class PPTemplateFrame_Hash extends PPFrame_Hash { - // @codingStandardsIgnoreEnd public $numberedArgs, $namedArgs, $parent; public $numberedExpansionCache, $namedExpansionCache; @@ -1658,9 +1652,8 @@ class PPTemplateFrame_Hash extends PPFrame_Hash { * Expansion frame with custom arguments * @ingroup Parser */ -// @codingStandardsIgnoreStart Squiz.Classes.ValidClassName.NotCamelCaps +// phpcs:ignore Squiz.Classes.ValidClassName.NotCamelCaps class PPCustomFrame_Hash extends PPFrame_Hash { - // @codingStandardsIgnoreEnd public $args; @@ -1711,9 +1704,8 @@ class PPCustomFrame_Hash extends PPFrame_Hash { /** * @ingroup Parser */ -// @codingStandardsIgnoreStart Squiz.Classes.ValidClassName.NotCamelCaps +// phpcs:ignore Squiz.Classes.ValidClassName.NotCamelCaps class PPNode_Hash_Tree implements PPNode { - // @codingStandardsIgnoreEnd public $name; @@ -2059,9 +2051,8 @@ class PPNode_Hash_Tree implements PPNode { /** * @ingroup Parser */ -// @codingStandardsIgnoreStart Squiz.Classes.ValidClassName.NotCamelCaps +// phpcs:ignore Squiz.Classes.ValidClassName.NotCamelCaps class PPNode_Hash_Text implements PPNode { - // @codingStandardsIgnoreEnd public $value; private $store, $index; @@ -2130,9 +2121,8 @@ class PPNode_Hash_Text implements PPNode { /** * @ingroup Parser */ -// @codingStandardsIgnoreStart Squiz.Classes.ValidClassName.NotCamelCaps +// phpcs:ignore Squiz.Classes.ValidClassName.NotCamelCaps class PPNode_Hash_Array implements PPNode { - // @codingStandardsIgnoreEnd public $value; @@ -2188,9 +2178,8 @@ class PPNode_Hash_Array implements PPNode { /** * @ingroup Parser */ -// @codingStandardsIgnoreStart Squiz.Classes.ValidClassName.NotCamelCaps +// phpcs:ignore Squiz.Classes.ValidClassName.NotCamelCaps class PPNode_Hash_Attr implements PPNode { - // @codingStandardsIgnoreEnd public $name, $value; private $store, $index; diff --git a/includes/poolcounter/PoolCounter.php b/includes/poolcounter/PoolCounter.php index bd7072ab7e..ba0b4cb318 100644 --- a/includes/poolcounter/PoolCounter.php +++ b/includes/poolcounter/PoolCounter.php @@ -209,9 +209,8 @@ abstract class PoolCounter { } } -// @codingStandardsIgnoreStart Squiz.Classes.ValidClassName.NotCamelCaps +// phpcs:ignore Squiz.Classes.ValidClassName.NotCamelCaps class PoolCounter_Stub extends PoolCounter { - // @codingStandardsIgnoreEnd public function __construct() { /* No parameters needed */ diff --git a/includes/poolcounter/PoolCounterRedis.php b/includes/poolcounter/PoolCounterRedis.php index 65ea8333e3..9515f25dd8 100644 --- a/includes/poolcounter/PoolCounterRedis.php +++ b/includes/poolcounter/PoolCounterRedis.php @@ -152,7 +152,7 @@ class PoolCounterRedis extends PoolCounter { } $conn = $status->value; - // @codingStandardsIgnoreStart Generic.Files.LineLength + // phpcs:disable Generic.Files.LineLength static $script = /** @lang Lua */ <<luaEval( $script, diff --git a/includes/shell/Command.php b/includes/shell/Command.php index 2f0ea42238..f887ada7b5 100644 --- a/includes/shell/Command.php +++ b/includes/shell/Command.php @@ -406,14 +406,12 @@ class Command { // TODO replace with clear_last_error when requirements are bumped to PHP7 set_error_handler( function () { }, 0 ); - // @codingStandardsIgnoreStart Generic.PHP.NoSilencedErrors.Discouraged + // phpcs:ignore Generic.PHP.NoSilencedErrors.Discouraged @trigger_error( '' ); - // @codingStandardsIgnoreEnd restore_error_handler(); - // @codingStandardsIgnoreStart Generic.PHP.NoSilencedErrors.Discouraged + // phpcs:ignore Generic.PHP.NoSilencedErrors.Discouraged $numReadyPipes = @stream_select( $readyPipes, $emptyArray, $emptyArray, $timeout ); - // @codingStandardsIgnoreEnd if ( $numReadyPipes === false ) { $error = error_get_last(); if ( strncmp( $error['message'], $eintrMessage, strlen( $eintrMessage ) ) == 0 ) { diff --git a/includes/skins/SkinFallbackTemplate.php b/includes/skins/SkinFallbackTemplate.php index 1ad1ab071b..bd02fa325d 100644 --- a/includes/skins/SkinFallbackTemplate.php +++ b/includes/skins/SkinFallbackTemplate.php @@ -26,8 +26,7 @@ class SkinFallbackTemplate extends BaseTemplate { // Filter out skins that aren't installed $possibleSkins = array_filter( $possibleSkins, function ( $skinDir ) use ( $styleDirectory ) { - return - is_file( "$styleDirectory/$skinDir/skin.json" ) + return is_file( "$styleDirectory/$skinDir/skin.json" ) || is_file( "$styleDirectory/$skinDir/$skinDir.php" ); } ); diff --git a/includes/specialpage/QueryPage.php b/includes/specialpage/QueryPage.php index 73b812899a..33b9ccb12d 100644 --- a/includes/specialpage/QueryPage.php +++ b/includes/specialpage/QueryPage.php @@ -700,9 +700,8 @@ abstract class QueryPage extends SpecialPage { # $res might contain the whole 1,000 rows, so we read up to # $num [should update this to use a Pager] - // @codingStandardsIgnoreStart Generic.CodeAnalysis.ForLoopWithTestFunctionCall.NotAllowed + // phpcs:ignore Generic.CodeAnalysis.ForLoopWithTestFunctionCall for ( $i = 0; $i < $num && $row = $res->fetchObject(); $i++ ) { - // @codingStandardsIgnoreEnd $line = $this->formatResult( $skin, $row ); if ( $line ) { $html[] = $this->listoutput diff --git a/includes/specials/SpecialEditTags.php b/includes/specials/SpecialEditTags.php index eb0f0aafa4..962395367b 100644 --- a/includes/specials/SpecialEditTags.php +++ b/includes/specials/SpecialEditTags.php @@ -222,9 +222,8 @@ class SpecialEditTags extends UnlistedSpecialPage { $numRevisions = 0; // Live revisions... $list = $this->getList(); - // @codingStandardsIgnoreStart Generic.CodeAnalysis.ForLoopWithTestFunctionCall.NotAllowed + // phpcs:ignore Generic.CodeAnalysis.ForLoopWithTestFunctionCall for ( $list->reset(); $list->current(); $list->next() ) { - // @codingStandardsIgnoreEnd $item = $list->current(); $numRevisions++; $out->addHTML( $item->getHTML() ); @@ -310,9 +309,8 @@ class SpecialEditTags extends UnlistedSpecialPage { // Otherwise, use a multi-select field for adding tags, and a list of // checkboxes for removing them - // @codingStandardsIgnoreStart Generic.CodeAnalysis.ForLoopWithTestFunctionCall.NotAllowed + // phpcs:ignore Generic.CodeAnalysis.ForLoopWithTestFunctionCall for ( $list->reset(); $list->current(); $list->next() ) { - // @codingStandardsIgnoreEnd $currentTags = $list->current()->getTags(); if ( $currentTags ) { $tags = array_merge( $tags, explode( ',', $currentTags ) ); diff --git a/includes/specials/SpecialExport.php b/includes/specials/SpecialExport.php index eb7be510bd..78f92532a4 100644 --- a/includes/specials/SpecialExport.php +++ b/includes/specials/SpecialExport.php @@ -533,9 +533,7 @@ class SpecialExport extends SpecialPage { * @return array */ private function getPageLinks( $inputPages, $pageSet, $depth ) { - // @codingStandardsIgnoreStart Squiz.WhiteSpace.SemicolonSpacing.Incorrect for ( ; $depth > 0; --$depth ) { - // @codingStandardsIgnoreEnd $pageSet = $this->getLinks( $inputPages, $pageSet, 'pagelinks', [ 'namespace' => 'pl_namespace', 'title' => 'pl_title' ], diff --git a/includes/specials/SpecialRecentchanges.php b/includes/specials/SpecialRecentchanges.php index 32204f8587..3559c9928b 100644 --- a/includes/specials/SpecialRecentchanges.php +++ b/includes/specials/SpecialRecentchanges.php @@ -38,7 +38,6 @@ class SpecialRecentChanges extends ChangesListSpecialPage { private $watchlistFilterGroupDefinition; - // @codingStandardsIgnoreStart Needed "useless" override to change parameters. public function __construct( $name = 'Recentchanges', $restriction = '' ) { parent::__construct( $name, $restriction ); @@ -134,7 +133,6 @@ class SpecialRecentChanges extends ChangesListSpecialPage { } ]; } - // @codingStandardsIgnoreEnd /** * Main execution point diff --git a/includes/specials/SpecialRevisiondelete.php b/includes/specials/SpecialRevisiondelete.php index 8edebf2c7a..aec21dc4d3 100644 --- a/includes/specials/SpecialRevisiondelete.php +++ b/includes/specials/SpecialRevisiondelete.php @@ -388,9 +388,8 @@ class SpecialRevisionDelete extends UnlistedSpecialPage { $numRevisions = 0; // Live revisions... $list = $this->getList(); - // @codingStandardsIgnoreStart Generic.CodeAnalysis.ForLoopWithTestFunctionCall.NotAllowed + // phpcs:ignore Generic.CodeAnalysis.ForLoopWithTestFunctionCall for ( $list->reset(); $list->current(); $list->next() ) { - // @codingStandardsIgnoreEnd $item = $list->current(); if ( !$item->canView() ) { diff --git a/includes/specials/pagers/ImageListPager.php b/includes/specials/pagers/ImageListPager.php index 008573bedd..d80946a544 100644 --- a/includes/specials/pagers/ImageListPager.php +++ b/includes/specials/pagers/ImageListPager.php @@ -380,16 +380,12 @@ class ImageListPager extends TablePager { } } - // @codingStandardsIgnoreStart Squiz.WhiteSpace.SemicolonSpacing.Incorrect for ( ; $i < $limit && $topRes1; $i++ ) { - // @codingStandardsIgnoreEnd $resultArray[] = $topRes1; $topRes1 = $res1->next(); } - // @codingStandardsIgnoreStart Squiz.WhiteSpace.SemicolonSpacing.Incorrect for ( ; $i < $limit && $topRes2; $i++ ) { - // @codingStandardsIgnoreEnd $resultArray[] = $topRes2; $topRes2 = $res2->next(); } diff --git a/includes/upload/UploadBase.php b/includes/upload/UploadBase.php index f5c8ee0941..ddb4bbafdc 100644 --- a/includes/upload/UploadBase.php +++ b/includes/upload/UploadBase.php @@ -1663,9 +1663,8 @@ abstract class UploadBase { # image/svg, text/xml, application/xml, and text/html, which can contain scripts if ( $stripped == 'href' && strncasecmp( 'data:', $value, 5 ) === 0 ) { // rfc2397 parameters. This is only slightly slower than (;[\w;]+)*. - // @codingStandardsIgnoreStart Generic.Files.LineLength + // phpcs:ignore Generic.Files.LineLength $parameters = '(?>;[a-zA-Z0-9\!#$&\'*+.^_`{|}~-]+=(?>[a-zA-Z0-9\!#$&\'*+.^_`{|}~-]+|"(?>[\0-\x0c\x0e-\x21\x23-\x5b\x5d-\x7f]+|\\\\[\0-\x7f])*"))*(?:;base64)?'; - // @codingStandardsIgnoreEnd if ( !preg_match( "!^data:\s*image/(gif|jpeg|jpg|png)$parameters,!i", $value ) ) { wfDebug( __METHOD__ . ": Found href to unwhitelisted data: uri " diff --git a/includes/utils/AutoloadGenerator.php b/includes/utils/AutoloadGenerator.php index d12531b304..a6783b0071 100644 --- a/includes/utils/AutoloadGenerator.php +++ b/includes/utils/AutoloadGenerator.php @@ -236,11 +236,10 @@ class AutoloadGenerator { } $output = implode( "\n\t", $content ); - return - <<variableName}; \${$this->variableName} {$op} [ diff --git a/includes/widget/search/BasicSearchResultSetWidget.php b/includes/widget/search/BasicSearchResultSetWidget.php index bf59fe9e48..e23664050f 100644 --- a/includes/widget/search/BasicSearchResultSetWidget.php +++ b/includes/widget/search/BasicSearchResultSetWidget.php @@ -107,10 +107,9 @@ class BasicSearchResultSetWidget { * @return string HTML */ protected function header( Message $msg ) { - return - "

" . - "" . $msg->escaped() . "" . - "

"; + return "

" . + "" . $msg->escaped() . "" . + "

"; } /** diff --git a/includes/widget/search/SearchFormWidget.php b/includes/widget/search/SearchFormWidget.php index 008ed19b38..2c885630aa 100644 --- a/includes/widget/search/SearchFormWidget.php +++ b/includes/widget/search/SearchFormWidget.php @@ -153,10 +153,9 @@ class SearchFormWidget { ); } - return - "
" . - "
    " . implode( '', $items ) . "
" . - "
"; + return "
" . + "
    " . implode( '', $items ) . "
" . + "
"; } /** @@ -298,19 +297,18 @@ class SearchFormWidget { ); } - return - "
" . - "" . $this->specialSearch->msg( 'powersearch-legend' )->escaped() . '' . - "

" . $this->specialSearch->msg( 'powersearch-ns' )->parse() . '

' . - // populated by js if available - "
" . - $divider . - implode( - $divider, - $showSections - ) . - $hidden . - $remember . - "
"; + return "
" . + "" . $this->specialSearch->msg( 'powersearch-legend' )->escaped() . '' . + "

" . $this->specialSearch->msg( 'powersearch-ns' )->parse() . '

' . + // populated by js if available + "
" . + $divider . + implode( + $divider, + $showSections + ) . + $hidden . + $remember . + "
"; } } diff --git a/includes/widget/search/SimpleSearchResultSetWidget.php b/includes/widget/search/SimpleSearchResultSetWidget.php index 4df2eb5471..d6583a3269 100644 --- a/includes/widget/search/SimpleSearchResultSetWidget.php +++ b/includes/widget/search/SimpleSearchResultSetWidget.php @@ -74,13 +74,12 @@ class SimpleSearchResultSetWidget implements SearchResultSetWidget { $out .= ""; } - return - "
" . - "
" . - $this->specialSearch->msg( 'search-interwiki-caption' )->parse() . - '
' . - $out . - "
"; + return "
" . + "
" . + $this->specialSearch->msg( 'search-interwiki-caption' )->parse() . + '
' . + $out . + "
"; } /** @@ -108,10 +107,9 @@ class SimpleSearchResultSetWidget implements SearchResultSetWidget { $this->specialSearch->msg( 'search-interwiki-more' )->escaped() ); - return - "
" . - "{$searchLink}" . - $caption . + return "
" . + "{$searchLink}" . + $caption . "
"; } diff --git a/index.php b/index.php index 743f77bd27..791ffb1345 100644 --- a/index.php +++ b/index.php @@ -32,9 +32,8 @@ // Bail on old versions of PHP, or if composer has not been run yet to install // dependencies. Using dirname( __FILE__ ) here because __DIR__ is PHP5.3+. -// @codingStandardsIgnoreStart MediaWiki.Usage.DirUsage.FunctionFound +// phpcs:ignore MediaWiki.Usage.DirUsage.FunctionFound require_once dirname( __FILE__ ) . '/includes/PHPVersionCheck.php'; -// @codingStandardsIgnoreEnd wfEntryPointCheck( 'index.php' ); require __DIR__ . '/includes/WebStart.php'; diff --git a/languages/Language.php b/languages/Language.php index 467dc78971..7ef441b167 100644 --- a/languages/Language.php +++ b/languages/Language.php @@ -169,11 +169,10 @@ class Language { * Generated by UnicodeJS (see tools/strongDir) from the UCD; see * https://phabricator.wikimedia.org/diffusion/GUJS/ . */ - // @codingStandardsIgnoreStart // @codeCoverageIgnoreStart + // phpcs:ignore Generic.Files.LineLength static private $strongDirRegex = '/(?:([\x{41}-\x{5a}\x{61}-\x{7a}\x{aa}\x{b5}\x{ba}\x{c0}-\x{d6}\x{d8}-\x{f6}\x{f8}-\x{2b8}\x{2bb}-\x{2c1}\x{2d0}\x{2d1}\x{2e0}-\x{2e4}\x{2ee}\x{370}-\x{373}\x{376}\x{377}\x{37a}-\x{37d}\x{37f}\x{386}\x{388}-\x{38a}\x{38c}\x{38e}-\x{3a1}\x{3a3}-\x{3f5}\x{3f7}-\x{482}\x{48a}-\x{52f}\x{531}-\x{556}\x{559}-\x{55f}\x{561}-\x{587}\x{589}\x{903}-\x{939}\x{93b}\x{93d}-\x{940}\x{949}-\x{94c}\x{94e}-\x{950}\x{958}-\x{961}\x{964}-\x{980}\x{982}\x{983}\x{985}-\x{98c}\x{98f}\x{990}\x{993}-\x{9a8}\x{9aa}-\x{9b0}\x{9b2}\x{9b6}-\x{9b9}\x{9bd}-\x{9c0}\x{9c7}\x{9c8}\x{9cb}\x{9cc}\x{9ce}\x{9d7}\x{9dc}\x{9dd}\x{9df}-\x{9e1}\x{9e6}-\x{9f1}\x{9f4}-\x{9fa}\x{a03}\x{a05}-\x{a0a}\x{a0f}\x{a10}\x{a13}-\x{a28}\x{a2a}-\x{a30}\x{a32}\x{a33}\x{a35}\x{a36}\x{a38}\x{a39}\x{a3e}-\x{a40}\x{a59}-\x{a5c}\x{a5e}\x{a66}-\x{a6f}\x{a72}-\x{a74}\x{a83}\x{a85}-\x{a8d}\x{a8f}-\x{a91}\x{a93}-\x{aa8}\x{aaa}-\x{ab0}\x{ab2}\x{ab3}\x{ab5}-\x{ab9}\x{abd}-\x{ac0}\x{ac9}\x{acb}\x{acc}\x{ad0}\x{ae0}\x{ae1}\x{ae6}-\x{af0}\x{af9}\x{b02}\x{b03}\x{b05}-\x{b0c}\x{b0f}\x{b10}\x{b13}-\x{b28}\x{b2a}-\x{b30}\x{b32}\x{b33}\x{b35}-\x{b39}\x{b3d}\x{b3e}\x{b40}\x{b47}\x{b48}\x{b4b}\x{b4c}\x{b57}\x{b5c}\x{b5d}\x{b5f}-\x{b61}\x{b66}-\x{b77}\x{b83}\x{b85}-\x{b8a}\x{b8e}-\x{b90}\x{b92}-\x{b95}\x{b99}\x{b9a}\x{b9c}\x{b9e}\x{b9f}\x{ba3}\x{ba4}\x{ba8}-\x{baa}\x{bae}-\x{bb9}\x{bbe}\x{bbf}\x{bc1}\x{bc2}\x{bc6}-\x{bc8}\x{bca}-\x{bcc}\x{bd0}\x{bd7}\x{be6}-\x{bf2}\x{c01}-\x{c03}\x{c05}-\x{c0c}\x{c0e}-\x{c10}\x{c12}-\x{c28}\x{c2a}-\x{c39}\x{c3d}\x{c41}-\x{c44}\x{c58}-\x{c5a}\x{c60}\x{c61}\x{c66}-\x{c6f}\x{c7f}\x{c82}\x{c83}\x{c85}-\x{c8c}\x{c8e}-\x{c90}\x{c92}-\x{ca8}\x{caa}-\x{cb3}\x{cb5}-\x{cb9}\x{cbd}-\x{cc4}\x{cc6}-\x{cc8}\x{cca}\x{ccb}\x{cd5}\x{cd6}\x{cde}\x{ce0}\x{ce1}\x{ce6}-\x{cef}\x{cf1}\x{cf2}\x{d02}\x{d03}\x{d05}-\x{d0c}\x{d0e}-\x{d10}\x{d12}-\x{d3a}\x{d3d}-\x{d40}\x{d46}-\x{d48}\x{d4a}-\x{d4c}\x{d4e}\x{d57}\x{d5f}-\x{d61}\x{d66}-\x{d75}\x{d79}-\x{d7f}\x{d82}\x{d83}\x{d85}-\x{d96}\x{d9a}-\x{db1}\x{db3}-\x{dbb}\x{dbd}\x{dc0}-\x{dc6}\x{dcf}-\x{dd1}\x{dd8}-\x{ddf}\x{de6}-\x{def}\x{df2}-\x{df4}\x{e01}-\x{e30}\x{e32}\x{e33}\x{e40}-\x{e46}\x{e4f}-\x{e5b}\x{e81}\x{e82}\x{e84}\x{e87}\x{e88}\x{e8a}\x{e8d}\x{e94}-\x{e97}\x{e99}-\x{e9f}\x{ea1}-\x{ea3}\x{ea5}\x{ea7}\x{eaa}\x{eab}\x{ead}-\x{eb0}\x{eb2}\x{eb3}\x{ebd}\x{ec0}-\x{ec4}\x{ec6}\x{ed0}-\x{ed9}\x{edc}-\x{edf}\x{f00}-\x{f17}\x{f1a}-\x{f34}\x{f36}\x{f38}\x{f3e}-\x{f47}\x{f49}-\x{f6c}\x{f7f}\x{f85}\x{f88}-\x{f8c}\x{fbe}-\x{fc5}\x{fc7}-\x{fcc}\x{fce}-\x{fda}\x{1000}-\x{102c}\x{1031}\x{1038}\x{103b}\x{103c}\x{103f}-\x{1057}\x{105a}-\x{105d}\x{1061}-\x{1070}\x{1075}-\x{1081}\x{1083}\x{1084}\x{1087}-\x{108c}\x{108e}-\x{109c}\x{109e}-\x{10c5}\x{10c7}\x{10cd}\x{10d0}-\x{1248}\x{124a}-\x{124d}\x{1250}-\x{1256}\x{1258}\x{125a}-\x{125d}\x{1260}-\x{1288}\x{128a}-\x{128d}\x{1290}-\x{12b0}\x{12b2}-\x{12b5}\x{12b8}-\x{12be}\x{12c0}\x{12c2}-\x{12c5}\x{12c8}-\x{12d6}\x{12d8}-\x{1310}\x{1312}-\x{1315}\x{1318}-\x{135a}\x{1360}-\x{137c}\x{1380}-\x{138f}\x{13a0}-\x{13f5}\x{13f8}-\x{13fd}\x{1401}-\x{167f}\x{1681}-\x{169a}\x{16a0}-\x{16f8}\x{1700}-\x{170c}\x{170e}-\x{1711}\x{1720}-\x{1731}\x{1735}\x{1736}\x{1740}-\x{1751}\x{1760}-\x{176c}\x{176e}-\x{1770}\x{1780}-\x{17b3}\x{17b6}\x{17be}-\x{17c5}\x{17c7}\x{17c8}\x{17d4}-\x{17da}\x{17dc}\x{17e0}-\x{17e9}\x{1810}-\x{1819}\x{1820}-\x{1877}\x{1880}-\x{18a8}\x{18aa}\x{18b0}-\x{18f5}\x{1900}-\x{191e}\x{1923}-\x{1926}\x{1929}-\x{192b}\x{1930}\x{1931}\x{1933}-\x{1938}\x{1946}-\x{196d}\x{1970}-\x{1974}\x{1980}-\x{19ab}\x{19b0}-\x{19c9}\x{19d0}-\x{19da}\x{1a00}-\x{1a16}\x{1a19}\x{1a1a}\x{1a1e}-\x{1a55}\x{1a57}\x{1a61}\x{1a63}\x{1a64}\x{1a6d}-\x{1a72}\x{1a80}-\x{1a89}\x{1a90}-\x{1a99}\x{1aa0}-\x{1aad}\x{1b04}-\x{1b33}\x{1b35}\x{1b3b}\x{1b3d}-\x{1b41}\x{1b43}-\x{1b4b}\x{1b50}-\x{1b6a}\x{1b74}-\x{1b7c}\x{1b82}-\x{1ba1}\x{1ba6}\x{1ba7}\x{1baa}\x{1bae}-\x{1be5}\x{1be7}\x{1bea}-\x{1bec}\x{1bee}\x{1bf2}\x{1bf3}\x{1bfc}-\x{1c2b}\x{1c34}\x{1c35}\x{1c3b}-\x{1c49}\x{1c4d}-\x{1c7f}\x{1cc0}-\x{1cc7}\x{1cd3}\x{1ce1}\x{1ce9}-\x{1cec}\x{1cee}-\x{1cf3}\x{1cf5}\x{1cf6}\x{1d00}-\x{1dbf}\x{1e00}-\x{1f15}\x{1f18}-\x{1f1d}\x{1f20}-\x{1f45}\x{1f48}-\x{1f4d}\x{1f50}-\x{1f57}\x{1f59}\x{1f5b}\x{1f5d}\x{1f5f}-\x{1f7d}\x{1f80}-\x{1fb4}\x{1fb6}-\x{1fbc}\x{1fbe}\x{1fc2}-\x{1fc4}\x{1fc6}-\x{1fcc}\x{1fd0}-\x{1fd3}\x{1fd6}-\x{1fdb}\x{1fe0}-\x{1fec}\x{1ff2}-\x{1ff4}\x{1ff6}-\x{1ffc}\x{200e}\x{2071}\x{207f}\x{2090}-\x{209c}\x{2102}\x{2107}\x{210a}-\x{2113}\x{2115}\x{2119}-\x{211d}\x{2124}\x{2126}\x{2128}\x{212a}-\x{212d}\x{212f}-\x{2139}\x{213c}-\x{213f}\x{2145}-\x{2149}\x{214e}\x{214f}\x{2160}-\x{2188}\x{2336}-\x{237a}\x{2395}\x{249c}-\x{24e9}\x{26ac}\x{2800}-\x{28ff}\x{2c00}-\x{2c2e}\x{2c30}-\x{2c5e}\x{2c60}-\x{2ce4}\x{2ceb}-\x{2cee}\x{2cf2}\x{2cf3}\x{2d00}-\x{2d25}\x{2d27}\x{2d2d}\x{2d30}-\x{2d67}\x{2d6f}\x{2d70}\x{2d80}-\x{2d96}\x{2da0}-\x{2da6}\x{2da8}-\x{2dae}\x{2db0}-\x{2db6}\x{2db8}-\x{2dbe}\x{2dc0}-\x{2dc6}\x{2dc8}-\x{2dce}\x{2dd0}-\x{2dd6}\x{2dd8}-\x{2dde}\x{3005}-\x{3007}\x{3021}-\x{3029}\x{302e}\x{302f}\x{3031}-\x{3035}\x{3038}-\x{303c}\x{3041}-\x{3096}\x{309d}-\x{309f}\x{30a1}-\x{30fa}\x{30fc}-\x{30ff}\x{3105}-\x{312d}\x{3131}-\x{318e}\x{3190}-\x{31ba}\x{31f0}-\x{321c}\x{3220}-\x{324f}\x{3260}-\x{327b}\x{327f}-\x{32b0}\x{32c0}-\x{32cb}\x{32d0}-\x{32fe}\x{3300}-\x{3376}\x{337b}-\x{33dd}\x{33e0}-\x{33fe}\x{3400}-\x{4db5}\x{4e00}-\x{9fd5}\x{a000}-\x{a48c}\x{a4d0}-\x{a60c}\x{a610}-\x{a62b}\x{a640}-\x{a66e}\x{a680}-\x{a69d}\x{a6a0}-\x{a6ef}\x{a6f2}-\x{a6f7}\x{a722}-\x{a787}\x{a789}-\x{a7ad}\x{a7b0}-\x{a7b7}\x{a7f7}-\x{a801}\x{a803}-\x{a805}\x{a807}-\x{a80a}\x{a80c}-\x{a824}\x{a827}\x{a830}-\x{a837}\x{a840}-\x{a873}\x{a880}-\x{a8c3}\x{a8ce}-\x{a8d9}\x{a8f2}-\x{a8fd}\x{a900}-\x{a925}\x{a92e}-\x{a946}\x{a952}\x{a953}\x{a95f}-\x{a97c}\x{a983}-\x{a9b2}\x{a9b4}\x{a9b5}\x{a9ba}\x{a9bb}\x{a9bd}-\x{a9cd}\x{a9cf}-\x{a9d9}\x{a9de}-\x{a9e4}\x{a9e6}-\x{a9fe}\x{aa00}-\x{aa28}\x{aa2f}\x{aa30}\x{aa33}\x{aa34}\x{aa40}-\x{aa42}\x{aa44}-\x{aa4b}\x{aa4d}\x{aa50}-\x{aa59}\x{aa5c}-\x{aa7b}\x{aa7d}-\x{aaaf}\x{aab1}\x{aab5}\x{aab6}\x{aab9}-\x{aabd}\x{aac0}\x{aac2}\x{aadb}-\x{aaeb}\x{aaee}-\x{aaf5}\x{ab01}-\x{ab06}\x{ab09}-\x{ab0e}\x{ab11}-\x{ab16}\x{ab20}-\x{ab26}\x{ab28}-\x{ab2e}\x{ab30}-\x{ab65}\x{ab70}-\x{abe4}\x{abe6}\x{abe7}\x{abe9}-\x{abec}\x{abf0}-\x{abf9}\x{ac00}-\x{d7a3}\x{d7b0}-\x{d7c6}\x{d7cb}-\x{d7fb}\x{e000}-\x{fa6d}\x{fa70}-\x{fad9}\x{fb00}-\x{fb06}\x{fb13}-\x{fb17}\x{ff21}-\x{ff3a}\x{ff41}-\x{ff5a}\x{ff66}-\x{ffbe}\x{ffc2}-\x{ffc7}\x{ffca}-\x{ffcf}\x{ffd2}-\x{ffd7}\x{ffda}-\x{ffdc}\x{10000}-\x{1000b}\x{1000d}-\x{10026}\x{10028}-\x{1003a}\x{1003c}\x{1003d}\x{1003f}-\x{1004d}\x{10050}-\x{1005d}\x{10080}-\x{100fa}\x{10100}\x{10102}\x{10107}-\x{10133}\x{10137}-\x{1013f}\x{101d0}-\x{101fc}\x{10280}-\x{1029c}\x{102a0}-\x{102d0}\x{10300}-\x{10323}\x{10330}-\x{1034a}\x{10350}-\x{10375}\x{10380}-\x{1039d}\x{1039f}-\x{103c3}\x{103c8}-\x{103d5}\x{10400}-\x{1049d}\x{104a0}-\x{104a9}\x{10500}-\x{10527}\x{10530}-\x{10563}\x{1056f}\x{10600}-\x{10736}\x{10740}-\x{10755}\x{10760}-\x{10767}\x{11000}\x{11002}-\x{11037}\x{11047}-\x{1104d}\x{11066}-\x{1106f}\x{11082}-\x{110b2}\x{110b7}\x{110b8}\x{110bb}-\x{110c1}\x{110d0}-\x{110e8}\x{110f0}-\x{110f9}\x{11103}-\x{11126}\x{1112c}\x{11136}-\x{11143}\x{11150}-\x{11172}\x{11174}-\x{11176}\x{11182}-\x{111b5}\x{111bf}-\x{111c9}\x{111cd}\x{111d0}-\x{111df}\x{111e1}-\x{111f4}\x{11200}-\x{11211}\x{11213}-\x{1122e}\x{11232}\x{11233}\x{11235}\x{11238}-\x{1123d}\x{11280}-\x{11286}\x{11288}\x{1128a}-\x{1128d}\x{1128f}-\x{1129d}\x{1129f}-\x{112a9}\x{112b0}-\x{112de}\x{112e0}-\x{112e2}\x{112f0}-\x{112f9}\x{11302}\x{11303}\x{11305}-\x{1130c}\x{1130f}\x{11310}\x{11313}-\x{11328}\x{1132a}-\x{11330}\x{11332}\x{11333}\x{11335}-\x{11339}\x{1133d}-\x{1133f}\x{11341}-\x{11344}\x{11347}\x{11348}\x{1134b}-\x{1134d}\x{11350}\x{11357}\x{1135d}-\x{11363}\x{11480}-\x{114b2}\x{114b9}\x{114bb}-\x{114be}\x{114c1}\x{114c4}-\x{114c7}\x{114d0}-\x{114d9}\x{11580}-\x{115b1}\x{115b8}-\x{115bb}\x{115be}\x{115c1}-\x{115db}\x{11600}-\x{11632}\x{1163b}\x{1163c}\x{1163e}\x{11641}-\x{11644}\x{11650}-\x{11659}\x{11680}-\x{116aa}\x{116ac}\x{116ae}\x{116af}\x{116b6}\x{116c0}-\x{116c9}\x{11700}-\x{11719}\x{11720}\x{11721}\x{11726}\x{11730}-\x{1173f}\x{118a0}-\x{118f2}\x{118ff}\x{11ac0}-\x{11af8}\x{12000}-\x{12399}\x{12400}-\x{1246e}\x{12470}-\x{12474}\x{12480}-\x{12543}\x{13000}-\x{1342e}\x{14400}-\x{14646}\x{16800}-\x{16a38}\x{16a40}-\x{16a5e}\x{16a60}-\x{16a69}\x{16a6e}\x{16a6f}\x{16ad0}-\x{16aed}\x{16af5}\x{16b00}-\x{16b2f}\x{16b37}-\x{16b45}\x{16b50}-\x{16b59}\x{16b5b}-\x{16b61}\x{16b63}-\x{16b77}\x{16b7d}-\x{16b8f}\x{16f00}-\x{16f44}\x{16f50}-\x{16f7e}\x{16f93}-\x{16f9f}\x{1b000}\x{1b001}\x{1bc00}-\x{1bc6a}\x{1bc70}-\x{1bc7c}\x{1bc80}-\x{1bc88}\x{1bc90}-\x{1bc99}\x{1bc9c}\x{1bc9f}\x{1d000}-\x{1d0f5}\x{1d100}-\x{1d126}\x{1d129}-\x{1d166}\x{1d16a}-\x{1d172}\x{1d183}\x{1d184}\x{1d18c}-\x{1d1a9}\x{1d1ae}-\x{1d1e8}\x{1d360}-\x{1d371}\x{1d400}-\x{1d454}\x{1d456}-\x{1d49c}\x{1d49e}\x{1d49f}\x{1d4a2}\x{1d4a5}\x{1d4a6}\x{1d4a9}-\x{1d4ac}\x{1d4ae}-\x{1d4b9}\x{1d4bb}\x{1d4bd}-\x{1d4c3}\x{1d4c5}-\x{1d505}\x{1d507}-\x{1d50a}\x{1d50d}-\x{1d514}\x{1d516}-\x{1d51c}\x{1d51e}-\x{1d539}\x{1d53b}-\x{1d53e}\x{1d540}-\x{1d544}\x{1d546}\x{1d54a}-\x{1d550}\x{1d552}-\x{1d6a5}\x{1d6a8}-\x{1d6da}\x{1d6dc}-\x{1d714}\x{1d716}-\x{1d74e}\x{1d750}-\x{1d788}\x{1d78a}-\x{1d7c2}\x{1d7c4}-\x{1d7cb}\x{1d800}-\x{1d9ff}\x{1da37}-\x{1da3a}\x{1da6d}-\x{1da74}\x{1da76}-\x{1da83}\x{1da85}-\x{1da8b}\x{1f110}-\x{1f12e}\x{1f130}-\x{1f169}\x{1f170}-\x{1f19a}\x{1f1e6}-\x{1f202}\x{1f210}-\x{1f23a}\x{1f240}-\x{1f248}\x{1f250}\x{1f251}\x{20000}-\x{2a6d6}\x{2a700}-\x{2b734}\x{2b740}-\x{2b81d}\x{2b820}-\x{2cea1}\x{2f800}-\x{2fa1d}\x{f0000}-\x{ffffd}\x{100000}-\x{10fffd}])|([\x{590}\x{5be}\x{5c0}\x{5c3}\x{5c6}\x{5c8}-\x{5ff}\x{7c0}-\x{7ea}\x{7f4}\x{7f5}\x{7fa}-\x{815}\x{81a}\x{824}\x{828}\x{82e}-\x{858}\x{85c}-\x{89f}\x{200f}\x{fb1d}\x{fb1f}-\x{fb28}\x{fb2a}-\x{fb4f}\x{10800}-\x{1091e}\x{10920}-\x{10a00}\x{10a04}\x{10a07}-\x{10a0b}\x{10a10}-\x{10a37}\x{10a3b}-\x{10a3e}\x{10a40}-\x{10ae4}\x{10ae7}-\x{10b38}\x{10b40}-\x{10e5f}\x{10e7f}-\x{10fff}\x{1e800}-\x{1e8cf}\x{1e8d7}-\x{1edff}\x{1ef00}-\x{1efff}\x{608}\x{60b}\x{60d}\x{61b}-\x{64a}\x{66d}-\x{66f}\x{671}-\x{6d5}\x{6e5}\x{6e6}\x{6ee}\x{6ef}\x{6fa}-\x{710}\x{712}-\x{72f}\x{74b}-\x{7a5}\x{7b1}-\x{7bf}\x{8a0}-\x{8e2}\x{fb50}-\x{fd3d}\x{fd40}-\x{fdcf}\x{fdf0}-\x{fdfc}\x{fdfe}\x{fdff}\x{fe70}-\x{fefe}\x{1ee00}-\x{1eeef}\x{1eef2}-\x{1eeff}]))/u'; // @codeCoverageIgnoreEnd - // @codingStandardsIgnoreEnd /** * Get a cached or new language object for a given language code @@ -4732,8 +4731,7 @@ class Language { } $dirmark = ( $oppositedm ? $this->getDirMark( true ) : '' ) . $this->getDirMark(); - return - $page . + return $page . $dirmark . $this->msg( 'word-separator' )->escaped() . $this->msg( 'parentheses' )->rawParams( $details )->escaped(); diff --git a/languages/LanguageConverter.php b/languages/LanguageConverter.php index a84c4b8281..f9631a1d22 100644 --- a/languages/LanguageConverter.php +++ b/languages/LanguageConverter.php @@ -680,9 +680,8 @@ class LanguageConverter { $noScript = '.*?<\/script>(*SKIP)(*FAIL)'; $noStyle = '.*?<\/style>(*SKIP)(*FAIL)'; - // @codingStandardsIgnoreStart Generic.Files.LineLength.TooLong + // phpcs:ignore Generic.Files.LineLength $noHtml = '<(?:[^>=]*+(?>[^>=]*+=\s*+(?:"[^"]*"|\'[^\']*\'|[^\'">\s]*+))*+[^>=]*+>|.*+)(*SKIP)(*FAIL)'; - // @codingStandardsIgnoreEnd while ( $startPos < $length && $continue ) { $continue = preg_match( // Only match -{ outside of html. diff --git a/languages/classes/LanguageBe_tarask.php b/languages/classes/LanguageBe_tarask.php index 6007bb4395..96e040f917 100644 --- a/languages/classes/LanguageBe_tarask.php +++ b/languages/classes/LanguageBe_tarask.php @@ -30,9 +30,8 @@ * @ingroup Language * @see http://be-x-old.wikipedia.org/wiki/Project_talk:LanguageBe_tarask.php */ -// @codingStandardsIgnoreStart Ignore class name is not in camel caps format error +// phpcs:ignore Squiz.Classes.ValidClassName.NotCamelCaps class LanguageBe_tarask extends Language { - // @codingStandardsIgnoreEnd /** * The Belarusian language uses apostrophe sign, * but the characters used for this could be both U+0027 and U+2019. diff --git a/languages/classes/LanguageKk_cyrl.php b/languages/classes/LanguageKk_cyrl.php index 39d19e75f2..da97c5e58e 100644 --- a/languages/classes/LanguageKk_cyrl.php +++ b/languages/classes/LanguageKk_cyrl.php @@ -26,9 +26,8 @@ * * @ingroup Language */ -// @codingStandardsIgnoreStart Ignore class name is not in camel caps format error +// phpcs:ignore Squiz.Classes.ValidClassName.NotCamelCaps class LanguageKk_cyrl extends Language { - // @codingStandardsIgnoreEnd # Convert from the nominative form of a noun to some other case # Invoked with {{GRAMMAR:case|word}} /** diff --git a/languages/classes/LanguageKu_ku.php b/languages/classes/LanguageKu_ku.php index 4e9c3659b6..a9db9e7004 100644 --- a/languages/classes/LanguageKu_ku.php +++ b/languages/classes/LanguageKu_ku.php @@ -26,9 +26,8 @@ * * @ingroup Language */ -// @codingStandardsIgnoreStart Ignore class name is not in camel caps format error +// phpcs:ignore Squiz.Classes.ValidClassName.NotCamelCaps class LanguageKu_ku extends Language { - // @codingStandardsIgnoreEnd /** * Avoid grouping whole numbers between 0 to 9999 * diff --git a/languages/classes/LanguageZh_hans.php b/languages/classes/LanguageZh_hans.php index 9d81c213cf..19c2d3ae6c 100644 --- a/languages/classes/LanguageZh_hans.php +++ b/languages/classes/LanguageZh_hans.php @@ -26,9 +26,8 @@ * * @ingroup Language */ -// @codingStandardsIgnoreStart Ignore class name is not in camel caps format error +// phpcs:ignore Squiz.Classes.ValidClassName.NotCamelCaps class LanguageZh_hans extends Language { - // @codingStandardsIgnoreEnd /** * @return bool */ diff --git a/maintenance/benchmarks/bench_utf8_title_check.php b/maintenance/benchmarks/bench_utf8_title_check.php index 3091de6208..52b00f1b9f 100644 --- a/maintenance/benchmarks/bench_utf8_title_check.php +++ b/maintenance/benchmarks/bench_utf8_title_check.php @@ -37,7 +37,7 @@ class BenchUtf8TitleCheck extends Benchmarker { public function __construct() { parent::__construct(); - // @codingStandardsIgnoreStart Ignore long line warnings. + // phpcs:disable Generic.Files.LineLength $this->data = [ "", "United States of America", // 7bit ASCII @@ -59,7 +59,7 @@ class BenchUtf8TitleCheck extends Benchmarker { . "Sara%20Sidle%7CSofia%20Curtis%7CS%C3%A9rie%20t%C3%A9l%C3%A9vis%C3%A9e%7CWallace%20Langham%7C" . "Warrick%20Brown%7CWendy%20Simms%7C%C3%89tats-Unis" ]; - // @codingStandardsIgnoreEnd + // phpcs:enable $this->addDescription( "Benchmark for using a regexp vs. mb_check_encoding " . "to check for UTF-8 encoding." ); diff --git a/maintenance/commandLine.inc b/maintenance/commandLine.inc index 206e04677b..33299588fd 100644 --- a/maintenance/commandLine.inc +++ b/maintenance/commandLine.inc @@ -23,10 +23,9 @@ require_once __DIR__ . '/Maintenance.php'; -// @codingStandardsIgnoreStart MediaWiki.NamingConventions.ValidGlobalName.wgPrefix -global $optionsWithArgs; -global $optionsWithoutArgs; -// @codingStandardsIgnoreEnd +// phpcs:ignore MediaWiki.NamingConventions.ValidGlobalName.wgPrefix +global $optionsWithArgs, $optionsWithoutArgs; + if ( !isset( $optionsWithArgs ) ) { $optionsWithArgs = []; } @@ -36,9 +35,9 @@ if ( !isset( $optionsWithoutArgs ) ) { class CommandLineInc extends Maintenance { public function __construct() { - // @codingStandardsIgnoreStart MediaWiki.NamingConventions.ValidGlobalName.wgPrefix + // phpcs:ignore MediaWiki.NamingConventions.ValidGlobalName.wgPrefix global $optionsWithArgs, $optionsWithoutArgs; - // @codingStandardsIgnoreEnd + parent::__construct(); foreach ( $optionsWithArgs as $name ) { $this->addOption( $name, '', false, true ); @@ -60,9 +59,9 @@ class CommandLineInc extends Maintenance { } public function execute() { - // @codingStandardsIgnoreStart MediaWiki.NamingConventions.ValidGlobalName.wgPrefix + // phpcs:ignore MediaWiki.NamingConventions.ValidGlobalName.wgPrefix global $args, $options; - // @codingStandardsIgnoreEnd + $args = $this->mArgs; $options = $this->mOptions; } diff --git a/maintenance/deleteBatch.php b/maintenance/deleteBatch.php index eceadc1111..c3cbdebcdf 100644 --- a/maintenance/deleteBatch.php +++ b/maintenance/deleteBatch.php @@ -83,9 +83,8 @@ class DeleteBatch extends Maintenance { $dbw = $this->getDB( DB_MASTER ); # Handle each entry - // @codingStandardsIgnoreStart Ignore Generic.CodeAnalysis.ForLoopWithTestFunctionCall.NotAllowed + // phpcs:ignore Generic.CodeAnalysis.ForLoopWithTestFunctionCall for ( $linenum = 1; !feof( $file ); $linenum++ ) { - // @codingStandardsIgnoreEnd $line = trim( fgets( $file ) ); if ( $line == '' ) { continue; diff --git a/maintenance/doMaintenance.php b/maintenance/doMaintenance.php index 2ac756cbe8..ad75c6b68c 100644 --- a/maintenance/doMaintenance.php +++ b/maintenance/doMaintenance.php @@ -62,7 +62,7 @@ if ( !defined( 'MW_CONFIG_CALLBACK' ) && !defined( 'MW_CONFIG_FILE' ) ) { // Custom setup for Maintenance entry point if ( !defined( 'MW_SETUP_CALLBACK' ) ) { function wfMaintenanceSetup() { - // @codingStandardsIgnoreLine MediaWiki.NamingConventions.ValidGlobalName.wgPrefix + // phpcs:ignore MediaWiki.NamingConventions.ValidGlobalName.wgPrefix global $maintenance, $wgLocalisationCacheConf, $wgCacheDirectory; if ( $maintenance->getDbType() === Maintenance::DB_NONE ) { if ( $wgLocalisationCacheConf['storeClass'] === false diff --git a/maintenance/generateSitemap.php b/maintenance/generateSitemap.php index bed84a811b..1be2a27908 100644 --- a/maintenance/generateSitemap.php +++ b/maintenance/generateSitemap.php @@ -484,8 +484,7 @@ class GenerateSitemap extends Maintenance { * @return string */ function indexEntry( $filename ) { - return - "\t\n" . + return "\t\n" . "\t\t{$this->urlpath}$filename\n" . "\t\t{$this->timestamp}\n" . "\t\n"; @@ -518,8 +517,7 @@ class GenerateSitemap extends Maintenance { * @return string */ function fileEntry( $url, $date, $priority ) { - return - "\t\n" . + return "\t\n" . // T36666: $url may contain bad characters such as ampersands. "\t\t" . htmlspecialchars( $url ) . "\n" . "\t\t$date\n" . diff --git a/maintenance/language/checkLanguage.inc b/maintenance/language/checkLanguage.inc index 9e9fd3eeec..007ced1560 100644 --- a/maintenance/language/checkLanguage.inc +++ b/maintenance/language/checkLanguage.inc @@ -332,9 +332,8 @@ ENDS; return $blacklist; } - // @codingStandardsIgnoreStart Ignore that globals should have a "wg" prefix. + // phpcs:ignore MediaWiki.NamingConventions.ValidGlobalName.wgPrefix global $checkBlacklist; - // @codingStandardsIgnoreEnd $blacklist = $checkBlacklist; @@ -517,7 +516,7 @@ ENDS; $tableRows = implode( "\n|-\n", $rows ); $version = SpecialVersion::getVersion( 'nodb' ); - // @codingStandardsIgnoreStart Long line. + // phpcs:disable Generic.Files.LineLength echo <<$version @@ -529,7 +528,7 @@ $tableRows $detailText EOL; - // @codingStandardsIgnoreEnd + // phpcs:enable } /** diff --git a/maintenance/mergeMessageFileList.php b/maintenance/mergeMessageFileList.php index b749da422b..7d85259ef9 100644 --- a/maintenance/mergeMessageFileList.php +++ b/maintenance/mergeMessageFileList.php @@ -52,9 +52,8 @@ class MergeMessageFileList extends Maintenance { } public function execute() { - // @codingStandardsIgnoreStart Ignore error: Global variable "$mmfl" is lacking 'wg' prefix + // phpcs:ignore MediaWiki.NamingConventions.ValidGlobalName.wgPrefix global $mmfl; - // @codingStandardsIgnoreEnd global $wgExtensionEntryPointListFiles; if ( !count( $wgExtensionEntryPointListFiles ) diff --git a/maintenance/moveBatch.php b/maintenance/moveBatch.php index fa25a06cca..9c53daa360 100644 --- a/maintenance/moveBatch.php +++ b/maintenance/moveBatch.php @@ -86,9 +86,8 @@ class MoveBatch extends Maintenance { # Setup complete, now start $dbw = $this->getDB( DB_MASTER ); - // @codingStandardsIgnoreStart Ignore avoid function calls in a FOR loop test part warning + // phpcs:ignore Generic.CodeAnalysis.ForLoopWithTestFunctionCall for ( $linenum = 1; !feof( $file ); $linenum++ ) { - // @codingStandardsIgnoreEnd $line = fgets( $file ); if ( $line === false ) { break; diff --git a/maintenance/storage/compressOld.php b/maintenance/storage/compressOld.php index 0ae46ae22a..4d56ef07d5 100644 --- a/maintenance/storage/compressOld.php +++ b/maintenance/storage/compressOld.php @@ -361,10 +361,9 @@ class CompressOld extends Maintenance { $usedChunk = false; $primaryOldid = $revs[$i]->rev_text_id; - // @codingStandardsIgnoreStart Ignore avoid function calls in a FOR loop test part warning # Get the text of each revision and add it to the object + // phpcs:ignore Generic.CodeAnalysis.ForLoopWithTestFunctionCall for ( $j = 0; $j < $thisChunkSize && $chunk->isHappy(); $j++ ) { - // @codingStandardsIgnoreEnd $oldid = $revs[$i + $j]->rev_text_id; # Get text diff --git a/maintenance/update.php b/maintenance/update.php index 529c069e79..e60efdb8b4 100755 --- a/maintenance/update.php +++ b/maintenance/update.php @@ -170,11 +170,9 @@ class UpdateMediaWiki extends Maintenance { $badPhpUnit = dirname( __DIR__ ) . '/vendor/phpunit/phpunit/src/Util/PHP/eval-stdin.php'; if ( file_exists( $badPhpUnit ) ) { - // @codingStandardsIgnoreStart Generic.Files.LineLength.TooLong // Bad versions of the file are: // https://raw.githubusercontent.com/sebastianbergmann/phpunit/c820f915bfae34e5a836f94967a2a5ea5ef34f21/src/Util/PHP/eval-stdin.php // https://raw.githubusercontent.com/sebastianbergmann/phpunit/3aaddb1c5bd9b9b8d070b4cf120e71c36fd08412/src/Util/PHP/eval-stdin.php - // @codingStandardsIgnoreEnd $md5 = md5_file( $badPhpUnit ); if ( $md5 === '120ac49800671dc383b6f3709c25c099' || $md5 === '28af792cb38fc9a1b236b91c1aad2876' diff --git a/maintenance/userOptions.php b/maintenance/userOptions.php index 5692f11a15..eb8da57e86 100644 --- a/maintenance/userOptions.php +++ b/maintenance/userOptions.php @@ -107,18 +107,16 @@ The new option is NOT validated.' ); $userValue = $user->getOption( $option ); if ( $userValue <> $defaultOptions[$option] ) { - // @codingStandardsIgnoreStart Ignore silencing errors is discouraged warning + // phpcs:ignore Generic.PHP.NoSilencedErrors.Discouraged @$ret[$option][$userValue]++; - // @codingStandardsIgnoreEnd } } else { foreach ( $defaultOptions as $name => $defaultValue ) { $userValue = $user->getOption( $name ); if ( $userValue != $defaultValue ) { - // @codingStandardsIgnoreStart Ignore silencing errors is discouraged warning + // phpcs:ignore Generic.PHP.NoSilencedErrors.Discouraged @$ret[$name][$userValue]++; - // @codingStandardsIgnoreEnd } } } diff --git a/mw-config/index.php b/mw-config/index.php index 10b8d973cd..72cf65464b 100644 --- a/mw-config/index.php +++ b/mw-config/index.php @@ -1,5 +1,5 @@ name() ) ) . $extet ?>
- + time() / self::$totaltime * 100 ); ?> memory() / self::$totalmemory * 100 ); ?> count(); ?> @@ -231,7 +230,7 @@ class profile_point { memoryPerCall() / 1024 ), 2 ); ?> time() / self::$totalcount ), 2 ); ?> memory() / self::$totalcount / 1024 ), 2 ); ?> - + time / $this->count ); - // @codingStandardsIgnoreEnd } public function memoryPerCall() { - // @codingStandardsIgnoreStart + // phpcs:ignore Generic.PHP.NoSilencedErrors.Discouraged return @( $this->memory / $this->count ); - // @codingStandardsIgnoreEnd } public function callsPerRequest() { - // @codingStandardsIgnoreStart + // phpcs:ignore Generic.PHP.NoSilencedErrors.Discouraged return @( $this->count / self::$totalcount ); - // @codingStandardsIgnoreEnd } public function timePerRequest() { - // @codingStandardsIgnoreStart + // phpcs:ignore Generic.PHP.NoSilencedErrors.Discouraged return @( $this->time / self::$totalcount ); - // @codingStandardsIgnoreEnd } public function memoryPerRequest() { - // @codingStandardsIgnoreStart + // phpcs:ignore Generic.PHP.NoSilencedErrors.Discouraged return @( $this->memory / self::$totalcount ); - // @codingStandardsIgnoreEnd } public function fmttime() { @@ -293,9 +287,9 @@ class profile_point { }; function compare_point( profile_point $a, profile_point $b ) { - // @codingStandardsIgnoreStart + // phpcs:ignore MediaWiki.NamingConventions.ValidGlobalName.wgPrefix global $sort; - // @codingStandardsIgnoreEnd + switch ( $sort ) { case 'name': return strcmp( $a->name(), $b->name() ); @@ -390,9 +384,8 @@ if ( isset( $_REQUEST['filter'] ) ) { profile_point::$totalmemory = 0.0; function getEscapedProfileUrl( $_filter = false, $_sort = false, $_expand = false ) { - // @codingStandardsIgnoreStart + // phpcs:ignore MediaWiki.NamingConventions.ValidGlobalName.wgPrefix global $filter, $sort, $expand; - // @codingStandardsIgnoreEnd if ( $_expand === false ) { $_expand = $expand; @@ -441,9 +434,8 @@ if ( isset( $_REQUEST['filter'] ) ) { } $points[] = $s; - // @codingStandardsIgnoreStart + // phpcs:ignore Generic.PHP.NoSilencedErrors.Discouraged @usort( $points, 'compare_point' ); - // @codingStandardsIgnoreEnd foreach ( $points as $point ) { if ( strlen( $filter ) && !strstr( $point->name(), $filter ) ) { diff --git a/tests/common/TestsAutoLoader.php b/tests/common/TestsAutoLoader.php index cbf4a1598a..a51008edb3 100644 --- a/tests/common/TestsAutoLoader.php +++ b/tests/common/TestsAutoLoader.php @@ -24,7 +24,7 @@ global $wgAutoloadClasses; $testDir = __DIR__ . "/.."; -// @codingStandardsIgnoreStart Generic.Files.LineLength.TooLong +// phpcs:disable Generic.Files.LineLength $wgAutoloadClasses += [ # tests/common @@ -175,4 +175,4 @@ $wgAutoloadClasses += [ 'ParserTestFileSuite' => "$testDir/phpunit/suites/ParserTestFileSuite.php", 'ParserTestTopLevelSuite' => "$testDir/phpunit/suites/ParserTestTopLevelSuite.php", ]; -// @codingStandardsIgnoreEnd +// phpcs:enable diff --git a/tests/parser/ParserTestParserHook.php b/tests/parser/ParserTestParserHook.php index 5bf50ead6d..5995012b3b 100644 --- a/tests/parser/ParserTestParserHook.php +++ b/tests/parser/ParserTestParserHook.php @@ -57,8 +57,7 @@ class ParserTestParserHook { $parser->static_tag_buf = null; return $tmp; } else { // wtf? - return - "\nCall this extension as string or as" . + return "\nCall this extension as string or as" . " , not in any other way.\n" . "text: " . var_export( $in, true ) . "\n" . "argv: " . var_export( $argv, true ) . "\n"; diff --git a/tests/parser/editTests.php b/tests/parser/editTests.php index a9704e69e2..cb430f280d 100644 --- a/tests/parser/editTests.php +++ b/tests/parser/editTests.php @@ -419,8 +419,7 @@ class ParserEditTests extends Maintenance { print "Wrote updated file\n"; } else { print "Cannot write updated file, here is a patch you can paste:\n\n"; - print - "--- {$fileName}\n" . + print "--- {$fileName}\n" . "+++ {$fileName}~\n" . $this->unifiedDiff( $text, $result ) . "\n"; diff --git a/tests/phan/stubs/hhvm.php b/tests/phan/stubs/hhvm.php index 79feaa00fd..364ebdaa15 100644 --- a/tests/phan/stubs/hhvm.php +++ b/tests/phan/stubs/hhvm.php @@ -16,7 +16,7 @@ * http://www.gnu.org/copyleft/gpl.html */ -// @codingStandardsIgnoreFile +// phpcs:ignoreFile /** * @param callable $callback diff --git a/tests/phan/stubs/mail.php b/tests/phan/stubs/mail.php index 7cd9016771..ba1efb9645 100644 --- a/tests/phan/stubs/mail.php +++ b/tests/phan/stubs/mail.php @@ -3,7 +3,7 @@ /** * Minimal set of classes necessary for UserMailer to be happy. Types * taken from documentation at pear.php.net. - * @codingStandardsIgnoreFile + * phpcs:ignoreFile */ class PEAR { diff --git a/tests/phan/stubs/memcached.php b/tests/phan/stubs/memcached.php index ee47937a76..0f8859d2e1 100644 --- a/tests/phan/stubs/memcached.php +++ b/tests/phan/stubs/memcached.php @@ -5,7 +5,7 @@ * that they are optional. Phan can not detect this and thus throws an error for a usage with * no params. So we have this small stub just for the constructor to allow no params. * @see https://secure.php.net/manual/en/memcached.construct.php - * @codingStandardsIgnoreFile + * phpcs:ignoreFile */ class Memcached { diff --git a/tests/phan/stubs/tideways.php b/tests/phan/stubs/tideways.php index 1372219ba5..34ac735ca8 100644 --- a/tests/phan/stubs/tideways.php +++ b/tests/phan/stubs/tideways.php @@ -2,7 +2,7 @@ /** * Minimal set of classes necessary for Xhprof using tideways - * @codingStandardsIgnoreFile + * phpcs:ignoreFile */ function tideways_enable(){ diff --git a/tests/phan/stubs/wikidiff.php b/tests/phan/stubs/wikidiff.php index 1015b0b9ba..bd4ed6358d 100644 --- a/tests/phan/stubs/wikidiff.php +++ b/tests/phan/stubs/wikidiff.php @@ -16,7 +16,7 @@ * http://www.gnu.org/copyleft/gpl.html */ -// @codingStandardsIgnoreFile +// phpcs:ignoreFile /** * @param string $text1 diff --git a/tests/phpunit/includes/LinkerTest.php b/tests/phpunit/includes/LinkerTest.php index f4844f89bb..7f42254102 100644 --- a/tests/phpunit/includes/LinkerTest.php +++ b/tests/phpunit/includes/LinkerTest.php @@ -133,7 +133,7 @@ class LinkerTest extends MediaWikiLangTestCase { public function provideCasesForFormatComment() { $wikiId = 'enwiki'; // $wgConf has a fake entry for this - // @codingStandardsIgnoreStart Generic.Files.LineLength + // phpcs:disable Generic.Files.LineLength return [ // Linker::formatComment [ @@ -257,7 +257,7 @@ class LinkerTest extends MediaWikiLangTestCase { false, false, $wikiId ], ]; - // @codingStandardsIgnoreEnd + // phpcs:enable } /** @@ -289,7 +289,7 @@ class LinkerTest extends MediaWikiLangTestCase { } public static function provideCasesForFormatLinksInComment() { - // @codingStandardsIgnoreStart Generic.Files.LineLength + // phpcs:disable Generic.Files.LineLength return [ [ 'foo bar Special:BlankPage', @@ -312,43 +312,43 @@ class LinkerTest extends MediaWikiLangTestCase { 'enwiki', ], ]; - // @codingStandardsIgnoreEnd + // phpcs:enable } public static function provideLinkBeginHook() { - // @codingStandardsIgnoreStart Generic.Files.LineLength + // phpcs:disable Generic.Files.LineLength return [ // Modify $html [ - function( $dummy, $title, &$html, &$attribs, &$query, &$options, &$ret ) { + function ( $dummy, $title, &$html, &$attribs, &$query, &$options, &$ret ) { $html = 'foobar'; }, 'foobar' ], // Modify $attribs [ - function( $dummy, $title, &$html, &$attribs, &$query, &$options, &$ret ) { + function ( $dummy, $title, &$html, &$attribs, &$query, &$options, &$ret ) { $attribs['bar'] = 'baz'; }, 'Special:BlankPage' ], // Modify $query [ - function( $dummy, $title, &$html, &$attribs, &$query, &$options, &$ret ) { + function ( $dummy, $title, &$html, &$attribs, &$query, &$options, &$ret ) { $query['bar'] = 'baz'; }, 'Special:BlankPage' ], // Force HTTP $options [ - function( $dummy, $title, &$html, &$attribs, &$query, &$options, &$ret ) { + function ( $dummy, $title, &$html, &$attribs, &$query, &$options, &$ret ) { $options = [ 'http' ]; }, 'Special:BlankPage' ], // Force 'forcearticlepath' in $options [ - function( $dummy, $title, &$html, &$attribs, &$query, &$options, &$ret ) { + function ( $dummy, $title, &$html, &$attribs, &$query, &$options, &$ret ) { $options = [ 'forcearticlepath' ]; $query['foo'] = 'bar'; }, @@ -356,14 +356,14 @@ class LinkerTest extends MediaWikiLangTestCase { ], // Abort early [ - function( $dummy, $title, &$html, &$attribs, &$query, &$options, &$ret ) { + function ( $dummy, $title, &$html, &$attribs, &$query, &$options, &$ret ) { $ret = 'foobar'; return false; }, 'foobar' ], ]; - // @codingStandardsIgnoreEnd + // phpcs:enable } /** diff --git a/tests/phpunit/includes/OutputPageTest.php b/tests/phpunit/includes/OutputPageTest.php index c3488343da..44b97078b4 100644 --- a/tests/phpunit/includes/OutputPageTest.php +++ b/tests/phpunit/includes/OutputPageTest.php @@ -274,7 +274,7 @@ class OutputPageTest extends MediaWikiTestCase { } public static function provideMakeResourceLoaderLink() { - // @codingStandardsIgnoreStart Generic.Files.LineLength + // phpcs:disable Generic.Files.LineLength return [ // Single only=scripts load [ @@ -297,7 +297,7 @@ class OutputPageTest extends MediaWikiTestCase { . "});" ], ]; - // @codingStandardsIgnoreEnd + // phpcs:enable } /** @@ -345,6 +345,7 @@ class OutputPageTest extends MediaWikiTestCase { } public static function provideBuildExemptModules() { + // phpcs:disable Generic.Files.LineLength return [ 'empty' => [ 'exemptStyleModules' => [], @@ -354,7 +355,6 @@ class OutputPageTest extends MediaWikiTestCase { 'exemptStyleModules' => [ 'site' => [], 'noscript' => [], 'private' => [], 'user' => [] ], '', ], - // @codingStandardsIgnoreStart Generic.Files.LineLength 'default logged-out' => [ 'exemptStyleModules' => [ 'site' => [ 'site.styles' ] ], '' . "\n" . @@ -377,8 +377,8 @@ class OutputPageTest extends MediaWikiTestCase { '' . "\n" . '', ], - // @codingStandardsIgnoreEnd Generic.Files.LineLength ]; + // phpcs:enable } /** diff --git a/tests/phpunit/includes/PathRouterTest.php b/tests/phpunit/includes/PathRouterTest.php index 67364cb301..fc6a70b1f4 100644 --- a/tests/phpunit/includes/PathRouterTest.php +++ b/tests/phpunit/includes/PathRouterTest.php @@ -236,7 +236,7 @@ class PathRouterTest extends MediaWikiTestCase { * Ensure the router doesn't choke on long paths. */ public function testLength() { - // @codingStandardsIgnoreStart Ignore long line warnings + // phpcs:disable Generic.Files.LineLength $matches = $this->basicRouter->parse( "/wiki/Lorem_ipsum_dolor_sit_amet,_consectetur_adipisicing_elit,_sed_do_eiusmod_tempor_incididunt_ut_labore_et_dolore_magna_aliqua._Ut_enim_ad_minim_veniam,_quis_nostrud_exercitation_ullamco_laboris_nisi_ut_aliquip_ex_ea_commodo_consequat._Duis_aute_irure_dolor_in_reprehenderit_in_voluptate_velit_esse_cillum_dolore_eu_fugiat_nulla_pariatur._Excepteur_sint_occaecat_cupidatat_non_proident,_sunt_in_culpa_qui_officia_deserunt_mollit_anim_id_est_laborum." ); @@ -244,7 +244,7 @@ class PathRouterTest extends MediaWikiTestCase { $matches, [ 'title' => "Lorem_ipsum_dolor_sit_amet,_consectetur_adipisicing_elit,_sed_do_eiusmod_tempor_incididunt_ut_labore_et_dolore_magna_aliqua._Ut_enim_ad_minim_veniam,_quis_nostrud_exercitation_ullamco_laboris_nisi_ut_aliquip_ex_ea_commodo_consequat._Duis_aute_irure_dolor_in_reprehenderit_in_voluptate_velit_esse_cillum_dolore_eu_fugiat_nulla_pariatur._Excepteur_sint_occaecat_cupidatat_non_proident,_sunt_in_culpa_qui_officia_deserunt_mollit_anim_id_est_laborum." ] ); - // @codingStandardsIgnoreEnd + // phpcs:enable } /** diff --git a/tests/phpunit/includes/SampleTest.php b/tests/phpunit/includes/SampleTest.php index 31eebe3c0e..c0930e3dbf 100644 --- a/tests/phpunit/includes/SampleTest.php +++ b/tests/phpunit/includes/SampleTest.php @@ -57,12 +57,12 @@ class SampleTest extends MediaWikiLangTestCase { ]; } - // @codingStandardsIgnoreStart Generic.Files.LineLength /** + * phpcs:disable Generic.Files.LineLength * @dataProvider provideTitles * See https://phpunit.de/manual/3.7/en/appendixes.annotations.html#appendixes.annotations.dataProvider + * phpcs:enable */ - // @codingStandardsIgnoreEnd public function testCreateBasicListOfTitles( $titleName, $ns, $text ) { $title = Title::newFromText( $titleName, $ns ); $this->assertEquals( $text, "$title", "see if '$titleName' matches '$text'" ); @@ -95,12 +95,10 @@ class SampleTest extends MediaWikiLangTestCase { $this->assertTrue( $title->isLocal() ); } - // @codingStandardsIgnoreStart Generic.Files.LineLength /** * @expectedException InvalidArgumentException * See https://phpunit.de/manual/3.7/en/appendixes.annotations.html#appendixes.annotations.expectedException */ - // @codingStandardsIgnoreEnd public function testTitleObjectFromObject() { $title = Title::newFromText( Title::newFromText( "test" ) ); $this->assertEquals( "Test", $title->isLocal() ); diff --git a/tests/phpunit/includes/api/ApiComparePagesTest.php b/tests/phpunit/includes/api/ApiComparePagesTest.php index 9399ef8ea8..155a08ed06 100644 --- a/tests/phpunit/includes/api/ApiComparePagesTest.php +++ b/tests/phpunit/includes/api/ApiComparePagesTest.php @@ -151,8 +151,8 @@ class ApiComparePagesTest extends ApiTestCase { } public static function provideDiff() { + // phpcs:disable Generic.Files.LineLength.TooLong return [ - // @codingStandardsIgnoreStart Ignore Generic.Files.LineLength.TooLong 'Basic diff, titles' => [ [ 'fromtitle' => 'ApiComparePagesTest A', @@ -604,8 +604,7 @@ class ApiComparePagesTest extends ApiTestCase { [], 'missingcontent' ], - - // @codingStandardsIgnoreEnd ]; + // phpcs:enable } } diff --git a/tests/phpunit/includes/api/format/ApiFormatPhpTest.php b/tests/phpunit/includes/api/format/ApiFormatPhpTest.php index 3aa1db3010..2d2e29b90d 100644 --- a/tests/phpunit/includes/api/format/ApiFormatPhpTest.php +++ b/tests/phpunit/includes/api/format/ApiFormatPhpTest.php @@ -20,7 +20,7 @@ class ApiFormatPhpTest extends ApiFormatTestBase { } public static function provideGeneralEncoding() { - // @codingStandardsIgnoreStart Generic.Files.LineLength + // phpcs:disable Generic.Files.LineLength return array_merge( self::addFormatVersion( 1, [ // Basic types @@ -97,7 +97,7 @@ class ApiFormatPhpTest extends ApiFormatTestBase { 'a:1:{s:3:"foo";s:3:"foo";}' ], ] ) ); - // @codingStandardsIgnoreEnd + // phpcs:enable } public function testCrossDomainMangling() { diff --git a/tests/phpunit/includes/api/format/ApiFormatXmlTest.php b/tests/phpunit/includes/api/format/ApiFormatXmlTest.php index 0f8c8ee6c1..915fb5c564 100644 --- a/tests/phpunit/includes/api/format/ApiFormatXmlTest.php +++ b/tests/phpunit/includes/api/format/ApiFormatXmlTest.php @@ -12,11 +12,11 @@ class ApiFormatXmlTest extends ApiFormatTestBase { public static function setUpBeforeClass() { parent::setUpBeforeClass(); $page = WikiPage::factory( Title::newFromText( 'MediaWiki:ApiFormatXmlTest.xsl' ) ); - // @codingStandardsIgnoreStart Generic.Files.LineLength + // phpcs:disable Generic.Files.LineLength $page->doEditContent( new WikitextContent( '' ), 'Summary' ); - // @codingStandardsIgnoreEnd + // phpcs:enable $page = WikiPage::factory( Title::newFromText( 'MediaWiki:ApiFormatXmlTest' ) ); $page->doEditContent( new WikitextContent( 'Bogus' ), 'Summary' ); $page = WikiPage::factory( Title::newFromText( 'ApiFormatXmlTest' ) ); @@ -24,7 +24,7 @@ class ApiFormatXmlTest extends ApiFormatTestBase { } public static function provideGeneralEncoding() { - // @codingStandardsIgnoreStart Generic.Files.LineLength + // phpcs:disable Generic.Files.LineLength return [ // Basic types [ [ null, 'a' => null ], '<_v _idx="0" />' ], @@ -117,7 +117,7 @@ class ApiFormatXmlTest extends ApiFormatTestBase { '" type="text/xsl" ?>', [ 'xslt' => 'MediaWiki:ApiFormatXmlTest.xsl' ] ], ]; - // @codingStandardsIgnoreEnd + // phpcs:enable } } diff --git a/tests/phpunit/includes/changes/ChangesListFilterGroupTest.php b/tests/phpunit/includes/changes/ChangesListFilterGroupTest.php index 465a9d11f0..6190516e68 100644 --- a/tests/phpunit/includes/changes/ChangesListFilterGroupTest.php +++ b/tests/phpunit/includes/changes/ChangesListFilterGroupTest.php @@ -4,12 +4,12 @@ * @covers ChangesListFilterGroup */ class ChangesListFilterGroupTest extends MediaWikiTestCase { - // @codingStandardsIgnoreStart /** + * phpcs:disable Generic.Files.LineLength * @expectedException MWException * @expectedExceptionMessage Group names may not contain '_'. Use the naming convention: 'camelCase' + * phpcs:enable */ - // @codingStandardsIgnoreEnd public function testReservedCharacter() { new MockChangesListFilterGroup( [ diff --git a/tests/phpunit/includes/changes/ChangesListFilterTest.php b/tests/phpunit/includes/changes/ChangesListFilterTest.php index 811c8c2b72..039658e2cf 100644 --- a/tests/phpunit/includes/changes/ChangesListFilterTest.php +++ b/tests/phpunit/includes/changes/ChangesListFilterTest.php @@ -25,12 +25,12 @@ class ChangesListFilterTest extends MediaWikiTestCase { ); } - // @codingStandardsIgnoreStart /** + * phpcs:disable Generic.Files.LineLength * @expectedException MWException * @expectedExceptionMessage Filter names may not contain '_'. Use the naming convention: 'lowercase' + * phpcs:enable */ - // @codingStandardsIgnoreEnd public function testReservedCharacter() { $filter = new MockChangesListFilter( [ @@ -41,12 +41,10 @@ class ChangesListFilterTest extends MediaWikiTestCase { ); } - // @codingStandardsIgnoreStart /** * @expectedException MWException * @expectedExceptionMessage Two filters in a group cannot have the same name: 'somename' */ - // @codingStandardsIgnoreEnd public function testDuplicateName() { new MockChangesListFilter( [ diff --git a/tests/phpunit/includes/content/CssContentHandlerTest.php b/tests/phpunit/includes/content/CssContentHandlerTest.php index d92fb8fc15..8f178de261 100644 --- a/tests/phpunit/includes/content/CssContentHandlerTest.php +++ b/tests/phpunit/includes/content/CssContentHandlerTest.php @@ -21,7 +21,7 @@ class CssContentHandlerTest extends MediaWikiLangTestCase { * Keep this in sync with CssContentTest::provideGetRedirectTarget() */ public static function provideMakeRedirectContent() { - // @codingStandardsIgnoreStart Generic.Files.LineLength + // phpcs:disable Generic.Files.LineLength return [ [ 'MediaWiki:MonoBook.css', @@ -36,6 +36,6 @@ class CssContentHandlerTest extends MediaWikiLangTestCase { "/* #REDIRECT */@import url(//example.org/w/index.php?title=Gadget:FooBaz.css&action=raw&ctype=text/css);" ], ]; - // @codingStandardsIgnoreEnd + // phpcs:enable } } diff --git a/tests/phpunit/includes/content/CssContentTest.php b/tests/phpunit/includes/content/CssContentTest.php index 1e82fdd4d3..f5cc05e0f9 100644 --- a/tests/phpunit/includes/content/CssContentTest.php +++ b/tests/phpunit/includes/content/CssContentTest.php @@ -101,7 +101,7 @@ class CssContentTest extends JavaScriptContentTest { * Keep this in sync with CssContentHandlerTest::provideMakeRedirectContent() */ public static function provideGetRedirectTarget() { - // @codingStandardsIgnoreStart Generic.Files.LineLength + // phpcs:disable Generic.Files.LineLength return [ [ 'MediaWiki:MonoBook.css', "/* #REDIRECT */@import url(//example.org/w/index.php?title=MediaWiki:MonoBook.css&action=raw&ctype=text/css);" ], [ 'User:FooBar/common.css', "/* #REDIRECT */@import url(//example.org/w/index.php?title=User:FooBar/common.css&action=raw&ctype=text/css);" ], @@ -111,7 +111,7 @@ class CssContentTest extends JavaScriptContentTest { # Wrong domain [ null, "/* #REDIRECT */@import url(//example.com/w/index.php?title=Gadget:FooBaz.css&action=raw&ctype=text/css);" ], ]; - // @codingStandardsIgnoreEnd + // phpcs:enable } public static function dataEquals() { diff --git a/tests/phpunit/includes/content/JavaScriptContentHandlerTest.php b/tests/phpunit/includes/content/JavaScriptContentHandlerTest.php index d229623980..080ec96558 100644 --- a/tests/phpunit/includes/content/JavaScriptContentHandlerTest.php +++ b/tests/phpunit/includes/content/JavaScriptContentHandlerTest.php @@ -21,7 +21,7 @@ class JavaScriptContentHandlerTest extends MediaWikiLangTestCase { * Keep this in sync with JavaScriptContentTest::provideGetRedirectTarget() */ public static function provideMakeRedirectContent() { - // @codingStandardsIgnoreStart Generic.Files.LineLength + // phpcs:disable Generic.Files.LineLength return [ [ 'MediaWiki:MonoBook.js', @@ -36,6 +36,6 @@ class JavaScriptContentHandlerTest extends MediaWikiLangTestCase { '/* #REDIRECT */mw.loader.load("//example.org/w/index.php?title=Gadget:FooBaz.js\u0026action=raw\u0026ctype=text/javascript");' ], ]; - // @codingStandardsIgnoreEnd + // phpcs:enable } } diff --git a/tests/phpunit/includes/content/JavaScriptContentTest.php b/tests/phpunit/includes/content/JavaScriptContentTest.php index 434e17cfb4..6656fa4d76 100644 --- a/tests/phpunit/includes/content/JavaScriptContentTest.php +++ b/tests/phpunit/includes/content/JavaScriptContentTest.php @@ -251,19 +251,18 @@ class JavaScriptContentTest extends TextContentTest { } public static function provideUpdateRedirect() { + // phpcs:disable Generic.Files.LineLength return [ [ '#REDIRECT [[Someplace]]', '#REDIRECT [[Someplace]]', ], - - // @codingStandardsIgnoreStart Generic.Files.LineLength [ '/* #REDIRECT */mw.loader.load("//example.org/w/index.php?title=MediaWiki:MonoBook.js\u0026action=raw\u0026ctype=text/javascript");', '/* #REDIRECT */mw.loader.load("//example.org/w/index.php?title=TestUpdateRedirect_target\u0026action=raw\u0026ctype=text/javascript");' ] - // @codingStandardsIgnoreEnd ]; + // phpcs:enable } /** @@ -313,7 +312,7 @@ class JavaScriptContentTest extends TextContentTest { * Keep this in sync with JavaScriptContentHandlerTest::provideMakeRedirectContent() */ public static function provideGetRedirectTarget() { - // @codingStandardsIgnoreStart Generic.Files.LineLength + // phpcs:disable Generic.Files.LineLength return [ [ 'MediaWiki:MonoBook.js', @@ -338,6 +337,6 @@ class JavaScriptContentTest extends TextContentTest { '/* #REDIRECT */mw.loader.load("//example.com/w/index.php?title=MediaWiki:OtherWiki.js\u0026action=raw\u0026ctype=text/javascript");' ], ]; - // @codingStandardsIgnoreEnd + // phpcs:enable } } diff --git a/tests/phpunit/includes/import/ImportTest.php b/tests/phpunit/includes/import/ImportTest.php index 347d0fc77b..7bb03db87e 100644 --- a/tests/phpunit/includes/import/ImportTest.php +++ b/tests/phpunit/includes/import/ImportTest.php @@ -37,7 +37,7 @@ class ImportTest extends MediaWikiLangTestCase { } public function getUnknownTagsXML() { - // @codingStandardsIgnoreStart Generic.Files.LineLength + // phpcs:disable Generic.Files.LineLength return [ [ <<< EOF @@ -71,7 +71,7 @@ EOF 'TestImportPage' ] ]; - // @codingStandardsIgnoreEnd + // phpcs:enable } /** @@ -102,7 +102,7 @@ EOF } public function getRedirectXML() { - // @codingStandardsIgnoreStart Generic.Files.LineLength + // phpcs:disable Generic.Files.LineLength return [ [ <<< EOF @@ -157,7 +157,7 @@ EOF null ], ]; - // @codingStandardsIgnoreEnd + // phpcs:enable } /** @@ -185,7 +185,7 @@ EOF } public function getSiteInfoXML() { - // @codingStandardsIgnoreStart Generic.Files.LineLength + // phpcs:disable Generic.Files.LineLength return [ [ <<< EOF @@ -217,7 +217,7 @@ EOF ] ], ]; - // @codingStandardsIgnoreEnd + // phpcs:enable } /** @@ -248,7 +248,7 @@ EOF $n = ( $assign ? 1 : 0 ) + ( $create ? 2 : 0 ); - // @codingStandardsIgnoreStart Generic.Files.LineLength + // phpcs:disable Generic.Files.LineLength $source = $this->getDataSource( << @@ -283,7 +283,7 @@ EOF EOF ); - // @codingStandardsIgnoreEnd + // phpcs:enable $importer = new WikiImporter( $source, MediaWikiServices::getInstance()->getMainConfig() ); $importer->setUsernamePrefix( 'Xxx', $assign ); diff --git a/tests/phpunit/includes/libs/CSSMinTest.php b/tests/phpunit/includes/libs/CSSMinTest.php index b06df97666..a6efc851ba 100644 --- a/tests/phpunit/includes/libs/CSSMinTest.php +++ b/tests/phpunit/includes/libs/CSSMinTest.php @@ -275,7 +275,7 @@ class CSSMinTest extends MediaWikiTestCase { . '%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%228%22 height=' . '%228%22%3E%0A%09%3Ccircle cx=%224%22 cy=%224%22 r=%222%22/%3E%0A%3C/svg%3E%0A'; - // @codingStandardsIgnoreStart Generic.Files.LineLength + // phpcs:disable Generic.Files.LineLength return [ [ 'Regular file', @@ -492,7 +492,7 @@ class CSSMinTest extends MediaWikiTestCase { '.ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default { border: 1px solid #d3d3d3/*{borderColorDefault}*/; background: #e6e6e6/*{bgColorDefault}*/ url(http://localhost/w/images/ui-bg_glass_75_e6e6e6_1x400.png)/*{bgImgUrlDefault}*/ 50%/*{bgDefaultXPos}*/ 50%/*{bgDefaultYPos}*/ repeat-x/*{bgDefaultRepeat}*/; font-weight: normal/*{fwDefault}*/; color: #555555/*{fcDefault}*/; }', ], ]; - // @codingStandardsIgnoreEnd + // phpcs:enable } /** diff --git a/tests/phpunit/includes/libs/XmlTypeCheckTest.php b/tests/phpunit/includes/libs/XmlTypeCheckTest.php index 97aeec39a4..8a11d874e2 100644 --- a/tests/phpunit/includes/libs/XmlTypeCheckTest.php +++ b/tests/phpunit/includes/libs/XmlTypeCheckTest.php @@ -11,9 +11,8 @@ class XmlTypeCheckTest extends PHPUnit_Framework_TestCase { const WELL_FORMED_XML = ""; const MAL_FORMED_XML = ""; - // @codingStandardsIgnoreStart Generic.Files.LineLength + // phpcs:ignore Generic.Files.LineLength const XML_WITH_PIH = ''; - // @codingStandardsIgnoreEnd /** * @covers XMLTypeCheck::newFromString diff --git a/tests/phpunit/includes/libs/rdbms/database/DatabaseSQLTest.php b/tests/phpunit/includes/libs/rdbms/database/DatabaseSQLTest.php index 10dbcceb35..23f7865058 100644 --- a/tests/phpunit/includes/libs/rdbms/database/DatabaseSQLTest.php +++ b/tests/phpunit/includes/libs/rdbms/database/DatabaseSQLTest.php @@ -846,8 +846,8 @@ class DatabaseSQLTest extends PHPUnit_Framework_TestCase { } public static function provideUnionConditionPermutations() { + // phpcs:disable Generic.Files.LineLength return [ - // @codingStandardsIgnoreStart Generic.Files.LineLength.TooLong [ [ 'table' => [ 'table1', 'table2' ], @@ -989,8 +989,8 @@ class DatabaseSQLTest extends PHPUnit_Framework_TestCase { ], "SELECT foo_id FROM foo WHERE baz IS NULL ORDER BY foo_id LIMIT 150,25" ], - // @codingStandardsIgnoreEnd ]; + // phpcs:enable } /** diff --git a/tests/phpunit/includes/media/ExifBitmapTest.php b/tests/phpunit/includes/media/ExifBitmapTest.php index 3dd7e4c6bd..eb02e7ed58 100644 --- a/tests/phpunit/includes/media/ExifBitmapTest.php +++ b/tests/phpunit/includes/media/ExifBitmapTest.php @@ -47,9 +47,8 @@ class ExifBitmapTest extends MediaWikiMediaTestCase { * @covers ExifBitmapHandler::isMetadataValid */ public function testGoodMetadata() { - // @codingStandardsIgnoreStart Ignore Generic.Files.LineLength.TooLong + // phpcs:ignore Generic.Files.LineLength $meta = 'a:16:{s:10:"ImageWidth";i:20;s:11:"ImageLength";i:20;s:13:"BitsPerSample";a:3:{i:0;i:8;i:1;i:8;i:2;i:8;}s:11:"Compression";i:5;s:25:"PhotometricInterpretation";i:2;s:16:"ImageDescription";s:17:"Created with GIMP";s:12:"StripOffsets";i:8;s:11:"Orientation";i:1;s:15:"SamplesPerPixel";i:3;s:12:"RowsPerStrip";i:64;s:15:"StripByteCounts";i:238;s:11:"XResolution";s:19:"1207959552/16777216";s:11:"YResolution";s:19:"1207959552/16777216";s:19:"PlanarConfiguration";i:1;s:14:"ResolutionUnit";i:2;s:22:"MEDIAWIKI_EXIF_VERSION";i:2;}'; - // @codingStandardsIgnoreEnd $res = $this->handler->isMetadataValid( null, $meta ); $this->assertEquals( ExifBitmapHandler::METADATA_GOOD, $res ); } @@ -58,9 +57,8 @@ class ExifBitmapTest extends MediaWikiMediaTestCase { * @covers ExifBitmapHandler::isMetadataValid */ public function testIsOldGood() { - // @codingStandardsIgnoreStart Ignore Generic.Files.LineLength.TooLong + // phpcs:ignore Generic.Files.LineLength $meta = 'a:16:{s:10:"ImageWidth";i:20;s:11:"ImageLength";i:20;s:13:"BitsPerSample";a:3:{i:0;i:8;i:1;i:8;i:2;i:8;}s:11:"Compression";i:5;s:25:"PhotometricInterpretation";i:2;s:16:"ImageDescription";s:17:"Created with GIMP";s:12:"StripOffsets";i:8;s:11:"Orientation";i:1;s:15:"SamplesPerPixel";i:3;s:12:"RowsPerStrip";i:64;s:15:"StripByteCounts";i:238;s:11:"XResolution";s:19:"1207959552/16777216";s:11:"YResolution";s:19:"1207959552/16777216";s:19:"PlanarConfiguration";i:1;s:14:"ResolutionUnit";i:2;s:22:"MEDIAWIKI_EXIF_VERSION";i:1;}'; - // @codingStandardsIgnoreEnd $res = $this->handler->isMetadataValid( null, $meta ); $this->assertEquals( ExifBitmapHandler::METADATA_COMPATIBLE, $res ); } @@ -70,9 +68,8 @@ class ExifBitmapTest extends MediaWikiMediaTestCase { * @covers ExifBitmapHandler::isMetadataValid */ public function testPagedTiffHandledGracefully() { - // @codingStandardsIgnoreStart Ignore Generic.Files.LineLength.TooLong + // phpcs:ignore Generic.Files.LineLength $meta = 'a:6:{s:9:"page_data";a:1:{i:1;a:5:{s:5:"width";i:643;s:6:"height";i:448;s:5:"alpha";s:4:"true";s:4:"page";i:1;s:6:"pixels";i:288064;}}s:10:"page_count";i:1;s:10:"first_page";i:1;s:9:"last_page";i:1;s:4:"exif";a:9:{s:10:"ImageWidth";i:643;s:11:"ImageLength";i:448;s:11:"Compression";i:5;s:25:"PhotometricInterpretation";i:2;s:11:"Orientation";i:1;s:15:"SamplesPerPixel";i:4;s:12:"RowsPerStrip";i:50;s:19:"PlanarConfiguration";i:1;s:22:"MEDIAWIKI_EXIF_VERSION";i:1;}s:21:"TIFF_METADATA_VERSION";s:3:"1.4";}'; - // @codingStandardsIgnoreEnd $res = $this->handler->isMetadataValid( null, $meta ); $this->assertEquals( ExifBitmapHandler::METADATA_BAD, $res ); } diff --git a/tests/phpunit/includes/media/GIFTest.php b/tests/phpunit/includes/media/GIFTest.php index 7cd9caf52f..4dd7443e48 100644 --- a/tests/phpunit/includes/media/GIFTest.php +++ b/tests/phpunit/includes/media/GIFTest.php @@ -72,18 +72,18 @@ class GIFHandlerTest extends MediaWikiMediaTestCase { } public static function provideIsMetadataValid() { + // phpcs:disable Generic.Files.LineLength return [ [ GIFHandler::BROKEN_FILE, GIFHandler::METADATA_GOOD ], [ '', GIFHandler::METADATA_BAD ], [ null, GIFHandler::METADATA_BAD ], [ 'Something invalid!', GIFHandler::METADATA_BAD ], - // @codingStandardsIgnoreStart Ignore Generic.Files.LineLength.TooLong [ 'a:4:{s:10:"frameCount";i:1;s:6:"looped";b:0;s:8:"duration";d:0.1000000000000000055511151231257827021181583404541015625;s:8:"metadata";a:2:{s:14:"GIFFileComment";a:1:{i:0;s:35:"GIF test file ⁕ Created with GIMP";}s:15:"_MW_GIF_VERSION";i:1;}}', GIFHandler::METADATA_GOOD ], - // @codingStandardsIgnoreEnd ]; + // phpcs:enable } /** @@ -99,8 +99,8 @@ class GIFHandlerTest extends MediaWikiMediaTestCase { } public static function provideGetMetadata() { + // phpcs:disable Generic.Files.LineLength return [ - // @codingStandardsIgnoreStart Ignore Generic.Files.LineLength.TooLong [ 'nonanimated.gif', 'a:4:{s:10:"frameCount";i:1;s:6:"looped";b:0;s:8:"duration";d:0.1000000000000000055511151231257827021181583404541015625;s:8:"metadata";a:2:{s:14:"GIFFileComment";a:1:{i:0;s:35:"GIF test file ⁕ Created with GIMP";}s:15:"_MW_GIF_VERSION";i:1;}}' @@ -109,8 +109,8 @@ class GIFHandlerTest extends MediaWikiMediaTestCase { 'animated-xmp.gif', 'a:4:{s:10:"frameCount";i:4;s:6:"looped";b:1;s:8:"duration";d:2.399999999999999911182158029987476766109466552734375;s:8:"metadata";a:5:{s:6:"Artist";s:7:"Bawolff";s:16:"ImageDescription";a:2:{s:9:"x-default";s:18:"A file to test GIF";s:5:"_type";s:4:"lang";}s:15:"SublocationDest";s:13:"The interwebs";s:14:"GIFFileComment";a:1:{i:0;s:16:"GIƒ·test·file";}s:15:"_MW_GIF_VERSION";i:1;}}' ], - // @codingStandardsIgnoreEnd ]; + // phpcs:enable } /** diff --git a/tests/phpunit/includes/media/JpegTest.php b/tests/phpunit/includes/media/JpegTest.php index abe028088a..13de7ff943 100644 --- a/tests/phpunit/includes/media/JpegTest.php +++ b/tests/phpunit/includes/media/JpegTest.php @@ -24,9 +24,8 @@ class JpegTest extends MediaWikiMediaTestCase { public function testJpegMetadataExtraction() { $file = $this->dataFile( 'test.jpg', 'image/jpeg' ); $res = $this->handler->getMetadata( $file, $this->filePath . 'test.jpg' ); - // @codingStandardsIgnoreStart Ignore Generic.Files.LineLength.TooLong + // phpcs:ignore Generic.Files.LineLength $expected = 'a:7:{s:16:"ImageDescription";s:9:"Test file";s:11:"XResolution";s:4:"72/1";s:11:"YResolution";s:4:"72/1";s:14:"ResolutionUnit";i:2;s:16:"YCbCrPositioning";i:1;s:15:"JPEGFileComment";a:1:{i:0;s:17:"Created with GIMP";}s:22:"MEDIAWIKI_EXIF_VERSION";i:2;}'; - // @codingStandardsIgnoreEnd // Unserialize in case serialization format ever changes. $this->assertEquals( unserialize( $expected ), unserialize( $res ) ); diff --git a/tests/phpunit/includes/media/PNGTest.php b/tests/phpunit/includes/media/PNGTest.php index 4933f32567..5a66586e25 100644 --- a/tests/phpunit/includes/media/PNGTest.php +++ b/tests/phpunit/includes/media/PNGTest.php @@ -73,18 +73,18 @@ class PNGHandlerTest extends MediaWikiMediaTestCase { } public static function provideIsMetadataValid() { + // phpcs:disable Generic.Files.LineLength return [ [ PNGHandler::BROKEN_FILE, PNGHandler::METADATA_GOOD ], [ '', PNGHandler::METADATA_BAD ], [ null, PNGHandler::METADATA_BAD ], [ 'Something invalid!', PNGHandler::METADATA_BAD ], - // @codingStandardsIgnoreStart Ignore Generic.Files.LineLength.TooLong [ 'a:6:{s:10:"frameCount";i:0;s:9:"loopCount";i:1;s:8:"duration";d:0;s:8:"bitDepth";i:8;s:9:"colorType";s:10:"truecolour";s:8:"metadata";a:1:{s:15:"_MW_PNG_VERSION";i:1;}}', PNGHandler::METADATA_GOOD ], - // @codingStandardsIgnoreEnd ]; + // phpcs:enable } /** @@ -101,8 +101,8 @@ class PNGHandlerTest extends MediaWikiMediaTestCase { } public static function provideGetMetadata() { + // phpcs:disable Generic.Files.LineLength return [ - // @codingStandardsIgnoreStart Ignore Generic.Files.LineLength.TooLong [ 'rgb-na-png.png', 'a:6:{s:10:"frameCount";i:0;s:9:"loopCount";i:1;s:8:"duration";d:0;s:8:"bitDepth";i:8;s:9:"colorType";s:10:"truecolour";s:8:"metadata";a:1:{s:15:"_MW_PNG_VERSION";i:1;}}' @@ -111,8 +111,8 @@ class PNGHandlerTest extends MediaWikiMediaTestCase { 'xmp.png', 'a:6:{s:10:"frameCount";i:0;s:9:"loopCount";i:1;s:8:"duration";d:0;s:8:"bitDepth";i:1;s:9:"colorType";s:14:"index-coloured";s:8:"metadata";a:2:{s:12:"SerialNumber";s:9:"123456789";s:15:"_MW_PNG_VERSION";i:1;}}' ], - // @codingStandardsIgnoreEnd ]; + // phpcs:enable } /** diff --git a/tests/phpunit/includes/media/SVGMetadataExtractorTest.php b/tests/phpunit/includes/media/SVGMetadataExtractorTest.php index 9bfd5f6196..6fbb47401b 100644 --- a/tests/phpunit/includes/media/SVGMetadataExtractorTest.php +++ b/tests/phpunit/includes/media/SVGMetadataExtractorTest.php @@ -128,14 +128,14 @@ class SVGMetadataExtractorTest extends MediaWikiTestCase { public static function provideSvgFilesWithXMLMetadata() { $base = __DIR__ . '/../../data/media'; - // @codingStandardsIgnoreStart Ignore Generic.Files.LineLength.TooLong + // phpcs:disable Generic.Files.LineLength $metadata = ' image/svg+xml '; - // @codingStandardsIgnoreEnd + // phpcs:enable $metadata = str_replace( "\r", '', $metadata ); // Windows compat return [ diff --git a/tests/phpunit/includes/media/TiffTest.php b/tests/phpunit/includes/media/TiffTest.php index d1148202c3..8a69ec5b3a 100644 --- a/tests/phpunit/includes/media/TiffTest.php +++ b/tests/phpunit/includes/media/TiffTest.php @@ -34,9 +34,8 @@ class TiffTest extends MediaWikiTestCase { public function testTiffMetadataExtraction() { $res = $this->handler->getMetadata( null, $this->filePath . 'test.tiff' ); - // @codingStandardsIgnoreStart Ignore Generic.Files.LineLength.TooLong + // phpcs:ignore Generic.Files.LineLength $expected = 'a:16:{s:10:"ImageWidth";i:20;s:11:"ImageLength";i:20;s:13:"BitsPerSample";a:3:{i:0;i:8;i:1;i:8;i:2;i:8;}s:11:"Compression";i:5;s:25:"PhotometricInterpretation";i:2;s:16:"ImageDescription";s:17:"Created with GIMP";s:12:"StripOffsets";i:8;s:11:"Orientation";i:1;s:15:"SamplesPerPixel";i:3;s:12:"RowsPerStrip";i:64;s:15:"StripByteCounts";i:238;s:11:"XResolution";s:19:"1207959552/16777216";s:11:"YResolution";s:19:"1207959552/16777216";s:19:"PlanarConfiguration";i:1;s:14:"ResolutionUnit";i:2;s:22:"MEDIAWIKI_EXIF_VERSION";i:2;}'; - // @codingStandardsIgnoreEnd // Re-unserialize in case there are subtle differences between how versions // of php serialize stuff. diff --git a/tests/phpunit/includes/media/WebPTest.php b/tests/phpunit/includes/media/WebPTest.php index ea06bbb4e0..a0a99cc222 100644 --- a/tests/phpunit/includes/media/WebPTest.php +++ b/tests/phpunit/includes/media/WebPTest.php @@ -23,7 +23,7 @@ class WebPHandlerTest extends MediaWikiTestCase { $this->assertEquals( $expectedResult, WebPHandler::extractMetadata( $this->tempFileName ) ); } public function provideTestExtractMetaData() { - // @codingStandardsIgnoreStart Generic.Files.LineLength + // phpcs:disable Generic.Files.LineLength return [ // Files from https://developers.google.com/speed/webp/gallery2 [ "\x52\x49\x46\x46\x90\x68\x01\x00\x57\x45\x42\x50\x56\x50\x38\x4C\x83\x68\x01\x00\x2F\x8F\x01\x4B\x10\x8D\x38\x6C\xDB\x46\x92\xE0\xE0\x82\x7B\x6C", @@ -71,7 +71,7 @@ class WebPHandlerTest extends MediaWikiTestCase { [ 'RIFF1234WEBPVP8 ', false ], [ 'RIFF1234WEBPVP8L ', false ], ]; - // @codingStandardsIgnoreEnd + // phpcs:enable } /** diff --git a/tests/phpunit/includes/page/WikiPageDbTestBase.php b/tests/phpunit/includes/page/WikiPageDbTestBase.php index 2b803aec15..8e5b1831f4 100644 --- a/tests/phpunit/includes/page/WikiPageDbTestBase.php +++ b/tests/phpunit/includes/page/WikiPageDbTestBase.php @@ -1423,7 +1423,7 @@ more stuff } public function provideTestInsertProtectNullRevision() { - // @codingStandardsIgnoreStart Generic.Files.LineLength + // phpcs:disable Generic.Files.LineLength yield [ 'goat-message-key', [ 'edit' => 'sysop' ], @@ -1442,7 +1442,7 @@ more stuff true, '(goat-key: WikiPageDbTestBase::testInsertProtectNullRevision, UTSysop)(colon-separator)Goat Goat(word-separator)(parentheses: (protect-summary-desc: (restriction-edit), (protect-level-sysop), (protect-expiring: 04:04, 1 (january) 2020, 1 (january) 2020, 04:04))(word-separator)(protect-summary-desc: (restriction-move), (protect-level-something), (protect-expiring: 05:05, 1 (january) 2021, 1 (january) 2021, 05:05)))' ]; - // @codingStandardsIgnoreEnd Generic.Files.LineLength + // phpcs:enable } /** diff --git a/tests/phpunit/includes/parser/ParserOutputTest.php b/tests/phpunit/includes/parser/ParserOutputTest.php index 441d60df7b..9642bbc0fb 100644 --- a/tests/phpunit/includes/parser/ParserOutputTest.php +++ b/tests/phpunit/includes/parser/ParserOutputTest.php @@ -123,7 +123,7 @@ class ParserOutputTest extends MediaWikiTestCase { } public static function provideGetText() { - // @codingStandardsIgnoreStart Generic.Files.LineLength + // phpcs:disable Generic.Files.LineLength $text = <<Test document.

@@ -315,7 +315,7 @@ EOF EOF ], ]; - // @codingStandardsIgnoreEnd + // phpcs:enable } } diff --git a/tests/phpunit/includes/parser/PreprocessorTest.php b/tests/phpunit/includes/parser/PreprocessorTest.php index 11a21976db..ab138996a2 100644 --- a/tests/phpunit/includes/parser/PreprocessorTest.php +++ b/tests/phpunit/includes/parser/PreprocessorTest.php @@ -68,7 +68,7 @@ class PreprocessorTest extends MediaWikiTestCase { } public static function provideCases() { - // @codingStandardsIgnoreStart Ignore Generic.Files.LineLength.TooLong + // phpcs:disable Generic.Files.LineLength return self::addClassArg( [ [ "Foo", "Foo" ], [ "", "<!-- Foo -->" ], @@ -156,7 +156,7 @@ class PreprocessorTest extends MediaWikiTestCase { [ "{{Foo|} Bar=}}", "" ], /* [ file_get_contents( __DIR__ . '/QuoteQuran.txt' ], file_get_contents( __DIR__ . '/QuoteQuranExpanded.txt' ) ], */ ] ); - // @codingStandardsIgnoreEnd + // phpcs:enable } /** @@ -208,7 +208,7 @@ class PreprocessorTest extends MediaWikiTestCase { * These are more complex test cases taken out of wiki articles. */ public static function provideFiles() { - // @codingStandardsIgnoreStart Ignore Generic.Files.LineLength.TooLong + // phpcs:disable Generic.Files.LineLength return self::addClassArg( [ [ "QuoteQuran" ], # https://en.wikipedia.org/w/index.php?title=Template:QuoteQuran/sandbox&oldid=237348988 GFDL + CC BY-SA by Striver [ "Factorial" ], # https://en.wikipedia.org/w/index.php?title=Template:Factorial&oldid=98548758 GFDL + CC BY-SA by Polonium @@ -216,7 +216,7 @@ class PreprocessorTest extends MediaWikiTestCase { [ "Fundraising" ], # https://tl.wiktionary.org/w/index.php?title=MediaWiki:Sitenotice&oldid=5716 GFDL + CC BY-SA, copied there by Sky Harbor. [ "NestedTemplates" ], # T29936 ] ); - // @codingStandardsIgnoreEnd + // phpcs:enable } /** @@ -242,7 +242,7 @@ class PreprocessorTest extends MediaWikiTestCase { * Tests from T30642 · https://phabricator.wikimedia.org/T30642 */ public static function provideHeadings() { - // @codingStandardsIgnoreStart Ignore Generic.Files.LineLength.TooLong + // phpcs:disable Generic.Files.LineLength return self::addClassArg( [ /* These should become headings: */ [ "== h ==", "== h ==<!--c1-->" ], @@ -281,7 +281,7 @@ class PreprocessorTest extends MediaWikiTestCase { [ "== h == x ", "== h ==<!--c1--> x <!--c2--><!--c3--> " ], [ "== h == x ", "== h ==<!--c1--><!--c2--><!--c3--> x " ], ] ); - // @codingStandardsIgnoreEnd + // phpcs:enable } /** diff --git a/tests/phpunit/includes/password/BcryptPasswordTest.php b/tests/phpunit/includes/password/BcryptPasswordTest.php index 9b8e01e772..167341036d 100644 --- a/tests/phpunit/includes/password/BcryptPasswordTest.php +++ b/tests/phpunit/includes/password/BcryptPasswordTest.php @@ -16,7 +16,7 @@ class BcryptPasswordTest extends PasswordTestCase { } public static function providePasswordTests() { - // @codingStandardsIgnoreStart Generic.Files.LineLength + // phpcs:disable Generic.Files.LineLength return [ // Tests from glibc bcrypt implementation [ true, ':bcrypt:5$CCCCCCCCCCCCCCCCCCCCC.$E5YPO9kmyuRGyh0XouQYb4YMJKvyOeW', "U*U" ], @@ -39,6 +39,6 @@ class BcryptPasswordTest extends PasswordTestCase { [ false, ':bcrypt:5$CCCCCCCCCCCCCCCCCCCCC.$E5YPO9kmyuRGyh0XouQYb4YMJKvyOeW', "UXU" ], [ false, ':bcrypt:5$CCCCCCCCCCCCCCCCCCCCC.$E5YPO9kmyuRGyh0XouQYb4YMJKvyOeW', "" ], ]; - // @codingStandardsIgnoreEnd + // phpcs:enable } } diff --git a/tests/phpunit/includes/password/EncryptedPasswordTest.php b/tests/phpunit/includes/password/EncryptedPasswordTest.php index 0c8565372a..7ed971100c 100644 --- a/tests/phpunit/includes/password/EncryptedPasswordTest.php +++ b/tests/phpunit/includes/password/EncryptedPasswordTest.php @@ -4,7 +4,6 @@ * @covers EncryptedPassword * @covers ParameterizedPassword * @covers Password - * @codingStandardsIgnoreStart Generic.Files.LineLength */ class EncryptedPasswordTest extends PasswordTestCase { protected function getTypeConfigs() { @@ -44,6 +43,7 @@ class EncryptedPasswordTest extends PasswordTestCase { } public static function providePasswordTests() { + // phpcs:disable Generic.Files.LineLength return [ // Encrypted with secret1 [ true, ':both:aes-256-cbc:0:izBpxujqC1YbzpCB3qAzgg==:ZqHnitT1pL4YJqKqFES2KEevZYSy2LtlibW5+IMi4XKOGKGy6sE638BXyBbLQQsBtTSrt+JyzwOayKtwIfRbaQsBridx/O1JwBSai1TkGkOsYMBXnlu2Bu/EquCBj5QpjYh7p3Uq4rpiop1KQlin1BJMwnAa1PovhxjpxnYhlhkM4X5ALoGi3XM0bapN48vt', 'password' ], @@ -54,6 +54,7 @@ class EncryptedPasswordTest extends PasswordTestCase { [ true, ':both:aes-256-cbc:1:m1LCnQVIakfYBNlr9KEgQg==:5yPTctqrzsybdgaMEag18AZYbnL37pAtXVBqmWxkjXbnNmiDH+1bHoL8lsEVTH/sJntC82kNVgE7zeiD8xUVLYF2VUnvB5+sU+aysE45/zwsCu7a22TaischMAOWrsHZ/tIgS/TnZY2d+HNyxgsEeeYf/QoL+FhmqHquK02+4SRbA5lLuj9niYy1r5CoM9cQ', 'password' ], [ true, ':secret2:aes-256-cbc:0:m1LCnQVIakfYBNlr9KEgQg==:5yPTctqrzsybdgaMEag18AZYbnL37pAtXVBqmWxkjXbnNmiDH+1bHoL8lsEVTH/sJntC82kNVgE7zeiD8xUVLYF2VUnvB5+sU+aysE45/zwsCu7a22TaischMAOWrsHZ/tIgS/TnZY2d+HNyxgsEeeYf/QoL+FhmqHquK02+4SRbA5lLuj9niYy1r5CoM9cQ', 'password' ], ]; + // phpcs:enable } /** @@ -61,12 +62,14 @@ class EncryptedPasswordTest extends PasswordTestCase { * @expectedException PasswordError */ public function testDecryptionError() { + // phpcs:ignore Generic.Files.LineLength $hash = ':secret1:aes-256-cbc:0:m1LCnQVIakfYBNlr9KEgQg==:5yPTctqrzsybdgaMEag18AZYbnL37pAtXVBqmWxkjXbnNmiDH+1bHoL8lsEVTH/sJntC82kNVgE7zeiD8xUVLYF2VUnvB5+sU+aysE45/zwsCu7a22TaischMAOWrsHZ/tIgS/TnZY2d+HNyxgsEeeYf/QoL+FhmqHquK02+4SRbA5lLuj9niYy1r5CoM9cQ'; $password = $this->passwordFactory->newFromCiphertext( $hash ); $password->crypt( 'password' ); } public function testUpdate() { + // phpcs:ignore Generic.Files.LineLength $hash = ':both:aes-256-cbc:0:izBpxujqC1YbzpCB3qAzgg==:ZqHnitT1pL4YJqKqFES2KEevZYSy2LtlibW5+IMi4XKOGKGy6sE638BXyBbLQQsBtTSrt+JyzwOayKtwIfRbaQsBridx/O1JwBSai1TkGkOsYMBXnlu2Bu/EquCBj5QpjYh7p3Uq4rpiop1KQlin1BJMwnAa1PovhxjpxnYhlhkM4X5ALoGi3XM0bapN48vt'; $fromHash = $this->passwordFactory->newFromCiphertext( $hash ); $fromPlaintext = $this->passwordFactory->newFromPlaintext( 'password', $fromHash ); diff --git a/tests/phpunit/includes/password/LayeredParameterizedPasswordTest.php b/tests/phpunit/includes/password/LayeredParameterizedPasswordTest.php index cf96d0673c..cee4fbb083 100644 --- a/tests/phpunit/includes/password/LayeredParameterizedPasswordTest.php +++ b/tests/phpunit/includes/password/LayeredParameterizedPasswordTest.php @@ -35,15 +35,15 @@ class LayeredParameterizedPasswordTest extends PasswordTestCase { } public static function providePasswordTests() { - // @codingStandardsIgnoreStart Generic.Files.LineLength.TooLong + // phpcs:disable Generic.Files.LineLength return [ [ true, ':testLargeLayeredTop:sha512:1024:512!sha512:1024:512!sha512:1024:512!sha512:1024:512!5!vnRy+2SrSA0fHt3dwhTP5g==!AVnwfZsAQjn+gULv7FSGjA==!xvHUX3WcpkeSn1lvjWcvBg==!It+OC/N9tu+d3ByHhuB0BQ==!Tb.gqUOiD.aWktVwHM.Q/O!7CcyMfXUPky5ptyATJsR2nq3vUqtnBC', - 'testPassword123' + 'testPassword123' ], ]; - // @codingStandardsIgnoreEnd + // phpcs:enable } /** diff --git a/tests/phpunit/includes/resourceloader/ResourceLoaderClientHtmlTest.php b/tests/phpunit/includes/resourceloader/ResourceLoaderClientHtmlTest.php index 49aeb3061d..c83f5004db 100644 --- a/tests/phpunit/includes/resourceloader/ResourceLoaderClientHtmlTest.php +++ b/tests/phpunit/includes/resourceloader/ResourceLoaderClientHtmlTest.php @@ -207,7 +207,7 @@ class ResourceLoaderClientHtmlTest extends PHPUnit_Framework_TestCase { 'test.exempt' => 'ready', ] ); - // @codingStandardsIgnoreStart Generic.Files.LineLength + // phpcs:disable Generic.Files.LineLength $expected = '' . "\n" . ''; - // @codingStandardsIgnoreEnd + // phpcs:enable $expected = self::expandVariables( $expected ); $this->assertEquals( $expected, $client->getHeadHtml() ); @@ -250,8 +250,8 @@ class ResourceLoaderClientHtmlTest extends PHPUnit_Framework_TestCase { } public static function provideMakeLoad() { + // phpcs:disable Generic.Files.LineLength return [ - // @codingStandardsIgnoreStart Generic.Files.LineLength [ 'context' => [], 'modules' => [ 'test.unknown' ], @@ -349,8 +349,8 @@ class ResourceLoaderClientHtmlTest extends PHPUnit_Framework_TestCase { . '' . "\n" . '' ], - // @codingStandardsIgnoreEnd ]; + // phpcs:enable } /** diff --git a/tests/phpunit/includes/resourceloader/ResourceLoaderSkinModuleTest.php b/tests/phpunit/includes/resourceloader/ResourceLoaderSkinModuleTest.php index 6b0095c731..0718af6d8e 100644 --- a/tests/phpunit/includes/resourceloader/ResourceLoaderSkinModuleTest.php +++ b/tests/phpunit/includes/resourceloader/ResourceLoaderSkinModuleTest.php @@ -7,8 +7,8 @@ class ResourceLoaderSkinModuleTest extends PHPUnit_Framework_TestCase { use MediaWikiCoversValidator; - // @codingStandardsIgnoreStart Ignore Generic.Files.LineLength.TooLong public static function provideGetStyles() { + // phpcs:disable Generic.Files.LineLength return [ [ 'parent' => [], @@ -66,8 +66,8 @@ CSS ], ], ]; + // phpcs:enable } - // @codingStandardsIgnoreEnd /** * @dataProvider provideGetStyles diff --git a/tests/phpunit/includes/shell/FirejailCommandTest.php b/tests/phpunit/includes/shell/FirejailCommandTest.php index 02e6e791b0..15853753c1 100644 --- a/tests/phpunit/includes/shell/FirejailCommandTest.php +++ b/tests/phpunit/includes/shell/FirejailCommandTest.php @@ -29,9 +29,8 @@ class FirejailCommandTest extends PHPUnit_Framework_TestCase { public function provideBuildFinalCommand() { global $IP; - // @codingStandardsIgnoreStart + // phpcs:ignore Generic.Files.LineLength $env = "'MW_INCLUDE_STDERR=;MW_CPU_LIMIT=180; MW_CGROUP='\'''\''; MW_MEM_LIMIT=307200; MW_FILE_SIZE_LIMIT=102400; MW_WALL_CLOCK_LIMIT=180; MW_USE_LOG_PIPE=yes'"; - // @codingStandardsIgnoreEnd $limit = "/bin/bash '$IP/includes/shell/limit.sh'"; $profile = "--profile=$IP/includes/shell/firejail.profile"; $blacklist = '--blacklist=' . realpath( MW_CONFIG_FILE ); diff --git a/tests/phpunit/includes/site/DBSiteStoreTest.php b/tests/phpunit/includes/site/DBSiteStoreTest.php index 32dd7f282c..ae85f8a1a2 100644 --- a/tests/phpunit/includes/site/DBSiteStoreTest.php +++ b/tests/phpunit/includes/site/DBSiteStoreTest.php @@ -90,13 +90,13 @@ class DBSiteStoreTest extends MediaWikiTestCase { $site = $store->getSite( 'ertrywuutr' ); $this->assertInstanceOf( 'Site', $site ); $this->assertEquals( 'en', $site->getLanguageCode() ); - $this->assertTrue( is_integer( $site->getInternalId() ) ); + $this->assertTrue( is_int( $site->getInternalId() ) ); $this->assertTrue( $site->getInternalId() >= 0 ); $site = $store->getSite( 'sdfhxujgkfpth' ); $this->assertInstanceOf( 'Site', $site ); $this->assertEquals( 'nl', $site->getLanguageCode() ); - $this->assertTrue( is_integer( $site->getInternalId() ) ); + $this->assertTrue( is_int( $site->getInternalId() ) ); $this->assertTrue( $site->getInternalId() >= 0 ); } diff --git a/tests/phpunit/includes/site/SiteListTest.php b/tests/phpunit/includes/site/SiteListTest.php index f7d011715c..a4a171c941 100644 --- a/tests/phpunit/includes/site/SiteListTest.php +++ b/tests/phpunit/includes/site/SiteListTest.php @@ -99,7 +99,7 @@ class SiteListTest extends MediaWikiTestCase { * @var Site $site */ foreach ( $sites as $site ) { - if ( is_integer( $site->getInternalId() ) ) { + if ( is_int( $site->getInternalId() ) ) { $this->assertEquals( $site, $sites->getSiteByInternalId( $site->getInternalId() ) ); } } @@ -155,7 +155,7 @@ class SiteListTest extends MediaWikiTestCase { * @var Site $site */ foreach ( $sites as $site ) { - if ( is_integer( $site->getInternalId() ) ) { + if ( is_int( $site->getInternalId() ) ) { $this->assertTrue( $site, $sites->hasInternalId( $site->getInternalId() ) ); } } diff --git a/tests/phpunit/includes/tidy/RemexDriverTest.php b/tests/phpunit/includes/tidy/RemexDriverTest.php index f980af0090..b20557f2a8 100644 --- a/tests/phpunit/includes/tidy/RemexDriverTest.php +++ b/tests/phpunit/includes/tidy/RemexDriverTest.php @@ -200,14 +200,14 @@ class RemexDriverTest extends MediaWikiTestCase { 'a
d
e
', '

a

d

e

' ], + // phpcs:disable Generic.Files.LineLength [ 'Complex pwrap test 6', 'a
b
cd
e
f
g
', - // @codingStandardsIgnoreStart Generic.Files.LineLength.TooLong // PHP 5 does not allow concatenation in initialisation of a class static variable '

a

b

cd

e

fg

' - // @codingStandardsIgnoreEnd ], + // phpcs:enable /* FIXME the second causes a stack split which clones the even * though no

is actually generated [ diff --git a/tests/phpunit/includes/upload/UploadBaseTest.php b/tests/phpunit/includes/upload/UploadBaseTest.php index bc7493d5a9..3541091a68 100644 --- a/tests/phpunit/includes/upload/UploadBaseTest.php +++ b/tests/phpunit/includes/upload/UploadBaseTest.php @@ -138,7 +138,7 @@ class UploadBaseTest extends MediaWikiTestCase { } public static function provideCheckSvgScriptCallback() { - // @codingStandardsIgnoreStart Generic.Files.LineLength + // phpcs:disable Generic.Files.LineLength return [ // html5sec SVG vectors [ @@ -511,7 +511,7 @@ class UploadBaseTest extends MediaWikiTestCase { 'DTD with aliased entities apos (Should be allowed)' ] ]; - // @codingStandardsIgnoreEnd + // phpcs:enable } /** diff --git a/tests/phpunit/includes/utils/MWCryptHKDFTest.php b/tests/phpunit/includes/utils/MWCryptHKDFTest.php index ac638c6a40..c9c1345ca3 100644 --- a/tests/phpunit/includes/utils/MWCryptHKDFTest.php +++ b/tests/phpunit/includes/utils/MWCryptHKDFTest.php @@ -44,7 +44,7 @@ class MWCryptHKDFTest extends MediaWikiTestCase { * Test vectors from Appendix A on https://tools.ietf.org/html/rfc5869 */ public static function providerRfc5869() { - // @codingStandardsIgnoreStart Generic.Files.LineLength + // phpcs:disable Generic.Files.LineLength return [ // A.1 [ @@ -97,6 +97,6 @@ class MWCryptHKDFTest extends MediaWikiTestCase { '0bd770a74d1160f7c9f12cd5912a06ebff6adcae899d92191fe4305673ba2ffe8fa3f1a4e5ad79f3f334b3b202b2173c486ea37ce3d397ed034c7f9dfeb15c5e927336d0441f4c4300e2cff0d0900b52d3b4' // okm ], ]; - // @codingStandardsIgnoreEnd + // phpcs:enable } } diff --git a/tests/phpunit/includes/utils/MWCryptHashTest.php b/tests/phpunit/includes/utils/MWCryptHashTest.php index 13151abd6d..f6503ef9ab 100644 --- a/tests/phpunit/includes/utils/MWCryptHashTest.php +++ b/tests/phpunit/includes/utils/MWCryptHashTest.php @@ -23,9 +23,8 @@ class MWCryptHashTest extends PHPUnit_Framework_TestCase { } $data = 'foobar'; - // @codingStandardsIgnoreStart Generic.Files.LineLength + // phpcs:ignore Generic.Files.LineLength $hash = '9923afaec3a86f865bb231a588f453f84e8151a2deb4109aebc6de4284be5bebcff4fab82a7e51d920237340a043736e9d13bab196006dcca0fe65314d68eab9'; - // @codingStandardsIgnoreEnd $this->assertEquals( hex2bin( $hash ), @@ -46,9 +45,8 @@ class MWCryptHashTest extends PHPUnit_Framework_TestCase { $data = 'foobar'; $key = 'secret'; - // @codingStandardsIgnoreStart Generic.Files.LineLength + // phpcs:ignore Generic.Files.LineLength $hash = 'ddc94177b2020e55ce2049199fd9cc6327f416ff6dc621cc34cb43d9bec61d73372b4790c0e24957f565ecaf2d42821e6303619093e99cbe14a3b9250bda5f81'; - // @codingStandardsIgnoreEnd $this->assertEquals( hex2bin( $hash ), diff --git a/tests/phpunit/languages/LanguageTest.php b/tests/phpunit/languages/LanguageTest.php index 0c341303f7..5cb560299f 100644 --- a/tests/phpunit/languages/LanguageTest.php +++ b/tests/phpunit/languages/LanguageTest.php @@ -1326,7 +1326,7 @@ class LanguageTest extends LanguageClassesTestCase { } public static function provideCheckTitleEncodingData() { - // @codingStandardsIgnoreStart Ignore Generic.Files.LineLength.TooLong + // phpcs:disable Generic.Files.LineLength return [ [ "" ], [ "United States of America" ], // 7bit ASCII @@ -1377,7 +1377,7 @@ class LanguageTest extends LanguageClassesTestCase { ) ] ]; - // @codingStandardsIgnoreEnd + // phpcs:enable } /** diff --git a/tests/phpunit/languages/classes/LanguageBe_taraskTest.php b/tests/phpunit/languages/classes/LanguageBe_taraskTest.php index de684359fa..4f049cd154 100644 --- a/tests/phpunit/languages/classes/LanguageBe_taraskTest.php +++ b/tests/phpunit/languages/classes/LanguageBe_taraskTest.php @@ -1,11 +1,11 @@ getNewTempFile(); // The header of every prefetch file - // @codingStandardsIgnoreStart Ignore Generic.Files.LineLength.TooLong + // phpcs:ignore Generic.Files.LineLength $header = ' wikisvn @@ -180,7 +180,6 @@ class BaseDumpTest extends MediaWikiTestCase { '; - // @codingStandardsIgnoreEnd // An array holding the pages that are available for prefetch $available_pages = []; -- 2.20.1