File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed
rules/DeadCode/Rector/Assign Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change 2525use Rector \NodeManipulator \StmtsManipulator ;
2626use Rector \Php \ReservedKeywordAnalyzer ;
2727use Rector \PhpParser \Node \BetterNodeFinder ;
28+ use Rector \PhpParser \NodeGroups ;
2829use Rector \Rector \AbstractRector ;
2930use Symplify \RuleDocGenerator \ValueObject \CodeSample \CodeSample ;
3031use Symplify \RuleDocGenerator \ValueObject \RuleDefinition ;
32+ use Webmozart \Assert \Assert ;
3133
3234/**
3335 * @see \Rector\Tests\DeadCode\Rector\Assign\RemoveUnusedVariableAssignRector\RemoveUnusedVariableAssignRectorTest
@@ -164,10 +166,12 @@ private function shouldSkip(array $stmts): bool
164166 */
165167 private function collectAssignRefVariableNames (Stmt $ stmt , array &$ refVariableNames ): void
166168 {
167- if (! $ stmt instanceof StmtsAwareInterface ) {
169+ if (! NodeGroups:: matchesStmtsAware ( $ stmt) ) {
168170 return ;
169171 }
170172
173+ Assert::propertyExists ($ stmt , 'stmts ' );
174+
171175 $ this ->traverseNodesWithCallable (
172176 $ stmt ,
173177 function (Node $ subNode ) use (&$ refVariableNames ): Node {
You can’t perform that action at this time.
0 commit comments