diff --git a/src/Reporter.php b/src/Reporter.php index 4667a76a90..434f12299a 100644 --- a/src/Reporter.php +++ b/src/Reporter.php @@ -60,6 +60,8 @@ class Reporter */ public $totalFixed = 0; + public $deprecatedWarnings = []; + /** * When the PHPCS run started. * @@ -226,6 +228,7 @@ public function printReport($report) $this->totalErrors, $this->totalWarnings, $this->totalFixable, + $this->deprecatedWarnings, $this->config->showSources, $this->config->reportWidth, $this->config->interactive, diff --git a/src/Reports/Full.php b/src/Reports/Full.php index 10bbbe9d79..0db5e0985f 100644 --- a/src/Reports/Full.php +++ b/src/Reports/Full.php @@ -197,11 +197,17 @@ public function generate( $totalErrors, $totalWarnings, $totalFixable, + $deprecatedWarnings, $showSources=false, $width=80, $interactive=false, $toScreen=true ) { + foreach ($deprecatedWarnings as $warning) { + echo "WARNING: ".$warning; + } + echo PHP_EOL; + if ($cachedData === '') { return; } diff --git a/src/Reports/Report.php b/src/Reports/Report.php index 38f8a6298c..3cc637e4d8 100644 --- a/src/Reports/Report.php +++ b/src/Reports/Report.php @@ -54,6 +54,7 @@ public function generate( $totalErrors, $totalWarnings, $totalFixable, + $deprecatedWarnings, $showSources=false, $width=80, $interactive=false, diff --git a/src/Ruleset.php b/src/Ruleset.php index 79c21e747e..848357184a 100644 --- a/src/Ruleset.php +++ b/src/Ruleset.php @@ -101,6 +101,8 @@ class Ruleset */ public $ruleset = []; + public $deprecatedWarnings = []; + /** * The directories that the processed rulesets are in. * @@ -845,6 +847,8 @@ private function processRule($rule, $newSniffs, $depth=0) $ref = (string) $rule['ref']; $todo = [$ref]; + $this->checkDeprecatedSniffs($ref); + $parts = explode('.', $ref); if (count($parts) <= 2) { // We are processing a standard or a category of sniffs. @@ -1058,6 +1062,12 @@ private function processRule($rule, $newSniffs, $depth=0) }//end processRule() + private function checkDeprecatedSniffs($ref) + { + if ($ref == "Squiz.WhiteSpace.LanguageConstructSpacing") { + $this->deprecatedWarnings[] = "Squiz.WhiteSpace.LanguageConstructSpacing Sniff is deprecated and will be removed in 4.0. Please use Generic.WhiteSpace.LanguageConstructSpacing instead."; + } + } /** * Determine if an element should be processed or ignored. diff --git a/src/Runner.php b/src/Runner.php index d762ebbb58..027f5c466a 100644 --- a/src/Runner.php +++ b/src/Runner.php @@ -310,6 +310,7 @@ private function run() { // The class that manages all reporters for the run. $this->reporter = new Reporter($this->config); + $this->reporter->deprecatedWarnings = $this->ruleset->deprecatedWarnings; // Include bootstrap files. foreach ($this->config->bootstrap as $bootstrap) {