Skip to content

Commit 4db9d02

Browse files
committed
Modernize: Squiz/NonExecutableCode: use class constant for constant array
1 parent 7436e45 commit 4db9d02

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/Standards/Squiz/Sniffs/PHP/NonExecutableCodeSniff.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ class NonExecutableCodeSniff implements Sniff
2525
* `throw` can be used as an expression since PHP 8.0.
2626
* {@link https://wiki.php.net/rfc/throw_expression}
2727
*
28-
* @var array
28+
* @var array<int, int>
2929
*/
30-
private $expressionTokens = [
30+
private const EXPRESSION_TOKENS = [
3131
T_EXIT => T_EXIT,
3232
T_THROW => T_THROW,
3333
];
@@ -68,7 +68,7 @@ public function process(File $phpcsFile, $stackPtr)
6868
$prev = $phpcsFile->findPrevious(Tokens::EMPTY_TOKENS, ($stackPtr - 1), null, true);
6969

7070
// Tokens which can be used in inline expressions need special handling.
71-
if (isset($this->expressionTokens[$tokens[$stackPtr]['code']]) === true) {
71+
if (isset(self::EXPRESSION_TOKENS[$tokens[$stackPtr]['code']]) === true) {
7272
// If this token is preceded by a logical operator, it only relates to one line
7373
// and should be ignored. For example: fopen() or die().
7474
// Note: There is one exception: throw expressions can not be used with xor.

0 commit comments

Comments
 (0)