Skip to content

Commit 17e120f

Browse files
removing array_key_exists from for loop to avoid ignoring phpcs
1 parent 59b5d46 commit 17e120f

File tree

1 file changed

+1
-9
lines changed

1 file changed

+1
-9
lines changed

Magento2/Sniffs/Annotation/MethodArgumentsSniff.php

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -668,15 +668,7 @@ private function checkIfNamespaceContainsApi(File $phpcsFile) : bool
668668
return false;
669669
}
670670
$tokens = $phpcsFile->getTokens();
671-
// phpcs:ignore Squiz.ControlStructures.ForLoopDeclaration.SpacingAfterOpen,Generic.CodeAnalysis.ForLoopWithTestFunctionCall.NotAllowed
672-
for (
673-
// phpcs:ignore Squiz.ControlStructures.ForLoopDeclaration.SpacingAfterFirst
674-
$index = $namespaceStackPtr;
675-
// phpcs:ignore Squiz.ControlStructures.ForLoopDeclaration.SpacingAfterSecond
676-
array_key_exists($index, $tokens) && 'T_SEMICOLON' !== $tokens[$index]['type'];
677-
$index++
678-
// phpcs:ignore Squiz.ControlStructures.ForLoopDeclaration.SpacingBeforeClose
679-
) {
671+
for ($index = $namespaceStackPtr; 'T_SEMICOLON' !== ($tokens[$index]['type'] ?? 'T_SEMICOLON'); $index++) {
680672
if ('T_STRING' === $tokens[$index]['type'] && 'Api' === $tokens[$index]['content']) {
681673
return true;
682674
}

0 commit comments

Comments
 (0)