Skip to content

Commit 452584c

Browse files
✨ Throw error instead of warning
1 parent c8eb69a commit 452584c

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

SymfonyCustom/Sniffs/Formatting/StrictComparisonSniff.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
use PHP_CodeSniffer\Sniffs\Sniff;
77

88
/**
9-
* Throws warning if == or != are use
9+
* Throws error if == or != are use
1010
*/
1111
class StrictComparisonSniff implements Sniff
1212
{
@@ -36,9 +36,9 @@ public function process(File $phpcsFile, $stackPtr): void
3636
{
3737
$tokens = $phpcsFile->getTokens();
3838

39-
// This warning is fixable, but it's too dangerous to add automatically fixer
40-
$phpcsFile->addWarning(
41-
'The %s comparator is not recommended, use %s instead',
39+
// This error is fixable, but it's too dangerous to add automatically fixer
40+
$phpcsFile->addError(
41+
'The %s comparator is forbidden, use %s instead',
4242
$stackPtr,
4343
'NotStrict',
4444
[

SymfonyCustom/ruleset.xml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,19 +69,23 @@
6969

7070
<!-- Disallow -->
7171
<rule ref="Generic.Arrays.DisallowLongArraySyntax"/>
72-
<rule ref="Generic.CodeAnalysis.AssignmentInCondition"/>
73-
<rule ref="Generic.CodeAnalysis.EmptyPHPStatement"/>
72+
<rule ref="Generic.CodeAnalysis.AssignmentInCondition">
73+
<type>error</type>
74+
</rule>
75+
<rule ref="Generic.CodeAnalysis.EmptyPHPStatement">
76+
<type>error</type>
77+
</rule>
7478
<rule ref="Generic.CodeAnalysis.EmptyStatement"/>
75-
<rule ref="Generic.CodeAnalysis.UselessOverridingMethod"/>
7679
<rule ref="Generic.PHP.BacktickOperator"/>
7780
<rule ref="Generic.PHP.DisallowShortOpenTag"/>
7881
<rule ref="Generic.PHP.ForbiddenFunctions"/>
7982
<rule ref="PEAR.Commenting.InlineComment"/>
80-
<rule ref="Squiz.PHP.CommentedOutCode"/>
8183
<rule ref="Squiz.PHP.DisallowMultipleAssignments"/>
8284
<rule ref="Squiz.PHP.DiscouragedFunctions"/>
8385
<rule ref="Squiz.PHP.Eval"/>
84-
<rule ref="Squiz.PHP.NonExecutableCode"/>
86+
<rule ref="Squiz.PHP.NonExecutableCode">
87+
<type>error</type>
88+
</rule>
8589
<rule ref="Squiz.Operators.ValidLogicalOperators"/>
8690

8791
<!-- Others -->

0 commit comments

Comments
 (0)