From 24ae4318b36f88f2dd43db5989074b65776e2cf8 Mon Sep 17 00:00:00 2001 From: Kunal Mehta Date: Sun, 8 Apr 2018 12:39:46 -0700 Subject: [PATCH] Don't use `phpcs:ignoreFile` to selectively ignore sniffs Because it doesn't work. `phpcs:ignoreFile` is intended as a performance shortcut, and gives up on the file as soon as that token is found. Instead, use `phpcs:disable` which does support selectively disabling some sniffs. And since disabling is local to the file, there's no need to re-enable it at the bottom of the file. has some relevant discussion and clarification from upstream on this. And make the files that are now being re-enabled pass PHPCS. Change-Id: Ia4d8c45045f61cf9f24eb1d8631ff98d99c82d69 --- autoload.php | 2 +- includes/PHPVersionCheck.php | 10 +++++----- includes/utils/AutoloadGenerator.php | 2 +- mw-config/index.php | 3 +-- 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/autoload.php b/autoload.php index b4596c40a8..4076620f30 100644 --- a/autoload.php +++ b/autoload.php @@ -1,6 +1,6 @@ upgrading your copy of {$phpInfo['implementation']}. @@ -139,7 +139,7 @@ class PHPVersionCheck { See ourcompatibility page for details of which versions are compatible with prior versions of {$phpInfo['implementation']}. HTML; - // phpcs:enable + // phpcs:enable Generic.Files.LineLength $this->triggerError( "Supported {$phpInfo['implementation']} versions", $shortText, @@ -164,14 +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 + // phpcs:disable Generic.Files.LineLength $longHtml = <<mediawiki.org for help on installing the required components. HTML; - // phpcs:enable + // phpcs:enable Generic.Files.LineLength $this->triggerError( 'External dependencies', $shortText, $longText, $longHtml ); } diff --git a/includes/utils/AutoloadGenerator.php b/includes/utils/AutoloadGenerator.php index a6783b0071..0e2ef85dfa 100644 --- a/includes/utils/AutoloadGenerator.php +++ b/includes/utils/AutoloadGenerator.php @@ -239,7 +239,7 @@ class AutoloadGenerator { return <<variableName}; \${$this->variableName} {$op} [ diff --git a/mw-config/index.php b/mw-config/index.php index 72cf65464b..a47822bb81 100644 --- a/mw-config/index.php +++ b/mw-config/index.php @@ -1,5 +1,5 @@ execute( $session ); $_SESSION['installData'][$fingerprint] = $session; - } -- 2.20.1