Skip to content

Commit 5347b53

Browse files
✨ Update sniff used
1 parent d12c2a5 commit 5347b53

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

SymfonyCustom/Sniffs/Namespaces/UnusedUseSniff.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,8 @@ public function process(File $phpcsFile, $stackPtr): void
8888

8989
$skip = Tokens::$emptyTokens + [T_COMMA => T_COMMA];
9090

91-
while ($classPtr = $phpcsFile->findPrevious($skip, $to - 1, $from + 1, true)) {
91+
$classPtr = $phpcsFile->findPrevious($skip, $to - 1, $from + 1, true);
92+
while ($classPtr) {
9293
$to = $phpcsFile->findPrevious(T_COMMA, $classPtr - 1, $from + 1);
9394

9495
if (!$this->isClassUsed($phpcsFile, $stackPtr, $classPtr)) {
@@ -120,6 +121,8 @@ public function process(File $phpcsFile, $stackPtr): void
120121
if (false === $to) {
121122
break;
122123
}
124+
125+
$classPtr = $phpcsFile->findPrevious($skip, $to - 1, $from + 1, true);
123126
}
124127

125128
return;
@@ -166,7 +169,9 @@ public function process(File $phpcsFile, $stackPtr): void
166169
if (T_SEMICOLON === $tokens[$semiColon]['code']) {
167170
break;
168171
}
169-
} while ($semiColon = $phpcsFile->findEndOfStatement($semiColon + 1));
172+
173+
$semiColon = $phpcsFile->findEndOfStatement($semiColon + 1);
174+
} while ($semiColon);
170175
}
171176

172177
/**

SymfonyCustom/ruleset.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@
6969

7070
<!-- Disallow -->
7171
<rule ref="Generic.Arrays.DisallowLongArraySyntax"/>
72+
<rule ref="Generic.CodeAnalysis.AssignmentInCondition"/>
7273
<rule ref="Generic.CodeAnalysis.EmptyPHPStatement"/>
7374
<rule ref="Generic.CodeAnalysis.EmptyStatement"/>
7475
<rule ref="Generic.CodeAnalysis.UselessOverridingMethod"/>
@@ -78,7 +79,6 @@
7879
<rule ref="PEAR.Commenting.InlineComment"/>
7980
<rule ref="Squiz.PHP.CommentedOutCode"/>
8081
<rule ref="Squiz.PHP.DisallowMultipleAssignments"/>
81-
<rule ref="Squiz.PHP.DisallowSizeFunctionsInLoops"/>
8282
<rule ref="Squiz.PHP.DiscouragedFunctions"/>
8383
<rule ref="Squiz.PHP.Eval"/>
8484
<rule ref="Squiz.PHP.NonExecutableCode"/>

TwigCS/Token/TokenParser.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,8 @@ public function getTag(): string
8484
private function hasBody(TokenStream $stream): bool
8585
{
8686
$look = 0;
87-
while ($token = $stream->look($look)) {
87+
$token = $stream->look($look);
88+
while ($token) {
8889
if ($token->getType() === Token::EOF_TYPE) {
8990
return false;
9091
}
@@ -96,6 +97,7 @@ private function hasBody(TokenStream $stream): bool
9697
}
9798

9899
$look++;
100+
$token = $stream->look($look);
99101
}
100102

101103
return false;

0 commit comments

Comments
 (0)