diff --git a/SymfonyCustom/Sniffs/Formatting/StrictComparisonSniff.php b/SymfonyCustom/Sniffs/Formatting/StrictComparisonSniff.php index 46e90a8..aed93ed 100644 --- a/SymfonyCustom/Sniffs/Formatting/StrictComparisonSniff.php +++ b/SymfonyCustom/Sniffs/Formatting/StrictComparisonSniff.php @@ -6,7 +6,7 @@ use PHP_CodeSniffer\Sniffs\Sniff; /** - * Throws warning if == or != are use + * Throws error if == or != are use */ class StrictComparisonSniff implements Sniff { @@ -36,9 +36,9 @@ public function process(File $phpcsFile, $stackPtr): void { $tokens = $phpcsFile->getTokens(); - // This warning is fixable, but it's too dangerous to add automatically fixer - $phpcsFile->addWarning( - 'The %s comparator is not recommended, use %s instead', + // This error is fixable, but it's too dangerous to add automatically fixer + $phpcsFile->addError( + 'The %s comparator is forbidden, use %s instead', $stackPtr, 'NotStrict', [ diff --git a/SymfonyCustom/Tests/Formatting/StrictComparisonUnitTest.php b/SymfonyCustom/Tests/Formatting/StrictComparisonUnitTest.php index ac89e2c..826b13b 100644 --- a/SymfonyCustom/Tests/Formatting/StrictComparisonUnitTest.php +++ b/SymfonyCustom/Tests/Formatting/StrictComparisonUnitTest.php @@ -16,7 +16,10 @@ class StrictComparisonUnitTest extends AbstractSniffUnitTest */ protected function getErrorList(): array { - return []; + return [ + 3 => 1, + 5 => 1, + ]; } /** @@ -24,9 +27,6 @@ protected function getErrorList(): array */ protected function getWarningList(): array { - return [ - 3 => 1, - 5 => 1, - ]; + return []; } } diff --git a/SymfonyCustom/ruleset.xml b/SymfonyCustom/ruleset.xml index 84fe6b3..28c09ed 100755 --- a/SymfonyCustom/ruleset.xml +++ b/SymfonyCustom/ruleset.xml @@ -69,19 +69,23 @@ - - + + error + + + error + - - - + + error +