@@ -19,9 +19,9 @@ class ComparisonOperatorUsageSniff implements Sniff
19
19
/**
20
20
* A list of valid comparison operators.
21
21
*
22
- * @var array
22
+ * @var array<int|string, true>
23
23
*/
24
- private static $ validOps = [
24
+ private const VALID_OPERATIONS = [
25
25
T_IS_IDENTICAL => true ,
26
26
T_IS_NOT_IDENTICAL => true ,
27
27
T_LESS_THAN => true ,
@@ -36,7 +36,7 @@ class ComparisonOperatorUsageSniff implements Sniff
36
36
*
37
37
* @var array<int|string, string>
38
38
*/
39
- private static $ invalidOps = [
39
+ private const INVALID_OPERATIONS = [
40
40
T_IS_EQUAL => '=== ' ,
41
41
T_IS_NOT_EQUAL => '!== ' ,
42
42
T_BOOLEAN_NOT => '=== FALSE ' ,
@@ -149,15 +149,15 @@ public function process(File $phpcsFile, $stackPtr)
149
149
150
150
for ($ i = $ start ; $ i <= $ end ; $ i ++) {
151
151
$ type = $ tokens [$ i ]['code ' ];
152
- if (isset (self ::$ invalidOps [$ type ]) === true ) {
152
+ if (isset (self ::INVALID_OPERATIONS [$ type ]) === true ) {
153
153
$ error = 'Operator %s prohibited; use %s instead ' ;
154
154
$ data = [
155
155
$ tokens [$ i ]['content ' ],
156
- self ::$ invalidOps [$ type ],
156
+ self ::INVALID_OPERATIONS [$ type ],
157
157
];
158
158
$ phpcsFile ->addError ($ error , $ i , 'NotAllowed ' , $ data );
159
159
$ foundOps ++;
160
- } else if (isset (self ::$ validOps [$ type ]) === true ) {
160
+ } else if (isset (self ::VALID_OPERATIONS [$ type ]) === true ) {
161
161
$ foundOps ++;
162
162
}
163
163
0 commit comments