Skip to content

Commit af7af18

Browse files
rodrigoprimojrfnl
authored andcommitted
Generic/CallTimePassByReference: remove unreachable condition
Removes a condition that checks if `nested_parenthesis` property of the variable or short syntax array is not set. As far as I can check, this condition can never be true. A few lines above, we are already checking for the presence of opening and closing parentheses and the while loop is limited to T_VARIABLE and T_OPEN_SHORT_ARRAY inside the parentheses. Since it is limited to tokens inside the parentheses, `nested_parenthesis` will always be set. The removed check was added in this commit that added defensive code to protect against syntax errors to a few sniffs: 0e42098
1 parent 295b113 commit af7af18

File tree

1 file changed

+0
-4
lines changed

1 file changed

+0
-4
lines changed

src/Standards/Generic/Sniffs/Functions/CallTimePassByReferenceSniff.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,6 @@ public function process(File $phpcsFile, $stackPtr)
8686
];
8787

8888
while (($nextSeparator = $phpcsFile->findNext($find, ($nextSeparator + 1), $closeBracket)) !== false) {
89-
if (isset($tokens[$nextSeparator]['nested_parenthesis']) === false) {
90-
continue;
91-
}
92-
9389
if ($tokens[$nextSeparator]['code'] === T_OPEN_SHORT_ARRAY) {
9490
$nextSeparator = $tokens[$nextSeparator]['bracket_closer'];
9591
continue;

0 commit comments

Comments
 (0)