Updated Rector to commit 65fd2014b2a4ac76f78f347c094a2a799dad7b16

65fd2014b2 Fix union type check of object (#4893)
This commit is contained in:
Tomas Votruba 2023-09-01 15:23:24 +00:00
parent 8848b01ee3
commit cc7b0cd56f
11 changed files with 25 additions and 22 deletions

View File

@ -311,6 +311,9 @@ final class NodeTypeResolver
$type = TypeCombinator::removeNull($resolvedType);
// for falsy nullables
$type = TypeCombinator::remove($type, new ConstantBooleanType(\false));
if ($type->isSuperTypeOf($requiredObjectType)->yes()) {
return \true;
}
if (!$type instanceof ObjectType) {
return \false;
}

View File

@ -19,12 +19,12 @@ final class VersionResolver
* @api
* @var string
*/
public const PACKAGE_VERSION = 'c5897e54a62ee69d2441afcd8f043aa65085ee5f';
public const PACKAGE_VERSION = '65fd2014b2a4ac76f78f347c094a2a799dad7b16';
/**
* @api
* @var string
*/
public const RELEASE_DATE = '2023-09-01 13:32:38';
public const RELEASE_DATE = '2023-09-01 17:18:15';
/**
* @var int
*/

2
vendor/autoload.php vendored
View File

@ -22,4 +22,4 @@ if (PHP_VERSION_ID < 50600) {
require_once __DIR__ . '/composer/autoload_real.php';
return ComposerAutoloaderInit91ee312d8eaa70d4974131caa25e5e59::getLoader();
return ComposerAutoloaderInit20e37e41ee629c9ac8163e96d0afd1a2::getLoader();

View File

@ -2,7 +2,7 @@
// autoload_real.php @generated by Composer
class ComposerAutoloaderInit91ee312d8eaa70d4974131caa25e5e59
class ComposerAutoloaderInit20e37e41ee629c9ac8163e96d0afd1a2
{
private static $loader;
@ -22,17 +22,17 @@ class ComposerAutoloaderInit91ee312d8eaa70d4974131caa25e5e59
return self::$loader;
}
spl_autoload_register(array('ComposerAutoloaderInit91ee312d8eaa70d4974131caa25e5e59', 'loadClassLoader'), true, true);
spl_autoload_register(array('ComposerAutoloaderInit20e37e41ee629c9ac8163e96d0afd1a2', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
spl_autoload_unregister(array('ComposerAutoloaderInit91ee312d8eaa70d4974131caa25e5e59', 'loadClassLoader'));
spl_autoload_unregister(array('ComposerAutoloaderInit20e37e41ee629c9ac8163e96d0afd1a2', 'loadClassLoader'));
require __DIR__ . '/autoload_static.php';
call_user_func(\Composer\Autoload\ComposerStaticInit91ee312d8eaa70d4974131caa25e5e59::getInitializer($loader));
call_user_func(\Composer\Autoload\ComposerStaticInit20e37e41ee629c9ac8163e96d0afd1a2::getInitializer($loader));
$loader->setClassMapAuthoritative(true);
$loader->register(true);
$filesToLoad = \Composer\Autoload\ComposerStaticInit91ee312d8eaa70d4974131caa25e5e59::$files;
$filesToLoad = \Composer\Autoload\ComposerStaticInit20e37e41ee629c9ac8163e96d0afd1a2::$files;
$requireFile = \Closure::bind(static function ($fileIdentifier, $file) {
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;

View File

@ -4,7 +4,7 @@
namespace Composer\Autoload;
class ComposerStaticInit91ee312d8eaa70d4974131caa25e5e59
class ComposerStaticInit20e37e41ee629c9ac8163e96d0afd1a2
{
public static $files = array (
'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php',
@ -2610,9 +2610,9 @@ class ComposerStaticInit91ee312d8eaa70d4974131caa25e5e59
public static function getInitializer(ClassLoader $loader)
{
return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInit91ee312d8eaa70d4974131caa25e5e59::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit91ee312d8eaa70d4974131caa25e5e59::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit91ee312d8eaa70d4974131caa25e5e59::$classMap;
$loader->prefixLengthsPsr4 = ComposerStaticInit20e37e41ee629c9ac8163e96d0afd1a2::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit20e37e41ee629c9ac8163e96d0afd1a2::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit20e37e41ee629c9ac8163e96d0afd1a2::$classMap;
}, null, ClassLoader::class);
}

View File

@ -1812,12 +1812,12 @@
"source": {
"type": "git",
"url": "https:\/\/github.com\/rectorphp\/rector-downgrade-php.git",
"reference": "62da1c0b9e407dd1a17e8cf99b6ee3e618ec5659"
"reference": "efacc039b561913b621603a72465ae3fd22d743e"
},
"dist": {
"type": "zip",
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-downgrade-php\/zipball\/62da1c0b9e407dd1a17e8cf99b6ee3e618ec5659",
"reference": "62da1c0b9e407dd1a17e8cf99b6ee3e618ec5659",
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-downgrade-php\/zipball\/efacc039b561913b621603a72465ae3fd22d743e",
"reference": "efacc039b561913b621603a72465ae3fd22d743e",
"shasum": ""
},
"require": {
@ -1844,7 +1844,7 @@
"tomasvotruba\/unused-public": "^0.2",
"tracy\/tracy": "^2.10"
},
"time": "2023-09-01T14:44:18+00:00",
"time": "2023-09-01T15:20:13+00:00",
"default-branch": true,
"type": "rector-extension",
"extra": {

File diff suppressed because one or more lines are too long

View File

@ -36,7 +36,7 @@ final class Reflection
*/
public static function getReturnType(\ReflectionFunctionAbstract $func) : ?string
{
$type = $func->getReturnType() ?? (\PHP_VERSION_ID >= 80100 && $func instanceof \ReflectionMethod ? $func->getReturnType() : null);
$type = $func->getReturnType() ?? (\PHP_VERSION_ID >= 80100 && $func instanceof \ReflectionMethod ? $func->getTentativeReturnType() : null);
return self::getType($func, $type);
}
/**

View File

@ -29,9 +29,9 @@ final class Type
if ($reflection instanceof \ReflectionProperty && \PHP_VERSION_ID < 70400) {
return null;
} elseif ($reflection instanceof \ReflectionMethod) {
$type = $reflection->getReturnType() ?? (\PHP_VERSION_ID >= 80100 ? $reflection->getReturnType() : null);
$type = $reflection->getReturnType() ?? (\PHP_VERSION_ID >= 80100 ? $reflection->getTentativeReturnType() : null);
} else {
$type = $reflection instanceof \ReflectionFunctionAbstract ? $reflection->getReturnType() : $reflection->getType();
$type = $reflection instanceof \ReflectionFunctionAbstract ? $reflection->getReturnType() : (\method_exists($reflection, 'getType') ? $reflection->getType() : null);
}
return $type ? self::fromReflectionType($type, $reflection, \true) : null;
}

View File

@ -9,7 +9,7 @@ namespace Rector\RectorInstaller;
*/
final class GeneratedConfig
{
public const EXTENSIONS = array('rector/rector-doctrine' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-doctrine', 'relative_install_path' => '../../rector-doctrine', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main fabb300'), 'rector/rector-downgrade-php' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-downgrade-php', 'relative_install_path' => '../../rector-downgrade-php', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 62da1c0'), 'rector/rector-phpunit' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-phpunit', 'relative_install_path' => '../../rector-phpunit', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main e6dd6a0'), 'rector/rector-symfony' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-symfony', 'relative_install_path' => '../../rector-symfony', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 5c30ddf'));
public const EXTENSIONS = array('rector/rector-doctrine' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-doctrine', 'relative_install_path' => '../../rector-doctrine', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main fabb300'), 'rector/rector-downgrade-php' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-downgrade-php', 'relative_install_path' => '../../rector-downgrade-php', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main efacc03'), 'rector/rector-phpunit' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-phpunit', 'relative_install_path' => '../../rector-phpunit', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main e6dd6a0'), 'rector/rector-symfony' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-symfony', 'relative_install_path' => '../../rector-symfony', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 5c30ddf'));
private function __construct()
{
}

View File

@ -24,7 +24,7 @@ return static function (RectorConfig $rectorConfig) : void {
$rectorConfig->phpVersion(PhpVersion::PHP_80);
$rectorConfig->rules([DowngradeFinalizePublicClassConstantRector::class, DowngradeFirstClassCallableSyntaxRector::class, DowngradeNeverTypeDeclarationRector::class, DowngradePureIntersectionTypeRector::class, DowngradeNewInInitializerRector::class, DowngradePhp81ResourceReturnToObjectRector::class, DowngradeReadonlyPropertyRector::class, DowngradeArraySpreadStringKeyRector::class, DowngradeArrayIsListRector::class, DowngradeSetAccessibleReflectionPropertyRector::class, DowngradeIsEnumRector::class, DowngradeOctalNumberRector::class]);
// @see https://php.watch/versions/8.1/internal-method-return-types#reflection
$rectorConfig->ruleWithConfiguration(RenameMethodRector::class, [new MethodCallRename('ReflectionFunctionAbstract', 'hasTentativeReturnType', 'hasReturnType'), new MethodCallRename('ReflectionFunctionAbstract', 'getTentativeReturnType', 'getReturnType')]);
$rectorConfig->ruleWithConfiguration(RenameMethodRector::class, [new MethodCallRename('ReflectionFunction', 'hasTentativeReturnType', 'hasReturnType'), new MethodCallRename('ReflectionFunction', 'getTentativeReturnType', 'getReturnType'), new MethodCallRename('ReflectionMethod', 'hasTentativeReturnType', 'hasReturnType'), new MethodCallRename('ReflectionMethod', 'getTentativeReturnType', 'getReturnType')]);
$rectorConfig->ruleWithConfiguration(RenameFunctionRector::class, [
// @see https://php.watch/versions/8.1/enums#enum-exists
'enum_exists' => 'class_exists',