Skip to content

Commit d8bc393

Browse files
committed
Use a copy of the sub-array to get the last parenthesis opener as well
1 parent ac43668 commit d8bc393

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/Standards/Squiz/Sniffs/Arrays/ArrayDeclarationSniff.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,7 @@ public function process(File $phpcsFile, $stackPtr)
5252
) {
5353
$nestedParens = $tokens[$stackPtr]['nested_parenthesis'];
5454
$lastParenthesisCloser = end($nestedParens);
55-
$lastParenthesisOpener = key($tokens[$stackPtr]['nested_parenthesis']);
56-
reset($tokens[$stackPtr]['nested_parenthesis']);
55+
$lastParenthesisOpener = key($nestedParens);
5756

5857
if (isset($tokens[$lastParenthesisCloser]['parenthesis_owner']) === true
5958
&& $tokens[$tokens[$lastParenthesisCloser]['parenthesis_owner']]['code'] === T_FOREACH

0 commit comments

Comments
 (0)