Skip to content

Commit e67db7d

Browse files
committed
Cleanup
1 parent b29a52e commit e67db7d

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

SlevomatCodingStandard/Sniffs/Classes/UnusedPrivateElementsSniff.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,8 @@ public function process(\PHP_CodeSniffer_File $phpcsFile, $classPointer)
132132
return $propertyNameTokenPointer + 1;
133133
};
134134

135-
while (($propertyAccessTokenPointer = TokenHelper::findNext($phpcsFile, [T_VARIABLE, T_SELF, T_STATIC, T_DOUBLE_QUOTED_STRING], $findUsagesStartTokenPointer, $classToken['scope_closer'])) !== null) {
136-
$propertyAccessToken = $tokens[$propertyAccessTokenPointer];
135+
while (($tokenPointer = TokenHelper::findNext($phpcsFile, [T_VARIABLE, T_SELF, T_STATIC, T_DOUBLE_QUOTED_STRING], $findUsagesStartTokenPointer, $classToken['scope_closer'])) !== null) {
136+
$propertyAccessToken = $tokens[$tokenPointer];
137137
if ($propertyAccessToken['code'] === T_DOUBLE_QUOTED_STRING) {
138138
if (preg_match_all('~(?<!\\\\)\$this->(.+?\b)(?!\()~', $propertyAccessToken['content'], $matches, PREG_PATTERN_ORDER)) {
139139
foreach ($matches[1] as $propertyInString) {
@@ -150,11 +150,11 @@ public function process(\PHP_CodeSniffer_File $phpcsFile, $classPointer)
150150
}
151151
}
152152

153-
$findUsagesStartTokenPointer = $propertyAccessTokenPointer + 1;
153+
$findUsagesStartTokenPointer = $tokenPointer + 1;
154154
} elseif ($propertyAccessToken['content'] === '$this') {
155-
$findUsagesStartTokenPointer = $checkVariable($propertyAccessTokenPointer);
155+
$findUsagesStartTokenPointer = $checkVariable($tokenPointer);
156156
} elseif (in_array($propertyAccessToken['code'], [T_SELF, T_STATIC], true)) {
157-
$newTokenPointer = TokenHelper::findPreviousEffective($phpcsFile, $propertyAccessTokenPointer - 1);
157+
$newTokenPointer = TokenHelper::findPreviousEffective($phpcsFile, $tokenPointer - 1);
158158
if ($tokens[$newTokenPointer]['code'] === T_NEW) {
159159
$variableTokenPointer = TokenHelper::findPreviousLocal($phpcsFile, T_VARIABLE, $newTokenPointer - 1);
160160
$scopeMethodPointer = TokenHelper::findPrevious($phpcsFile, T_FUNCTION, $variableTokenPointer - 1);
@@ -164,7 +164,7 @@ public function process(\PHP_CodeSniffer_File $phpcsFile, $classPointer)
164164
}
165165
}
166166
} else {
167-
$doubleColonTokenPointer = TokenHelper::findNextEffective($phpcsFile, $propertyAccessTokenPointer + 1);
167+
$doubleColonTokenPointer = TokenHelper::findNextEffective($phpcsFile, $tokenPointer + 1);
168168
$doubleColonToken = $tokens[$doubleColonTokenPointer];
169169
if ($doubleColonToken['code'] !== T_DOUBLE_COLON) {
170170
// self or static not followed by ::
@@ -201,7 +201,7 @@ public function process(\PHP_CodeSniffer_File $phpcsFile, $classPointer)
201201
$findUsagesStartTokenPointer = $methodCallTokenPointer + 1;
202202
}
203203
} else {
204-
$findUsagesStartTokenPointer = $propertyAccessTokenPointer + 1;
204+
$findUsagesStartTokenPointer = $tokenPointer + 1;
205205
}
206206

207207
if (count($reportedProperties) + count($reportedMethods) + count($reportedConstants) === 0) {

0 commit comments

Comments
 (0)