-
-
Notifications
You must be signed in to change notification settings - Fork 699
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updated Rector to commit 99b6d309220f3cdda9f49cf8bf6bc21863b03c26
rectorphp/rector-src@99b6d30 [NodeTypeResolver] Re-index node attributes on refresh scope process (#6601)
- Loading branch information
1 parent
3c22658
commit 2715075
Showing
12 changed files
with
78 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<?php | ||
|
||
declare (strict_types=1); | ||
namespace Rector\PHPStan\NodeVisitor; | ||
|
||
use PhpParser\Node; | ||
use PhpParser\Node\Expr\CallLike; | ||
use PhpParser\Node\Expr\Closure; | ||
use PhpParser\Node\Expr\FuncCall; | ||
use PhpParser\Node\Expr\MethodCall; | ||
use PhpParser\Node\Expr\New_; | ||
use PhpParser\Node\Expr\NullsafeMethodCall; | ||
use PhpParser\Node\Expr\StaticCall; | ||
use PhpParser\Node\FunctionLike; | ||
use PhpParser\Node\MatchArm; | ||
use PhpParser\Node\Stmt\ClassMethod; | ||
use PhpParser\Node\Stmt\Function_; | ||
use PhpParser\Node\Stmt\If_; | ||
use PhpParser\Node\Stmt\Switch_; | ||
use PhpParser\Node\Stmt\TryCatch; | ||
use PhpParser\NodeVisitorAbstract; | ||
final class ReIndexNodeAttributeVisitor extends NodeVisitorAbstract | ||
{ | ||
public function enterNode(Node $node) : ?Node | ||
{ | ||
if ($node instanceof CallLike) { | ||
/** @var FuncCall|MethodCall|New_|NullsafeMethodCall|StaticCall $node */ | ||
$node->args = \array_values($node->args); | ||
return $node; | ||
} | ||
if ($node instanceof FunctionLike) { | ||
/** @var ClassMethod|Function_|Closure $node */ | ||
$node->params = \array_values($node->params); | ||
if ($node instanceof Closure) { | ||
$node->uses = \array_values($node->uses); | ||
} | ||
return $node; | ||
} | ||
if ($node instanceof If_) { | ||
$node->elseifs = \array_values($node->elseifs); | ||
return null; | ||
} | ||
if ($node instanceof TryCatch) { | ||
$node->catches = \array_values($node->catches); | ||
return $node; | ||
} | ||
if ($node instanceof Switch_) { | ||
$node->cases = \array_values($node->cases); | ||
return $node; | ||
} | ||
if ($node instanceof MatchArm && \is_array($node->conds)) { | ||
$node->conds = \array_values($node->conds); | ||
return $node; | ||
} | ||
return null; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.