Skip to content

Commit 3a3d1e7

Browse files
kukulichondrejmirtes
authored andcommitted
UnusedPrivateElementsSniff sometimes stopped prematurely after checking properties with multiple modifiers
1 parent 702b989 commit 3a3d1e7

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

SlevomatCodingStandard/Sniffs/Classes/UnusedPrivateElementsSniff.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -200,11 +200,9 @@ private function getProperties(PHP_CodeSniffer_File $phpcsFile, array $tokens, a
200200
while (($propertyTokenPointer = $phpcsFile->findNext(T_VARIABLE, $findPropertiesStartTokenPointer, $classToken['scope_closer'])) !== false) {
201201
$visibilityModifiedTokenPointer = TokenHelper::findPreviousNonWhitespace($phpcsFile, $propertyTokenPointer - 1);
202202
$visibilityModifiedToken = $tokens[$visibilityModifiedTokenPointer];
203-
if (in_array($visibilityModifiedToken['code'], [T_PUBLIC, T_PROTECTED], true)) {
203+
if ($visibilityModifiedToken['code'] !== T_PRIVATE) {
204204
$findPropertiesStartTokenPointer = $propertyTokenPointer + 1;
205205
continue;
206-
} elseif ($visibilityModifiedToken['code'] !== T_PRIVATE) {
207-
break;
208206
}
209207

210208
$findPropertiesStartTokenPointer = $propertyTokenPointer + 1;

0 commit comments

Comments
 (0)