Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
wata727 committed Jun 27, 2018
1 parent 957a2b6 commit 9b2aac5
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/Reporter.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ class Reporter
*/
public $totalFixed = 0;

public $deprecatedWarnings = [];

/**
* When the PHPCS run started.
*
Expand Down Expand Up @@ -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,
Expand Down
6 changes: 6 additions & 0 deletions src/Reports/Full.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
1 change: 1 addition & 0 deletions src/Reports/Report.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ public function generate(
$totalErrors,
$totalWarnings,
$totalFixable,
$deprecatedWarnings,
$showSources=false,
$width=80,
$interactive=false,
Expand Down
10 changes: 10 additions & 0 deletions src/Ruleset.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ class Ruleset
*/
public $ruleset = [];

public $deprecatedWarnings = [];

/**
* The directories that the processed rulesets are in.
*
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down
1 change: 1 addition & 0 deletions src/Runner.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 9b2aac5

Please sign in to comment.