@@ -20,9 +20,9 @@ class LowerCaseTypeSniff implements Sniff
20
20
/**
21
21
* Native types supported by PHP.
22
22
*
23
- * @var array
23
+ * @var array<string, true>
24
24
*/
25
- private $ phpTypes = [
25
+ private const PHP_TYPES = [
26
26
'self ' => true ,
27
27
'parent ' => true ,
28
28
'array ' => true ,
@@ -146,7 +146,7 @@ public function process(File $phpcsFile, $stackPtr)
146
146
);
147
147
} else {
148
148
$ type = $ tokens [$ startOfType ]['content ' ];
149
- if (isset ($ this -> phpTypes [strtolower ($ type )]) === true ) {
149
+ if (isset (self :: PHP_TYPES [strtolower ($ type )]) === true ) {
150
150
$ this ->processType ($ phpcsFile , $ startOfType , $ type , $ error , $ errorCode );
151
151
}
152
152
}
@@ -182,7 +182,7 @@ public function process(File $phpcsFile, $stackPtr)
182
182
$ error ,
183
183
$ errorCode
184
184
);
185
- } else if (isset ($ this -> phpTypes [strtolower ($ type )]) === true ) {
185
+ } else if (isset (self :: PHP_TYPES [strtolower ($ type )]) === true ) {
186
186
$ this ->processType ($ phpcsFile , $ props ['type_token ' ], $ type , $ error , $ errorCode );
187
187
}
188
188
}
@@ -213,7 +213,7 @@ public function process(File $phpcsFile, $stackPtr)
213
213
$ error ,
214
214
$ errorCode
215
215
);
216
- } else if (isset ($ this -> phpTypes [strtolower ($ returnType )]) === true ) {
216
+ } else if (isset (self :: PHP_TYPES [strtolower ($ returnType )]) === true ) {
217
217
$ this ->processType ($ phpcsFile , $ props ['return_type_token ' ], $ returnType , $ error , $ errorCode );
218
218
}
219
219
}
@@ -244,7 +244,7 @@ public function process(File $phpcsFile, $stackPtr)
244
244
$ error ,
245
245
$ errorCode
246
246
);
247
- } else if (isset ($ this -> phpTypes [strtolower ($ typeHint )]) === true ) {
247
+ } else if (isset (self :: PHP_TYPES [strtolower ($ typeHint )]) === true ) {
248
248
$ this ->processType ($ phpcsFile , $ param ['type_hint_token ' ], $ typeHint , $ error , $ errorCode );
249
249
}
250
250
}
@@ -285,7 +285,7 @@ protected function processUnionType(File $phpcsFile, $typeDeclStart, $typeDeclEn
285
285
) {
286
286
if ($ typeTokenCount === 1
287
287
&& $ type !== ''
288
- && isset ($ this -> phpTypes [strtolower ($ type )]) === true
288
+ && isset (self :: PHP_TYPES [strtolower ($ type )]) === true
289
289
) {
290
290
$ this ->processType ($ phpcsFile , $ typeStart , $ type , $ error , $ errorCode );
291
291
}
@@ -309,7 +309,7 @@ protected function processUnionType(File $phpcsFile, $typeDeclStart, $typeDeclEn
309
309
// Handle type at end of type string.
310
310
if ($ typeTokenCount === 1
311
311
&& $ type !== ''
312
- && isset ($ this -> phpTypes [strtolower ($ type )]) === true
312
+ && isset (self :: PHP_TYPES [strtolower ($ type )]) === true
313
313
) {
314
314
$ this ->processType ($ phpcsFile , $ typeStart , $ type , $ error , $ errorCode );
315
315
}
0 commit comments