From ceb700cba7f5333b0530d3489b9d9797fb0e770f Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Sat, 25 Dec 2021 18:03:06 +0000 Subject: [PATCH] Updated Rector to commit a5624ca0b99108543b5ad94b3a5894df99327ad1 https://github.com/rectorphp/rector-src/commit/a5624ca0b99108543b5ad94b3a5894df99327ad1 [TypeDeclaration] Fix return type union with null/mixed (#1565) --- .../FunctionLike/ReturnTypeDeclarationRector.php | 9 ++++++--- 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 +++++----- 6 files changed, 25 insertions(+), 22 deletions(-) diff --git a/rules/TypeDeclaration/Rector/FunctionLike/ReturnTypeDeclarationRector.php b/rules/TypeDeclaration/Rector/FunctionLike/ReturnTypeDeclarationRector.php index 1b71e054130..22e35170ec0 100644 --- a/rules/TypeDeclaration/Rector/FunctionLike/ReturnTypeDeclarationRector.php +++ b/rules/TypeDeclaration/Rector/FunctionLike/ReturnTypeDeclarationRector.php @@ -132,10 +132,13 @@ public function refactor(\PhpParser\Node $node) : ?\PhpParser\Node if (!$inferedReturnType instanceof \PHPStan\Type\UnionType) { return $this->processType($node, $inferedReturnType); } - if (!$inferedReturnType->isSuperTypeOf(new \PHPStan\Type\MixedType())->yes()) { - return $this->processType($node, $inferedReturnType); + foreach ($inferedReturnType->getTypes() as $unionedType) { + // mixed type cannot be joined with another types + if ($unionedType instanceof \PHPStan\Type\MixedType) { + return null; + } } - return null; + return $this->processType($node, $inferedReturnType); } public function provideMinPhpVersion() : int { diff --git a/src/Application/VersionResolver.php b/src/Application/VersionResolver.php index daad7a385ae..7fb6ff26120 100644 --- a/src/Application/VersionResolver.php +++ b/src/Application/VersionResolver.php @@ -16,11 +16,11 @@ final class VersionResolver /** * @var string */ - public const PACKAGE_VERSION = '9b51302be952a206b14eed9c138a358a82deae14'; + public const PACKAGE_VERSION = 'a5624ca0b99108543b5ad94b3a5894df99327ad1'; /** * @var string */ - public const RELEASE_DATE = '2021-12-25 18:04:01'; + public const RELEASE_DATE = '2021-12-25 18:54:08'; public static function resolvePackageVersion() : string { $process = new \RectorPrefix20211225\Symfony\Component\Process\Process(['git', 'log', '--pretty="%H"', '-n1', 'HEAD'], __DIR__); diff --git a/vendor/autoload.php b/vendor/autoload.php index 906e38d8285..7f18cfcfe49 100644 --- a/vendor/autoload.php +++ b/vendor/autoload.php @@ -4,4 +4,4 @@ require_once __DIR__ . '/composer/autoload_real.php'; -return ComposerAutoloaderInit951262ab54f8ba7e6395393c5d99561d::getLoader(); +return ComposerAutoloaderInitb469ce1c4b6743e8413c0c1f681c0c98::getLoader(); diff --git a/vendor/composer/autoload_real.php b/vendor/composer/autoload_real.php index 988a6a2277f..9293217f5e3 100644 --- a/vendor/composer/autoload_real.php +++ b/vendor/composer/autoload_real.php @@ -2,7 +2,7 @@ // autoload_real.php @generated by Composer -class ComposerAutoloaderInit951262ab54f8ba7e6395393c5d99561d +class ComposerAutoloaderInitb469ce1c4b6743e8413c0c1f681c0c98 { private static $loader; @@ -22,15 +22,15 @@ public static function getLoader() return self::$loader; } - spl_autoload_register(array('ComposerAutoloaderInit951262ab54f8ba7e6395393c5d99561d', 'loadClassLoader'), true, true); + spl_autoload_register(array('ComposerAutoloaderInitb469ce1c4b6743e8413c0c1f681c0c98', 'loadClassLoader'), true, true); self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__))); - spl_autoload_unregister(array('ComposerAutoloaderInit951262ab54f8ba7e6395393c5d99561d', 'loadClassLoader')); + spl_autoload_unregister(array('ComposerAutoloaderInitb469ce1c4b6743e8413c0c1f681c0c98', '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\ComposerStaticInit951262ab54f8ba7e6395393c5d99561d::getInitializer($loader)); + call_user_func(\Composer\Autoload\ComposerStaticInitb469ce1c4b6743e8413c0c1f681c0c98::getInitializer($loader)); } else { $classMap = require __DIR__ . '/autoload_classmap.php'; if ($classMap) { @@ -42,12 +42,12 @@ public static function getLoader() $loader->register(true); if ($useStaticLoader) { - $includeFiles = Composer\Autoload\ComposerStaticInit951262ab54f8ba7e6395393c5d99561d::$files; + $includeFiles = Composer\Autoload\ComposerStaticInitb469ce1c4b6743e8413c0c1f681c0c98::$files; } else { $includeFiles = require __DIR__ . '/autoload_files.php'; } foreach ($includeFiles as $fileIdentifier => $file) { - composerRequire951262ab54f8ba7e6395393c5d99561d($fileIdentifier, $file); + composerRequireb469ce1c4b6743e8413c0c1f681c0c98($fileIdentifier, $file); } return $loader; @@ -59,7 +59,7 @@ public static function getLoader() * @param string $file * @return void */ -function composerRequire951262ab54f8ba7e6395393c5d99561d($fileIdentifier, $file) +function composerRequireb469ce1c4b6743e8413c0c1f681c0c98($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 f9c9bd02dce..16289d5e04b 100644 --- a/vendor/composer/autoload_static.php +++ b/vendor/composer/autoload_static.php @@ -4,7 +4,7 @@ namespace Composer\Autoload; -class ComposerStaticInit951262ab54f8ba7e6395393c5d99561d +class ComposerStaticInitb469ce1c4b6743e8413c0c1f681c0c98 { public static $files = array ( '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php', @@ -3838,9 +3838,9 @@ class ComposerStaticInit951262ab54f8ba7e6395393c5d99561d public static function getInitializer(ClassLoader $loader) { return \Closure::bind(function () use ($loader) { - $loader->prefixLengthsPsr4 = ComposerStaticInit951262ab54f8ba7e6395393c5d99561d::$prefixLengthsPsr4; - $loader->prefixDirsPsr4 = ComposerStaticInit951262ab54f8ba7e6395393c5d99561d::$prefixDirsPsr4; - $loader->classMap = ComposerStaticInit951262ab54f8ba7e6395393c5d99561d::$classMap; + $loader->prefixLengthsPsr4 = ComposerStaticInitb469ce1c4b6743e8413c0c1f681c0c98::$prefixLengthsPsr4; + $loader->prefixDirsPsr4 = ComposerStaticInitb469ce1c4b6743e8413c0c1f681c0c98::$prefixDirsPsr4; + $loader->classMap = ComposerStaticInitb469ce1c4b6743e8413c0c1f681c0c98::$classMap; }, null, ClassLoader::class); } diff --git a/vendor/scoper-autoload.php b/vendor/scoper-autoload.php index 3743f8487ff..d2e403c135e 100644 --- a/vendor/scoper-autoload.php +++ b/vendor/scoper-autoload.php @@ -9,8 +9,8 @@ if (!class_exists('AutoloadIncluder', false) && !interface_exists('AutoloadIncluder', false) && !trait_exists('AutoloadIncluder', false)) { spl_autoload_call('RectorPrefix20211225\AutoloadIncluder'); } -if (!class_exists('ComposerAutoloaderInit951262ab54f8ba7e6395393c5d99561d', false) && !interface_exists('ComposerAutoloaderInit951262ab54f8ba7e6395393c5d99561d', false) && !trait_exists('ComposerAutoloaderInit951262ab54f8ba7e6395393c5d99561d', false)) { - spl_autoload_call('RectorPrefix20211225\ComposerAutoloaderInit951262ab54f8ba7e6395393c5d99561d'); +if (!class_exists('ComposerAutoloaderInitb469ce1c4b6743e8413c0c1f681c0c98', false) && !interface_exists('ComposerAutoloaderInitb469ce1c4b6743e8413c0c1f681c0c98', false) && !trait_exists('ComposerAutoloaderInitb469ce1c4b6743e8413c0c1f681c0c98', false)) { + spl_autoload_call('RectorPrefix20211225\ComposerAutoloaderInitb469ce1c4b6743e8413c0c1f681c0c98'); } 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('RectorPrefix20211225\Helmich\TypoScriptParser\Parser\AST\Statement'); @@ -78,9 +78,9 @@ function print_node() { return \RectorPrefix20211225\print_node(...func_get_args()); } } -if (!function_exists('composerRequire951262ab54f8ba7e6395393c5d99561d')) { - function composerRequire951262ab54f8ba7e6395393c5d99561d() { - return \RectorPrefix20211225\composerRequire951262ab54f8ba7e6395393c5d99561d(...func_get_args()); +if (!function_exists('composerRequireb469ce1c4b6743e8413c0c1f681c0c98')) { + function composerRequireb469ce1c4b6743e8413c0c1f681c0c98() { + return \RectorPrefix20211225\composerRequireb469ce1c4b6743e8413c0c1f681c0c98(...func_get_args()); } } if (!function_exists('scanPath')) {