From 5baa4004e9bb5447f982a1bb76fb3ff75fc5bde4 Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Wed, 5 Mar 2025 12:04:52 +0000 Subject: [PATCH] Updated Rector to commit fb92953a4ecd43c6dfb2de9dd1b7c32a74c552d8 https://github.com/rectorphp/rector-src/commit/fb92953a4ecd43c6dfb2de9dd1b7c32a74c552d8 [Php80][Php81] Handle crash on combine AnnotationToAttributeRector + FirstClassCallableRector (#6767) --- src/Application/ChangedNodeScopeRefresher.php | 6 ++++++ src/Application/VersionResolver.php | 4 ++-- src/NodeAnalyzer/ScopeAnalyzer.php | 3 +-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/Application/ChangedNodeScopeRefresher.php b/src/Application/ChangedNodeScopeRefresher.php index 0c5fd7a353f..35e2378d1e4 100644 --- a/src/Application/ChangedNodeScopeRefresher.php +++ b/src/Application/ChangedNodeScopeRefresher.php @@ -11,6 +11,7 @@ use PhpParser\Node\DeclareItem; use PhpParser\Node\Expr; use PhpParser\Node\Expr\Array_; use PhpParser\Node\Expr\Closure; +use PhpParser\Node\Param; use PhpParser\Node\PropertyItem; use PhpParser\Node\StaticVar; use PhpParser\Node\Stmt; @@ -90,6 +91,11 @@ final class ChangedNodeScopeRefresher if ($node instanceof UseItem) { return [new Use_([$node])]; } + if ($node instanceof Param) { + $closure = new Closure(); + $closure->params[] = $node; + return [new Expression($closure)]; + } $errorMessage = \sprintf('Complete parent node of "%s" be a stmt.', \get_class($node)); throw new ShouldNotHappenException($errorMessage); } diff --git a/src/Application/VersionResolver.php b/src/Application/VersionResolver.php index e2144b18d03..c8246b9a86e 100644 --- a/src/Application/VersionResolver.php +++ b/src/Application/VersionResolver.php @@ -19,12 +19,12 @@ final class VersionResolver * @api * @var string */ - public const PACKAGE_VERSION = 'e79b0d5e38c54c9dced027bfcdc00085e18e6b68'; + public const PACKAGE_VERSION = 'fb92953a4ecd43c6dfb2de9dd1b7c32a74c552d8'; /** * @api * @var string */ - public const RELEASE_DATE = '2025-03-04 22:21:30'; + public const RELEASE_DATE = '2025-03-05 19:02:20'; /** * @var int */ diff --git a/src/NodeAnalyzer/ScopeAnalyzer.php b/src/NodeAnalyzer/ScopeAnalyzer.php index 11389e056d9..5f2f41197b1 100644 --- a/src/NodeAnalyzer/ScopeAnalyzer.php +++ b/src/NodeAnalyzer/ScopeAnalyzer.php @@ -9,13 +9,12 @@ use PhpParser\Node\Attribute; use PhpParser\Node\Expr\Variable; use PhpParser\Node\Identifier; use PhpParser\Node\Name; -use PhpParser\Node\Param; final class ScopeAnalyzer { /** * @var array> */ - private const NON_REFRESHABLE_NODES = [Name::class, Identifier::class, Param::class, Arg::class, Variable::class, Attribute::class]; + private const NON_REFRESHABLE_NODES = [Name::class, Identifier::class, Arg::class, Variable::class, Attribute::class]; public function isRefreshable(Node $node) : bool { foreach (self::NON_REFRESHABLE_NODES as $noScopeNode) {