diff --git a/rules/TypeDeclaration/Rector/ClassMethod/StrictArrayParamDimFetchRector.php b/rules/TypeDeclaration/Rector/ClassMethod/StrictArrayParamDimFetchRector.php index 98c3f7d83b40..ad0c4f34357f 100644 --- a/rules/TypeDeclaration/Rector/ClassMethod/StrictArrayParamDimFetchRector.php +++ b/rules/TypeDeclaration/Rector/ClassMethod/StrictArrayParamDimFetchRector.php @@ -7,10 +7,13 @@ use PhpParser\Node\Expr\ArrayDimFetch; use PhpParser\Node\Expr\AssignOp\Coalesce as AssignOpCoalesce; use PhpParser\Node\Expr\BinaryOp\Coalesce; +use PhpParser\Node\Expr\Closure; use PhpParser\Node\Expr\FuncCall; use PhpParser\Node\Expr\Variable; +use PhpParser\Node\FunctionLike; use PhpParser\Node\Identifier; use PhpParser\Node\Param; +use PhpParser\Node\Stmt\Class_; use PhpParser\Node\Stmt\ClassMethod; use PhpParser\Node\Stmt\Function_; use PhpParser\NodeTraverser; @@ -59,10 +62,10 @@ public function resolve(array $item) */ public function getNodeTypes() : array { - return [ClassMethod::class, Function_::class]; + return [ClassMethod::class, Function_::class, Closure::class]; } /** - * @param ClassMethod|Function_ $node + * @param ClassMethod|Function_|Closure $node */ public function refactor(Node $node) : ?Node { @@ -86,13 +89,19 @@ public function refactor(Node $node) : ?Node return null; } /** - * @param \PhpParser\Node\Stmt\ClassMethod|\PhpParser\Node\Stmt\Function_ $functionLike + * @param \PhpParser\Node\Stmt\ClassMethod|\PhpParser\Node\Stmt\Function_|\PhpParser\Node\Expr\Closure $functionLike */ private function isParamAccessedArrayDimFetch(Param $param, $functionLike) : bool { + if ($functionLike->stmts === null) { + return \false; + } $paramName = $this->getName($param); $isParamAccessedArrayDimFetch = \false; - $this->traverseNodesWithCallable($functionLike, function (Node $node) use($paramName, &$isParamAccessedArrayDimFetch) : ?int { + $this->traverseNodesWithCallable($functionLike->stmts, function (Node $node) use($paramName, &$isParamAccessedArrayDimFetch) : ?int { + if ($node instanceof Class_ || $node instanceof FunctionLike) { + return NodeTraverser::DONT_TRAVERSE_CURRENT_AND_CHILDREN; + } if ($this->shouldStop($node, $paramName)) { // force set to false to avoid too early replaced $isParamAccessedArrayDimFetch = \false; diff --git a/src/Application/VersionResolver.php b/src/Application/VersionResolver.php index 89939dc87f41..9746015cbf5b 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 = '36e88e13e5d41db048494b497d59ae0e96c877f0'; + public const PACKAGE_VERSION = '79953f61e341fdb7263316b34eeaa2be737d12ef'; /** * @api * @var string */ - public const RELEASE_DATE = '2023-08-03 20:52:40'; + public const RELEASE_DATE = '2023-08-03 21:00:56'; /** * @var int */ diff --git a/vendor/autoload.php b/vendor/autoload.php index 93c3aa78f187..6a12bb4a083b 100644 --- a/vendor/autoload.php +++ b/vendor/autoload.php @@ -22,4 +22,4 @@ require_once __DIR__ . '/composer/autoload_real.php'; -return ComposerAutoloaderInit3d41daa140625cb5a46044552327926a::getLoader(); +return ComposerAutoloaderInitf3635f7070cdd35c0d9b3bdb494eb86c::getLoader(); diff --git a/vendor/composer/autoload_real.php b/vendor/composer/autoload_real.php index 74c302a8e945..46df47790514 100644 --- a/vendor/composer/autoload_real.php +++ b/vendor/composer/autoload_real.php @@ -2,7 +2,7 @@ // autoload_real.php @generated by Composer -class ComposerAutoloaderInit3d41daa140625cb5a46044552327926a +class ComposerAutoloaderInitf3635f7070cdd35c0d9b3bdb494eb86c { private static $loader; @@ -22,17 +22,17 @@ public static function getLoader() return self::$loader; } - spl_autoload_register(array('ComposerAutoloaderInit3d41daa140625cb5a46044552327926a', 'loadClassLoader'), true, true); + spl_autoload_register(array('ComposerAutoloaderInitf3635f7070cdd35c0d9b3bdb494eb86c', 'loadClassLoader'), true, true); self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__)); - spl_autoload_unregister(array('ComposerAutoloaderInit3d41daa140625cb5a46044552327926a', 'loadClassLoader')); + spl_autoload_unregister(array('ComposerAutoloaderInitf3635f7070cdd35c0d9b3bdb494eb86c', 'loadClassLoader')); require __DIR__ . '/autoload_static.php'; - call_user_func(\Composer\Autoload\ComposerStaticInit3d41daa140625cb5a46044552327926a::getInitializer($loader)); + call_user_func(\Composer\Autoload\ComposerStaticInitf3635f7070cdd35c0d9b3bdb494eb86c::getInitializer($loader)); $loader->setClassMapAuthoritative(true); $loader->register(true); - $filesToLoad = \Composer\Autoload\ComposerStaticInit3d41daa140625cb5a46044552327926a::$files; + $filesToLoad = \Composer\Autoload\ComposerStaticInitf3635f7070cdd35c0d9b3bdb494eb86c::$files; $requireFile = \Closure::bind(static function ($fileIdentifier, $file) { if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true; diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php index b3c97fab8b00..4e5ef44671ea 100644 --- a/vendor/composer/autoload_static.php +++ b/vendor/composer/autoload_static.php @@ -4,7 +4,7 @@ namespace Composer\Autoload; -class ComposerStaticInit3d41daa140625cb5a46044552327926a +class ComposerStaticInitf3635f7070cdd35c0d9b3bdb494eb86c { public static $files = array ( 'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php', @@ -3025,9 +3025,9 @@ class ComposerStaticInit3d41daa140625cb5a46044552327926a public static function getInitializer(ClassLoader $loader) { return \Closure::bind(function () use ($loader) { - $loader->prefixLengthsPsr4 = ComposerStaticInit3d41daa140625cb5a46044552327926a::$prefixLengthsPsr4; - $loader->prefixDirsPsr4 = ComposerStaticInit3d41daa140625cb5a46044552327926a::$prefixDirsPsr4; - $loader->classMap = ComposerStaticInit3d41daa140625cb5a46044552327926a::$classMap; + $loader->prefixLengthsPsr4 = ComposerStaticInitf3635f7070cdd35c0d9b3bdb494eb86c::$prefixLengthsPsr4; + $loader->prefixDirsPsr4 = ComposerStaticInitf3635f7070cdd35c0d9b3bdb494eb86c::$prefixDirsPsr4; + $loader->classMap = ComposerStaticInitf3635f7070cdd35c0d9b3bdb494eb86c::$classMap; }, null, ClassLoader::class); }