Skip to content

Commit 753855a

Browse files
committed
Implement use of the new Collections::$ternaryOperators() token array
1 parent 5a60a37 commit 753855a

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

PHPCSUtils/AbstractSniffs/AbstractArrayDeclarationSniff.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,6 @@ abstract class AbstractArrayDeclarationSniff implements Sniff
118118
\T_DNUMBER => \T_DNUMBER,
119119
\T_CONSTANT_ENCAPSED_STRING => \T_CONSTANT_ENCAPSED_STRING,
120120
\T_STRING_CONCAT => \T_STRING_CONCAT,
121-
\T_INLINE_THEN => \T_INLINE_THEN,
122-
\T_INLINE_ELSE => \T_INLINE_ELSE,
123121
\T_BOOLEAN_NOT => \T_BOOLEAN_NOT,
124122
];
125123

@@ -143,6 +141,7 @@ final public function __construct()
143141
$this->acceptedTokens += Tokens::$castTokens;
144142
$this->acceptedTokens += Tokens::$bracketTokens;
145143
$this->acceptedTokens += Tokens::$heredocTokens;
144+
$this->acceptedTokens += Collections::ternaryOperators();
146145
}
147146

148147
/**

PHPCSUtils/Utils/Operators.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,6 @@ final class Operators
5252
\T_OPEN_SHORT_ARRAY => true,
5353
\T_OPEN_CURLY_BRACKET => true,
5454
\T_COLON => true,
55-
\T_INLINE_THEN => true,
56-
\T_INLINE_ELSE => true,
5755
\T_CASE => true,
5856
\T_FN_ARROW => true,
5957
\T_MATCH_ARROW => true,
@@ -206,6 +204,7 @@ public static function isUnaryPlusMinus(File $phpcsFile, $stackPtr)
206204
|| isset(Tokens::$booleanOperators[$tokens[$prev]['code']]) === true
207205
|| isset(Tokens::$assignmentTokens[$tokens[$prev]['code']]) === true
208206
|| isset(Tokens::$castTokens[$tokens[$prev]['code']]) === true
207+
|| isset(Collections::ternaryOperators()[$tokens[$prev]['code']]) === true
209208
|| isset(self::$extraUnaryIndicators[$tokens[$prev]['code']]) === true
210209
) {
211210
return true;

0 commit comments

Comments
 (0)