From 4e2d5cfdcf88e2b262362774209296f2c768bea0 Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Wed, 25 Aug 2021 07:50:25 +0000 Subject: [PATCH] Updated Rector to commit 991ea06c15009442d0a59d8503440681260ae612 https://github.com/rectorphp/rector-src/commit/991ea06c15009442d0a59d8503440681260ae612 Fix wrong docs for ArgumentRemoverRector (#758) --- .../PromotedPropertyCandidateResolver.php | 28 ++++++++++--------- .../ClassMethod/ArgumentRemoverRector.php | 2 +- src/Application/VersionResolver.php | 4 +-- vendor/autoload.php | 2 +- vendor/composer/autoload_real.php | 14 +++++----- vendor/composer/autoload_static.php | 8 +++--- vendor/scoper-autoload.php | 10 +++---- 7 files changed, 35 insertions(+), 33 deletions(-) diff --git a/rules/Php80/NodeAnalyzer/PromotedPropertyCandidateResolver.php b/rules/Php80/NodeAnalyzer/PromotedPropertyCandidateResolver.php index 788f35f78a8..acf62d45225 100644 --- a/rules/Php80/NodeAnalyzer/PromotedPropertyCandidateResolver.php +++ b/rules/Php80/NodeAnalyzer/PromotedPropertyCandidateResolver.php @@ -12,6 +12,7 @@ use PhpParser\Node\Stmt\ClassMethod; use PhpParser\Node\Stmt\Expression; use PhpParser\Node\Stmt\Property; use PHPStan\Type\Generic\TemplateType; +use PHPStan\Type\MixedType; use PHPStan\Type\Type; use PHPStan\Type\UnionType; use Rector\Core\PhpParser\Comparing\NodeComparator; @@ -22,7 +23,6 @@ use Rector\NodeTypeResolver\NodeTypeResolver; use Rector\NodeTypeResolver\PHPStan\Type\TypeFactory; use Rector\NodeTypeResolver\TypeComparator\TypeComparator; use Rector\Php80\ValueObject\PropertyPromotionCandidate; -use Rector\StaticTypeMapper\ValueObject\Type\FullyQualifiedObjectType; use Rector\TypeDeclaration\TypeInferer\PropertyTypeInferer; final class PromotedPropertyCandidateResolver { @@ -173,29 +173,31 @@ final class PromotedPropertyCandidateResolver $defaultValueType = $this->nodeTypeResolver->getStaticType($param->default); $matchedParamType = $this->typeFactory->createMixedPassedOrUnionType([$matchedParamType, $defaultValueType]); } - $isAllFullyQualifiedObjectType = \true; - if ($propertyType instanceof \PHPStan\Type\UnionType) { - if ($this->hasGenericTemplateType($propertyType)) { - return \false; - } - $isAllFullyQualifiedObjectType = !$this->hasNonFullyQualifiedObjectType($propertyType); + if (!$propertyType instanceof \PHPStan\Type\UnionType) { + return \false; } - // different types, not a good to fit - return !$isAllFullyQualifiedObjectType && !$this->typeComparator->areTypesEqual($propertyType, $matchedParamType); + if ($this->typeComparator->areTypesEqual($propertyType, $matchedParamType)) { + return \false; + } + // different types, check not has mixed and not has templated generic types + if (!$this->hasMixedType($propertyType)) { + return \false; + } + return !$this->hasTemplatedGenericType($propertyType); } - private function hasNonFullyQualifiedObjectType(\PHPStan\Type\UnionType $unionType) : bool + private function hasTemplatedGenericType(\PHPStan\Type\UnionType $unionType) : bool { foreach ($unionType->getTypes() as $type) { - if (!$type instanceof \Rector\StaticTypeMapper\ValueObject\Type\FullyQualifiedObjectType) { + if ($type instanceof \PHPStan\Type\Generic\TemplateType) { return \true; } } return \false; } - private function hasGenericTemplateType(\PHPStan\Type\UnionType $unionType) : bool + private function hasMixedType(\PHPStan\Type\UnionType $unionType) : bool { foreach ($unionType->getTypes() as $type) { - if ($type instanceof \PHPStan\Type\Generic\TemplateType) { + if ($type instanceof \PHPStan\Type\MixedType) { return \true; } } diff --git a/rules/Removing/Rector/ClassMethod/ArgumentRemoverRector.php b/rules/Removing/Rector/ClassMethod/ArgumentRemoverRector.php index 53ca27abeff..1a4856f85d3 100644 --- a/rules/Removing/Rector/ClassMethod/ArgumentRemoverRector.php +++ b/rules/Removing/Rector/ClassMethod/ArgumentRemoverRector.php @@ -37,7 +37,7 @@ CODE_SAMPLE $someObject = new SomeClass; $someObject->someMethod(); CODE_SAMPLE -, [self::REMOVED_ARGUMENTS => [new \Rector\Removing\ValueObject\ArgumentRemover('ExampleClass', 'someMethod', 0, 'true')]])]); +, [self::REMOVED_ARGUMENTS => [new \Rector\Removing\ValueObject\ArgumentRemover('ExampleClass', 'someMethod', 0, [\true])]])]); } /** * @return array> diff --git a/src/Application/VersionResolver.php b/src/Application/VersionResolver.php index 8883afea78e..308d54e5ed7 100644 --- a/src/Application/VersionResolver.php +++ b/src/Application/VersionResolver.php @@ -16,11 +16,11 @@ final class VersionResolver /** * @var string */ - public const PACKAGE_VERSION = 'f78ffe3e9131e7c3fa94c8fe9d467517c4f01449'; + public const PACKAGE_VERSION = '991ea06c15009442d0a59d8503440681260ae612'; /** * @var string */ - public const RELEASE_DATE = '2021-08-25 08:49:30'; + public const RELEASE_DATE = '2021-08-25 14:36:51'; public static function resolvePackageVersion() : string { $process = new \RectorPrefix20210825\Symfony\Component\Process\Process(['git', 'log', '--pretty="%H"', '-n1', 'HEAD'], __DIR__); diff --git a/vendor/autoload.php b/vendor/autoload.php index 3a3bd745345..65b51813636 100644 --- a/vendor/autoload.php +++ b/vendor/autoload.php @@ -4,4 +4,4 @@ require_once __DIR__ . '/composer/autoload_real.php'; -return ComposerAutoloaderInit06caff5fbd7b35f8ec56e8181af6e24a::getLoader(); +return ComposerAutoloaderInit31e327da48d5e779488d59181d32eec4::getLoader(); diff --git a/vendor/composer/autoload_real.php b/vendor/composer/autoload_real.php index 4f7c3391d44..86b84f2d35a 100644 --- a/vendor/composer/autoload_real.php +++ b/vendor/composer/autoload_real.php @@ -2,7 +2,7 @@ // autoload_real.php @generated by Composer -class ComposerAutoloaderInit06caff5fbd7b35f8ec56e8181af6e24a +class ComposerAutoloaderInit31e327da48d5e779488d59181d32eec4 { private static $loader; @@ -22,15 +22,15 @@ class ComposerAutoloaderInit06caff5fbd7b35f8ec56e8181af6e24a return self::$loader; } - spl_autoload_register(array('ComposerAutoloaderInit06caff5fbd7b35f8ec56e8181af6e24a', 'loadClassLoader'), true, true); + spl_autoload_register(array('ComposerAutoloaderInit31e327da48d5e779488d59181d32eec4', 'loadClassLoader'), true, true); self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__))); - spl_autoload_unregister(array('ComposerAutoloaderInit06caff5fbd7b35f8ec56e8181af6e24a', 'loadClassLoader')); + spl_autoload_unregister(array('ComposerAutoloaderInit31e327da48d5e779488d59181d32eec4', '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\ComposerStaticInit06caff5fbd7b35f8ec56e8181af6e24a::getInitializer($loader)); + call_user_func(\Composer\Autoload\ComposerStaticInit31e327da48d5e779488d59181d32eec4::getInitializer($loader)); } else { $classMap = require __DIR__ . '/autoload_classmap.php'; if ($classMap) { @@ -42,19 +42,19 @@ class ComposerAutoloaderInit06caff5fbd7b35f8ec56e8181af6e24a $loader->register(true); if ($useStaticLoader) { - $includeFiles = Composer\Autoload\ComposerStaticInit06caff5fbd7b35f8ec56e8181af6e24a::$files; + $includeFiles = Composer\Autoload\ComposerStaticInit31e327da48d5e779488d59181d32eec4::$files; } else { $includeFiles = require __DIR__ . '/autoload_files.php'; } foreach ($includeFiles as $fileIdentifier => $file) { - composerRequire06caff5fbd7b35f8ec56e8181af6e24a($fileIdentifier, $file); + composerRequire31e327da48d5e779488d59181d32eec4($fileIdentifier, $file); } return $loader; } } -function composerRequire06caff5fbd7b35f8ec56e8181af6e24a($fileIdentifier, $file) +function composerRequire31e327da48d5e779488d59181d32eec4($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 af395e07f29..2d477059b1c 100644 --- a/vendor/composer/autoload_static.php +++ b/vendor/composer/autoload_static.php @@ -4,7 +4,7 @@ namespace Composer\Autoload; -class ComposerStaticInit06caff5fbd7b35f8ec56e8181af6e24a +class ComposerStaticInit31e327da48d5e779488d59181d32eec4 { public static $files = array ( 'a4a119a56e50fbb293281d9a48007e0e' => __DIR__ . '/..' . '/symfony/polyfill-php80/bootstrap.php', @@ -3856,9 +3856,9 @@ class ComposerStaticInit06caff5fbd7b35f8ec56e8181af6e24a public static function getInitializer(ClassLoader $loader) { return \Closure::bind(function () use ($loader) { - $loader->prefixLengthsPsr4 = ComposerStaticInit06caff5fbd7b35f8ec56e8181af6e24a::$prefixLengthsPsr4; - $loader->prefixDirsPsr4 = ComposerStaticInit06caff5fbd7b35f8ec56e8181af6e24a::$prefixDirsPsr4; - $loader->classMap = ComposerStaticInit06caff5fbd7b35f8ec56e8181af6e24a::$classMap; + $loader->prefixLengthsPsr4 = ComposerStaticInit31e327da48d5e779488d59181d32eec4::$prefixLengthsPsr4; + $loader->prefixDirsPsr4 = ComposerStaticInit31e327da48d5e779488d59181d32eec4::$prefixDirsPsr4; + $loader->classMap = ComposerStaticInit31e327da48d5e779488d59181d32eec4::$classMap; }, null, ClassLoader::class); } diff --git a/vendor/scoper-autoload.php b/vendor/scoper-autoload.php index e63545de814..80ad1bcfe2b 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('RectorPrefix20210825\AutoloadIncluder'); } -if (!class_exists('ComposerAutoloaderInit06caff5fbd7b35f8ec56e8181af6e24a', false) && !interface_exists('ComposerAutoloaderInit06caff5fbd7b35f8ec56e8181af6e24a', false) && !trait_exists('ComposerAutoloaderInit06caff5fbd7b35f8ec56e8181af6e24a', false)) { - spl_autoload_call('RectorPrefix20210825\ComposerAutoloaderInit06caff5fbd7b35f8ec56e8181af6e24a'); +if (!class_exists('ComposerAutoloaderInit31e327da48d5e779488d59181d32eec4', false) && !interface_exists('ComposerAutoloaderInit31e327da48d5e779488d59181d32eec4', false) && !trait_exists('ComposerAutoloaderInit31e327da48d5e779488d59181d32eec4', false)) { + spl_autoload_call('RectorPrefix20210825\ComposerAutoloaderInit31e327da48d5e779488d59181d32eec4'); } 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('RectorPrefix20210825\Helmich\TypoScriptParser\Parser\AST\Statement'); @@ -3308,9 +3308,9 @@ if (!function_exists('print_node')) { return \RectorPrefix20210825\print_node(...func_get_args()); } } -if (!function_exists('composerRequire06caff5fbd7b35f8ec56e8181af6e24a')) { - function composerRequire06caff5fbd7b35f8ec56e8181af6e24a() { - return \RectorPrefix20210825\composerRequire06caff5fbd7b35f8ec56e8181af6e24a(...func_get_args()); +if (!function_exists('composerRequire31e327da48d5e779488d59181d32eec4')) { + function composerRequire31e327da48d5e779488d59181d32eec4() { + return \RectorPrefix20210825\composerRequire31e327da48d5e779488d59181d32eec4(...func_get_args()); } } if (!function_exists('parseArgs')) {