diff --git a/rules/TypeDeclaration/Rector/ClassMethod/ArrayShapeFromConstantArrayReturnRector.php b/rules/TypeDeclaration/Rector/ClassMethod/ArrayShapeFromConstantArrayReturnRector.php index 99a3cd06b85..4f745ee7028 100644 --- a/rules/TypeDeclaration/Rector/ClassMethod/ArrayShapeFromConstantArrayReturnRector.php +++ b/rules/TypeDeclaration/Rector/ClassMethod/ArrayShapeFromConstantArrayReturnRector.php @@ -11,7 +11,6 @@ use PHPStan\PhpDocParser\Ast\Type\GenericTypeNode; use PHPStan\Type\Constant\ConstantArrayType; use PHPStan\Type\Constant\ConstantStringType; use PHPStan\Type\NeverType; -use PHPStan\Type\Type; use PHPStan\Type\UnionType; use Rector\BetterPhpDocParser\PhpDocManipulator\PhpDocTypeChanger; use Rector\BetterPhpDocParser\ValueObject\Type\SpacingAwareArrayTypeNode; @@ -98,8 +97,7 @@ CODE_SAMPLE if (!$returnExprType instanceof \PHPStan\Type\Constant\ConstantArrayType) { return null; } - $keyType = $returnExprType->getKeyType(); - if ($this->shouldSkipKeyType($keyType)) { + if ($this->shouldSkip($returnExprType)) { return null; } $returnType = $this->classMethodReturnTypeResolver->resolve($node, $node->getAttribute(\Rector\NodeTypeResolver\Node\AttributeKey::SCOPE)); @@ -120,8 +118,9 @@ CODE_SAMPLE } return $node; } - private function shouldSkipKeyType(\PHPStan\Type\Type $keyType) : bool + private function shouldSkip(\PHPStan\Type\Constant\ConstantArrayType $constantArrayType) : bool { + $keyType = $constantArrayType->getKeyType(); // empty array if ($keyType instanceof \PHPStan\Type\NeverType) { return \true; @@ -139,6 +138,10 @@ CODE_SAMPLE return \true; } } + $itemType = $constantArrayType->getItemType(); + if ($itemType instanceof \PHPStan\Type\Constant\ConstantArrayType) { + return $this->shouldSkip($itemType); + } return \false; } } diff --git a/src/Application/VersionResolver.php b/src/Application/VersionResolver.php index 87b3427ba54..31eb279fdf1 100644 --- a/src/Application/VersionResolver.php +++ b/src/Application/VersionResolver.php @@ -16,11 +16,11 @@ final class VersionResolver /** * @var string */ - public const PACKAGE_VERSION = '255a1788285756b2c032946920cb09f650862ba7'; + public const PACKAGE_VERSION = '05f07aab1889d84e8c4d18dbcf0d07c6128bc185'; /** * @var string */ - public const RELEASE_DATE = '2022-04-11 22:37:10'; + public const RELEASE_DATE = '2022-04-11 18:01:17'; public static function resolvePackageVersion() : string { $process = new \RectorPrefix20220411\Symfony\Component\Process\Process(['git', 'log', '--pretty="%H"', '-n1', 'HEAD'], __DIR__); diff --git a/vendor/autoload.php b/vendor/autoload.php index 424110d178a..a5633432af5 100644 --- a/vendor/autoload.php +++ b/vendor/autoload.php @@ -9,4 +9,4 @@ if (PHP_VERSION_ID < 50600) { require_once __DIR__ . '/composer/autoload_real.php'; -return ComposerAutoloaderInitbc40d46325e481fd80dba1e877872550::getLoader(); +return ComposerAutoloaderInitc89d1340da3f491de02a64145948ccaf::getLoader(); diff --git a/vendor/composer/autoload_real.php b/vendor/composer/autoload_real.php index ecd6f1b95ad..0ba6fb40464 100644 --- a/vendor/composer/autoload_real.php +++ b/vendor/composer/autoload_real.php @@ -2,7 +2,7 @@ // autoload_real.php @generated by Composer -class ComposerAutoloaderInitbc40d46325e481fd80dba1e877872550 +class ComposerAutoloaderInitc89d1340da3f491de02a64145948ccaf { private static $loader; @@ -22,19 +22,19 @@ class ComposerAutoloaderInitbc40d46325e481fd80dba1e877872550 return self::$loader; } - spl_autoload_register(array('ComposerAutoloaderInitbc40d46325e481fd80dba1e877872550', 'loadClassLoader'), true, true); + spl_autoload_register(array('ComposerAutoloaderInitc89d1340da3f491de02a64145948ccaf', 'loadClassLoader'), true, true); self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__)); - spl_autoload_unregister(array('ComposerAutoloaderInitbc40d46325e481fd80dba1e877872550', 'loadClassLoader')); + spl_autoload_unregister(array('ComposerAutoloaderInitc89d1340da3f491de02a64145948ccaf', 'loadClassLoader')); require __DIR__ . '/autoload_static.php'; - call_user_func(\Composer\Autoload\ComposerStaticInitbc40d46325e481fd80dba1e877872550::getInitializer($loader)); + call_user_func(\Composer\Autoload\ComposerStaticInitc89d1340da3f491de02a64145948ccaf::getInitializer($loader)); $loader->setClassMapAuthoritative(true); $loader->register(true); - $includeFiles = \Composer\Autoload\ComposerStaticInitbc40d46325e481fd80dba1e877872550::$files; + $includeFiles = \Composer\Autoload\ComposerStaticInitc89d1340da3f491de02a64145948ccaf::$files; foreach ($includeFiles as $fileIdentifier => $file) { - composerRequirebc40d46325e481fd80dba1e877872550($fileIdentifier, $file); + composerRequirec89d1340da3f491de02a64145948ccaf($fileIdentifier, $file); } return $loader; @@ -46,7 +46,7 @@ class ComposerAutoloaderInitbc40d46325e481fd80dba1e877872550 * @param string $file * @return void */ -function composerRequirebc40d46325e481fd80dba1e877872550($fileIdentifier, $file) +function composerRequirec89d1340da3f491de02a64145948ccaf($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 7294ca048d0..38c94b445a0 100644 --- a/vendor/composer/autoload_static.php +++ b/vendor/composer/autoload_static.php @@ -4,7 +4,7 @@ namespace Composer\Autoload; -class ComposerStaticInitbc40d46325e481fd80dba1e877872550 +class ComposerStaticInitc89d1340da3f491de02a64145948ccaf { public static $files = array ( '320cde22f66dd4f5d3fd621d3e88b98f' => __DIR__ . '/..' . '/symfony/polyfill-ctype/bootstrap.php', @@ -3859,9 +3859,9 @@ class ComposerStaticInitbc40d46325e481fd80dba1e877872550 public static function getInitializer(ClassLoader $loader) { return \Closure::bind(function () use ($loader) { - $loader->prefixLengthsPsr4 = ComposerStaticInitbc40d46325e481fd80dba1e877872550::$prefixLengthsPsr4; - $loader->prefixDirsPsr4 = ComposerStaticInitbc40d46325e481fd80dba1e877872550::$prefixDirsPsr4; - $loader->classMap = ComposerStaticInitbc40d46325e481fd80dba1e877872550::$classMap; + $loader->prefixLengthsPsr4 = ComposerStaticInitc89d1340da3f491de02a64145948ccaf::$prefixLengthsPsr4; + $loader->prefixDirsPsr4 = ComposerStaticInitc89d1340da3f491de02a64145948ccaf::$prefixDirsPsr4; + $loader->classMap = ComposerStaticInitc89d1340da3f491de02a64145948ccaf::$classMap; }, null, ClassLoader::class); } diff --git a/vendor/scoper-autoload.php b/vendor/scoper-autoload.php index 52c97df7d31..634748ac342 100644 --- a/vendor/scoper-autoload.php +++ b/vendor/scoper-autoload.php @@ -9,8 +9,8 @@ $loader = require_once __DIR__.'/autoload.php'; if (!class_exists('AutoloadIncluder', false) && !interface_exists('AutoloadIncluder', false) && !trait_exists('AutoloadIncluder', false)) { spl_autoload_call('RectorPrefix20220411\AutoloadIncluder'); } -if (!class_exists('ComposerAutoloaderInitbc40d46325e481fd80dba1e877872550', false) && !interface_exists('ComposerAutoloaderInitbc40d46325e481fd80dba1e877872550', false) && !trait_exists('ComposerAutoloaderInitbc40d46325e481fd80dba1e877872550', false)) { - spl_autoload_call('RectorPrefix20220411\ComposerAutoloaderInitbc40d46325e481fd80dba1e877872550'); +if (!class_exists('ComposerAutoloaderInitc89d1340da3f491de02a64145948ccaf', false) && !interface_exists('ComposerAutoloaderInitc89d1340da3f491de02a64145948ccaf', false) && !trait_exists('ComposerAutoloaderInitc89d1340da3f491de02a64145948ccaf', false)) { + spl_autoload_call('RectorPrefix20220411\ComposerAutoloaderInitc89d1340da3f491de02a64145948ccaf'); } if (!class_exists('Helmich\TypoScriptParser\Parser\AST\Statement', false) && !interface_exists('Helmich\TypoScriptParser\Parser\AST\Statement', false) && !trait_exists('Helmich\TypoScriptParser\Parser\AST\Statement', false)) { spl_autoload_call('RectorPrefix20220411\Helmich\TypoScriptParser\Parser\AST\Statement'); @@ -59,9 +59,9 @@ if (!function_exists('print_node')) { return \RectorPrefix20220411\print_node(...func_get_args()); } } -if (!function_exists('composerRequirebc40d46325e481fd80dba1e877872550')) { - function composerRequirebc40d46325e481fd80dba1e877872550() { - return \RectorPrefix20220411\composerRequirebc40d46325e481fd80dba1e877872550(...func_get_args()); +if (!function_exists('composerRequirec89d1340da3f491de02a64145948ccaf')) { + function composerRequirec89d1340da3f491de02a64145948ccaf() { + return \RectorPrefix20220411\composerRequirec89d1340da3f491de02a64145948ccaf(...func_get_args()); } } if (!function_exists('scanPath')) {