From 298a54bb2b44e7eda2f1d93129f5da5751c33379 Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Sat, 11 Sep 2021 15:12:18 +0000 Subject: [PATCH] Updated Rector to commit 97d3ad74eec35641062e3d9a471c290359d70849 https://github.com/rectorphp/rector-src/commit/97d3ad74eec35641062e3d9a471c290359d70849 [CodeQuality][EarlyReturn] Handle DateTimeToDateTimeInterfaceRector + ChangeAndIfToEarlyReturnRector + ChangeOrIfContinueToMultiContinueRector (#867) --- .../ClassMethodReturnTypeManipulator.php | 9 +++++---- .../DateTimeToDateTimeInterfaceRector.php | 3 +-- 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, 25 insertions(+), 25 deletions(-) diff --git a/rules/CodeQuality/NodeManipulator/ClassMethodReturnTypeManipulator.php b/rules/CodeQuality/NodeManipulator/ClassMethodReturnTypeManipulator.php index 3c527bf9c21..fa3eea68020 100644 --- a/rules/CodeQuality/NodeManipulator/ClassMethodReturnTypeManipulator.php +++ b/rules/CodeQuality/NodeManipulator/ClassMethodReturnTypeManipulator.php @@ -37,11 +37,11 @@ final class ClassMethodReturnTypeManipulator /** * @param \PhpParser\Node\Identifier|\PhpParser\Node\Name|\PhpParser\Node\NullableType $replaceIntoType */ - public function refactorFunctionReturnType(\PhpParser\Node\Stmt\ClassMethod $classMethod, \PHPStan\Type\ObjectType $objectType, $replaceIntoType, \PHPStan\Type\Type $phpDocType) : void + public function refactorFunctionReturnType(\PhpParser\Node\Stmt\ClassMethod $classMethod, \PHPStan\Type\ObjectType $objectType, $replaceIntoType, \PHPStan\Type\Type $phpDocType) : ?\PhpParser\Node\Stmt\ClassMethod { $returnType = $classMethod->returnType; if ($returnType === null) { - return; + return null; } $isNullable = \false; if ($returnType instanceof \PhpParser\Node\NullableType) { @@ -49,11 +49,11 @@ final class ClassMethodReturnTypeManipulator $returnType = $returnType->type; } if (!$this->nodeTypeResolver->isObjectType($returnType, $objectType)) { - return; + return null; } $paramType = $this->nodeTypeResolver->resolve($returnType); if (!$paramType->isSuperTypeOf($objectType)->yes()) { - return; + return null; } if ($isNullable) { if ($phpDocType instanceof \PHPStan\Type\UnionType) { @@ -70,5 +70,6 @@ final class ClassMethodReturnTypeManipulator $classMethod->returnType = $replaceIntoType; $phpDocInfo = $this->phpDocInfoFactory->createFromNodeOrEmpty($classMethod); $this->phpDocTypeChanger->changeReturnType($phpDocInfo, $phpDocType); + return $classMethod; } } diff --git a/rules/CodeQuality/Rector/ClassMethod/DateTimeToDateTimeInterfaceRector.php b/rules/CodeQuality/Rector/ClassMethod/DateTimeToDateTimeInterfaceRector.php index 30eb8f7c2bf..011edc9890f 100644 --- a/rules/CodeQuality/Rector/ClassMethod/DateTimeToDateTimeInterfaceRector.php +++ b/rules/CodeQuality/Rector/ClassMethod/DateTimeToDateTimeInterfaceRector.php @@ -164,8 +164,7 @@ CODE_SAMPLE if (!$classMethod->returnType instanceof \PhpParser\Node) { return null; } - $this->classMethodReturnTypeManipulator->refactorFunctionReturnType($classMethod, $fromObjectType, $fullyQualified, $unionType); - return $classMethod; + return $this->classMethodReturnTypeManipulator->refactorFunctionReturnType($classMethod, $fromObjectType, $fullyQualified, $unionType); } private function shouldSkipExactlyReturnDateTime(\PhpParser\Node\Stmt\ClassMethod $classMethod) : bool { diff --git a/src/Application/VersionResolver.php b/src/Application/VersionResolver.php index 062611f96b2..b9caf6318f0 100644 --- a/src/Application/VersionResolver.php +++ b/src/Application/VersionResolver.php @@ -16,11 +16,11 @@ final class VersionResolver /** * @var string */ - public const PACKAGE_VERSION = 'c71f6ee6412df421e254665d9d7b0ef42fda0c57'; + public const PACKAGE_VERSION = '97d3ad74eec35641062e3d9a471c290359d70849'; /** * @var string */ - public const RELEASE_DATE = '2021-09-11 12:49:11'; + public const RELEASE_DATE = '2021-09-11 17:01:30'; public static function resolvePackageVersion() : string { $process = new \RectorPrefix20210911\Symfony\Component\Process\Process(['git', 'log', '--pretty="%H"', '-n1', 'HEAD'], __DIR__); diff --git a/vendor/autoload.php b/vendor/autoload.php index 4e05c38ac48..8b93bd86ab3 100644 --- a/vendor/autoload.php +++ b/vendor/autoload.php @@ -4,4 +4,4 @@ require_once __DIR__ . '/composer/autoload_real.php'; -return ComposerAutoloaderInitc373b2dc4e52def312178f7dde82817e::getLoader(); +return ComposerAutoloaderInit54c8fc77e4fb370a7e0046e9e61317a2::getLoader(); diff --git a/vendor/composer/autoload_real.php b/vendor/composer/autoload_real.php index 3e2acb42d08..c05b816653c 100644 --- a/vendor/composer/autoload_real.php +++ b/vendor/composer/autoload_real.php @@ -2,7 +2,7 @@ // autoload_real.php @generated by Composer -class ComposerAutoloaderInitc373b2dc4e52def312178f7dde82817e +class ComposerAutoloaderInit54c8fc77e4fb370a7e0046e9e61317a2 { private static $loader; @@ -22,15 +22,15 @@ class ComposerAutoloaderInitc373b2dc4e52def312178f7dde82817e return self::$loader; } - spl_autoload_register(array('ComposerAutoloaderInitc373b2dc4e52def312178f7dde82817e', 'loadClassLoader'), true, true); + spl_autoload_register(array('ComposerAutoloaderInit54c8fc77e4fb370a7e0046e9e61317a2', 'loadClassLoader'), true, true); self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__))); - spl_autoload_unregister(array('ComposerAutoloaderInitc373b2dc4e52def312178f7dde82817e', 'loadClassLoader')); + spl_autoload_unregister(array('ComposerAutoloaderInit54c8fc77e4fb370a7e0046e9e61317a2', '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\ComposerStaticInitc373b2dc4e52def312178f7dde82817e::getInitializer($loader)); + call_user_func(\Composer\Autoload\ComposerStaticInit54c8fc77e4fb370a7e0046e9e61317a2::getInitializer($loader)); } else { $classMap = require __DIR__ . '/autoload_classmap.php'; if ($classMap) { @@ -42,19 +42,19 @@ class ComposerAutoloaderInitc373b2dc4e52def312178f7dde82817e $loader->register(true); if ($useStaticLoader) { - $includeFiles = Composer\Autoload\ComposerStaticInitc373b2dc4e52def312178f7dde82817e::$files; + $includeFiles = Composer\Autoload\ComposerStaticInit54c8fc77e4fb370a7e0046e9e61317a2::$files; } else { $includeFiles = require __DIR__ . '/autoload_files.php'; } foreach ($includeFiles as $fileIdentifier => $file) { - composerRequirec373b2dc4e52def312178f7dde82817e($fileIdentifier, $file); + composerRequire54c8fc77e4fb370a7e0046e9e61317a2($fileIdentifier, $file); } return $loader; } } -function composerRequirec373b2dc4e52def312178f7dde82817e($fileIdentifier, $file) +function composerRequire54c8fc77e4fb370a7e0046e9e61317a2($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 dfea3726a17..5e3115dfe08 100644 --- a/vendor/composer/autoload_static.php +++ b/vendor/composer/autoload_static.php @@ -4,7 +4,7 @@ namespace Composer\Autoload; -class ComposerStaticInitc373b2dc4e52def312178f7dde82817e +class ComposerStaticInit54c8fc77e4fb370a7e0046e9e61317a2 { public static $files = array ( 'a4a119a56e50fbb293281d9a48007e0e' => __DIR__ . '/..' . '/symfony/polyfill-php80/bootstrap.php', @@ -3858,9 +3858,9 @@ class ComposerStaticInitc373b2dc4e52def312178f7dde82817e public static function getInitializer(ClassLoader $loader) { return \Closure::bind(function () use ($loader) { - $loader->prefixLengthsPsr4 = ComposerStaticInitc373b2dc4e52def312178f7dde82817e::$prefixLengthsPsr4; - $loader->prefixDirsPsr4 = ComposerStaticInitc373b2dc4e52def312178f7dde82817e::$prefixDirsPsr4; - $loader->classMap = ComposerStaticInitc373b2dc4e52def312178f7dde82817e::$classMap; + $loader->prefixLengthsPsr4 = ComposerStaticInit54c8fc77e4fb370a7e0046e9e61317a2::$prefixLengthsPsr4; + $loader->prefixDirsPsr4 = ComposerStaticInit54c8fc77e4fb370a7e0046e9e61317a2::$prefixDirsPsr4; + $loader->classMap = ComposerStaticInit54c8fc77e4fb370a7e0046e9e61317a2::$classMap; }, null, ClassLoader::class); } diff --git a/vendor/scoper-autoload.php b/vendor/scoper-autoload.php index ca9de905571..52a3d46008c 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('RectorPrefix20210911\AutoloadIncluder'); } -if (!class_exists('ComposerAutoloaderInitc373b2dc4e52def312178f7dde82817e', false) && !interface_exists('ComposerAutoloaderInitc373b2dc4e52def312178f7dde82817e', false) && !trait_exists('ComposerAutoloaderInitc373b2dc4e52def312178f7dde82817e', false)) { - spl_autoload_call('RectorPrefix20210911\ComposerAutoloaderInitc373b2dc4e52def312178f7dde82817e'); +if (!class_exists('ComposerAutoloaderInit54c8fc77e4fb370a7e0046e9e61317a2', false) && !interface_exists('ComposerAutoloaderInit54c8fc77e4fb370a7e0046e9e61317a2', false) && !trait_exists('ComposerAutoloaderInit54c8fc77e4fb370a7e0046e9e61317a2', false)) { + spl_autoload_call('RectorPrefix20210911\ComposerAutoloaderInit54c8fc77e4fb370a7e0046e9e61317a2'); } 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('RectorPrefix20210911\Helmich\TypoScriptParser\Parser\AST\Statement'); @@ -3311,9 +3311,9 @@ if (!function_exists('print_node')) { return \RectorPrefix20210911\print_node(...func_get_args()); } } -if (!function_exists('composerRequirec373b2dc4e52def312178f7dde82817e')) { - function composerRequirec373b2dc4e52def312178f7dde82817e() { - return \RectorPrefix20210911\composerRequirec373b2dc4e52def312178f7dde82817e(...func_get_args()); +if (!function_exists('composerRequire54c8fc77e4fb370a7e0046e9e61317a2')) { + function composerRequire54c8fc77e4fb370a7e0046e9e61317a2() { + return \RectorPrefix20210911\composerRequire54c8fc77e4fb370a7e0046e9e61317a2(...func_get_args()); } } if (!function_exists('parseArgs')) {