diff --git a/rules/DeadCode/Rector/Cast/RecastingRemovalRector.php b/rules/DeadCode/Rector/Cast/RecastingRemovalRector.php index 0a4712175d8..daf9ad3f4f5 100644 --- a/rules/DeadCode/Rector/Cast/RecastingRemovalRector.php +++ b/rules/DeadCode/Rector/Cast/RecastingRemovalRector.php @@ -24,6 +24,7 @@ use PHPStan\Type\MixedType; use PHPStan\Type\ObjectType; use PHPStan\Type\StringType; use PHPStan\Type\Type; +use PHPStan\Type\UnionType; use Rector\Core\NodeAnalyzer\PropertyFetchAnalyzer; use Rector\Core\Rector\AbstractRector; use Rector\Core\Reflection\ReflectionResolver; @@ -106,7 +107,11 @@ CODE_SAMPLE /** @var PropertyFetch|StaticPropertyFetch $expr */ $phpPropertyReflection = $this->reflectionResolver->resolvePropertyReflectionFromPropertyFetch($expr); if (!$phpPropertyReflection instanceof \PHPStan\Reflection\Php\PhpPropertyReflection) { - return \false; + $propertyType = $expr instanceof \PhpParser\Node\Expr\StaticPropertyFetch ? $this->nodeTypeResolver->resolve($expr->class) : $this->nodeTypeResolver->resolve($expr->var); + // need to UnionType check due rectify with RecastingRemovalRector + CountOnNullRector + // cause add (array) cast on $node->args + // on union $node types FuncCall|MethodCall|StaticCall + return !$propertyType instanceof \PHPStan\Type\UnionType; } $nativeType = $phpPropertyReflection->getNativeType(); return $nativeType instanceof \PHPStan\Type\MixedType; diff --git a/src/Application/VersionResolver.php b/src/Application/VersionResolver.php index c12901de730..2aa4316f883 100644 --- a/src/Application/VersionResolver.php +++ b/src/Application/VersionResolver.php @@ -16,11 +16,11 @@ final class VersionResolver /** * @var string */ - public const PACKAGE_VERSION = 'f257b10df15331bc6bf3cfa9fc2c44b685a0076b'; + public const PACKAGE_VERSION = '505843774379b875c64ed612f2bdc5bae2d769f6'; /** * @var string */ - public const RELEASE_DATE = '2021-08-30 10:16:55'; + public const RELEASE_DATE = '2021-08-30 10:17:27'; public static function resolvePackageVersion() : string { $process = new \RectorPrefix20210830\Symfony\Component\Process\Process(['git', 'log', '--pretty="%H"', '-n1', 'HEAD'], __DIR__); diff --git a/vendor/autoload.php b/vendor/autoload.php index 798627d7a62..e3bda657479 100644 --- a/vendor/autoload.php +++ b/vendor/autoload.php @@ -4,4 +4,4 @@ require_once __DIR__ . '/composer/autoload_real.php'; -return ComposerAutoloaderInite2f04476e58288750fa77432dff28e79::getLoader(); +return ComposerAutoloaderInit5c11e232192e0b55956950eb7869d1c8::getLoader(); diff --git a/vendor/composer/autoload_real.php b/vendor/composer/autoload_real.php index a96c87a22db..777924a76c4 100644 --- a/vendor/composer/autoload_real.php +++ b/vendor/composer/autoload_real.php @@ -2,7 +2,7 @@ // autoload_real.php @generated by Composer -class ComposerAutoloaderInite2f04476e58288750fa77432dff28e79 +class ComposerAutoloaderInit5c11e232192e0b55956950eb7869d1c8 { private static $loader; @@ -22,15 +22,15 @@ class ComposerAutoloaderInite2f04476e58288750fa77432dff28e79 return self::$loader; } - spl_autoload_register(array('ComposerAutoloaderInite2f04476e58288750fa77432dff28e79', 'loadClassLoader'), true, true); + spl_autoload_register(array('ComposerAutoloaderInit5c11e232192e0b55956950eb7869d1c8', 'loadClassLoader'), true, true); self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__))); - spl_autoload_unregister(array('ComposerAutoloaderInite2f04476e58288750fa77432dff28e79', 'loadClassLoader')); + spl_autoload_unregister(array('ComposerAutoloaderInit5c11e232192e0b55956950eb7869d1c8', 'loadClassLoader')); $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded()); if ($useStaticLoader) { require __DIR__ . '/autoload_static.php'; - call_user_func(\Composer\Autoload\ComposerStaticInite2f04476e58288750fa77432dff28e79::getInitializer($loader)); + call_user_func(\Composer\Autoload\ComposerStaticInit5c11e232192e0b55956950eb7869d1c8::getInitializer($loader)); } else { $classMap = require __DIR__ . '/autoload_classmap.php'; if ($classMap) { @@ -42,19 +42,19 @@ class ComposerAutoloaderInite2f04476e58288750fa77432dff28e79 $loader->register(true); if ($useStaticLoader) { - $includeFiles = Composer\Autoload\ComposerStaticInite2f04476e58288750fa77432dff28e79::$files; + $includeFiles = Composer\Autoload\ComposerStaticInit5c11e232192e0b55956950eb7869d1c8::$files; } else { $includeFiles = require __DIR__ . '/autoload_files.php'; } foreach ($includeFiles as $fileIdentifier => $file) { - composerRequiree2f04476e58288750fa77432dff28e79($fileIdentifier, $file); + composerRequire5c11e232192e0b55956950eb7869d1c8($fileIdentifier, $file); } return $loader; } } -function composerRequiree2f04476e58288750fa77432dff28e79($fileIdentifier, $file) +function composerRequire5c11e232192e0b55956950eb7869d1c8($fileIdentifier, $file) { if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { require $file; diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php index abb69bcc706..a309ac4f1a3 100644 --- a/vendor/composer/autoload_static.php +++ b/vendor/composer/autoload_static.php @@ -4,7 +4,7 @@ namespace Composer\Autoload; -class ComposerStaticInite2f04476e58288750fa77432dff28e79 +class ComposerStaticInit5c11e232192e0b55956950eb7869d1c8 { public static $files = array ( 'a4a119a56e50fbb293281d9a48007e0e' => __DIR__ . '/..' . '/symfony/polyfill-php80/bootstrap.php', @@ -3856,9 +3856,9 @@ class ComposerStaticInite2f04476e58288750fa77432dff28e79 public static function getInitializer(ClassLoader $loader) { return \Closure::bind(function () use ($loader) { - $loader->prefixLengthsPsr4 = ComposerStaticInite2f04476e58288750fa77432dff28e79::$prefixLengthsPsr4; - $loader->prefixDirsPsr4 = ComposerStaticInite2f04476e58288750fa77432dff28e79::$prefixDirsPsr4; - $loader->classMap = ComposerStaticInite2f04476e58288750fa77432dff28e79::$classMap; + $loader->prefixLengthsPsr4 = ComposerStaticInit5c11e232192e0b55956950eb7869d1c8::$prefixLengthsPsr4; + $loader->prefixDirsPsr4 = ComposerStaticInit5c11e232192e0b55956950eb7869d1c8::$prefixDirsPsr4; + $loader->classMap = ComposerStaticInit5c11e232192e0b55956950eb7869d1c8::$classMap; }, null, ClassLoader::class); } diff --git a/vendor/scoper-autoload.php b/vendor/scoper-autoload.php index cf905c92de8..90597f1ab86 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('RectorPrefix20210830\AutoloadIncluder'); } -if (!class_exists('ComposerAutoloaderInite2f04476e58288750fa77432dff28e79', false) && !interface_exists('ComposerAutoloaderInite2f04476e58288750fa77432dff28e79', false) && !trait_exists('ComposerAutoloaderInite2f04476e58288750fa77432dff28e79', false)) { - spl_autoload_call('RectorPrefix20210830\ComposerAutoloaderInite2f04476e58288750fa77432dff28e79'); +if (!class_exists('ComposerAutoloaderInit5c11e232192e0b55956950eb7869d1c8', false) && !interface_exists('ComposerAutoloaderInit5c11e232192e0b55956950eb7869d1c8', false) && !trait_exists('ComposerAutoloaderInit5c11e232192e0b55956950eb7869d1c8', false)) { + spl_autoload_call('RectorPrefix20210830\ComposerAutoloaderInit5c11e232192e0b55956950eb7869d1c8'); } 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('RectorPrefix20210830\Helmich\TypoScriptParser\Parser\AST\Statement'); @@ -3311,9 +3311,9 @@ if (!function_exists('print_node')) { return \RectorPrefix20210830\print_node(...func_get_args()); } } -if (!function_exists('composerRequiree2f04476e58288750fa77432dff28e79')) { - function composerRequiree2f04476e58288750fa77432dff28e79() { - return \RectorPrefix20210830\composerRequiree2f04476e58288750fa77432dff28e79(...func_get_args()); +if (!function_exists('composerRequire5c11e232192e0b55956950eb7869d1c8')) { + function composerRequire5c11e232192e0b55956950eb7869d1c8() { + return \RectorPrefix20210830\composerRequire5c11e232192e0b55956950eb7869d1c8(...func_get_args()); } } if (!function_exists('parseArgs')) {