Updated Rector to commit 350d7cd5fc

350d7cd5fc [Php74] Skip null|false type on TypedPropertyRector on php 8.0 feature enabled (#1804)
This commit is contained in:
Tomas Votruba 2022-02-11 18:56:06 +00:00
parent 7247d62498
commit e3b93c5188
8 changed files with 30 additions and 33 deletions

View File

@ -14,6 +14,7 @@ use PhpParser\NodeAbstract;
use PHPStan\PhpDocParser\Ast\Type\TypeNode;
use PHPStan\Type\Constant\ConstantBooleanType;
use PHPStan\Type\IterableType;
use PHPStan\Type\MixedType;
use PHPStan\Type\NullType;
use PHPStan\Type\ObjectType;
use PHPStan\Type\Type;
@ -143,13 +144,14 @@ final class UnionTypeMapper implements \Rector\PHPStanStaticTypeMapper\Contract\
if (!$nullabledTypeNode instanceof \PhpParser\Node) {
return null;
}
if ($nullabledTypeNode instanceof \PhpParser\Node\NullableType) {
if (\in_array(\get_class($nullabledTypeNode), [\PhpParser\Node\NullableType::class, \PhpParser\Node\ComplexType::class], \true)) {
return $nullabledTypeNode;
}
if ($nullabledTypeNode instanceof \PhpParser\Node\ComplexType) {
return $nullabledTypeNode;
/** @var Name $nullabledTypeNode */
if (!$this->nodeNameResolver->isName($nullabledTypeNode, 'false')) {
return new \PhpParser\Node\NullableType($nullabledTypeNode);
}
return new \PhpParser\Node\NullableType($nullabledTypeNode);
return null;
}
private function shouldSkipIterable(\PHPStan\Type\UnionType $unionType) : bool
{
@ -244,8 +246,8 @@ final class UnionTypeMapper implements \Rector\PHPStanStaticTypeMapper\Contract\
}
$phpParserUnionedTypes = [];
foreach ($unionType->getTypes() as $unionedType) {
// void type is not allowed in union
if ($unionedType instanceof \PHPStan\Type\VoidType) {
// void type and mixed type are not allowed in union
if (\in_array(\get_class($unionedType), [\PHPStan\Type\MixedType::class, \PHPStan\Type\VoidType::class], \true)) {
return null;
}
/**

View File

@ -3,7 +3,6 @@
declare (strict_types=1);
namespace Rector\Php74\TypeAnalyzer;
use PHPStan\Type\MixedType;
use PHPStan\Type\Type;
use PHPStan\Type\UnionType;
use Rector\StaticTypeMapper\ValueObject\Type\FullyQualifiedObjectType;
@ -18,10 +17,6 @@ final class ObjectTypeAnalyzer
}
$types = $varType instanceof \PHPStan\Type\UnionType ? $varType->getTypes() : [$varType];
foreach ($types as $type) {
if ($type instanceof \PHPStan\Type\MixedType) {
// mixed does not exists in PHP 7.4
return \true;
}
if (!$type instanceof \Rector\StaticTypeMapper\ValueObject\Type\FullyQualifiedObjectType) {
continue;
}

View File

@ -16,11 +16,11 @@ final class VersionResolver
/**
* @var string
*/
public const PACKAGE_VERSION = '4f13982aab22c1c904ae5cb46fa6a6338030e768';
public const PACKAGE_VERSION = '350d7cd5fc11a07347990a8b66c22e4243b5b90a';
/**
* @var string
*/
public const RELEASE_DATE = '2022-02-11 12:06:34';
public const RELEASE_DATE = '2022-02-11 19:49:49';
public static function resolvePackageVersion() : string
{
$process = new \RectorPrefix20220211\Symfony\Component\Process\Process(['git', 'log', '--pretty="%H"', '-n1', 'HEAD'], __DIR__);

2
vendor/autoload.php vendored
View File

@ -4,4 +4,4 @@
require_once __DIR__ . '/composer/autoload_real.php';
return ComposerAutoloaderInit5276aae4be0394ca6762535405f46b21::getLoader();
return ComposerAutoloaderInit9da0770c110323f114e3815fa5500f6a::getLoader();

View File

@ -2,7 +2,7 @@
// autoload_real.php @generated by Composer
class ComposerAutoloaderInit5276aae4be0394ca6762535405f46b21
class ComposerAutoloaderInit9da0770c110323f114e3815fa5500f6a
{
private static $loader;
@ -22,15 +22,15 @@ class ComposerAutoloaderInit5276aae4be0394ca6762535405f46b21
return self::$loader;
}
spl_autoload_register(array('ComposerAutoloaderInit5276aae4be0394ca6762535405f46b21', 'loadClassLoader'), true, true);
spl_autoload_register(array('ComposerAutoloaderInit9da0770c110323f114e3815fa5500f6a', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
spl_autoload_unregister(array('ComposerAutoloaderInit5276aae4be0394ca6762535405f46b21', 'loadClassLoader'));
spl_autoload_unregister(array('ComposerAutoloaderInit9da0770c110323f114e3815fa5500f6a', '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\ComposerStaticInit5276aae4be0394ca6762535405f46b21::getInitializer($loader));
call_user_func(\Composer\Autoload\ComposerStaticInit9da0770c110323f114e3815fa5500f6a::getInitializer($loader));
} else {
$classMap = require __DIR__ . '/autoload_classmap.php';
if ($classMap) {
@ -42,12 +42,12 @@ class ComposerAutoloaderInit5276aae4be0394ca6762535405f46b21
$loader->register(true);
if ($useStaticLoader) {
$includeFiles = Composer\Autoload\ComposerStaticInit5276aae4be0394ca6762535405f46b21::$files;
$includeFiles = Composer\Autoload\ComposerStaticInit9da0770c110323f114e3815fa5500f6a::$files;
} else {
$includeFiles = require __DIR__ . '/autoload_files.php';
}
foreach ($includeFiles as $fileIdentifier => $file) {
composerRequire5276aae4be0394ca6762535405f46b21($fileIdentifier, $file);
composerRequire9da0770c110323f114e3815fa5500f6a($fileIdentifier, $file);
}
return $loader;
@ -59,7 +59,7 @@ class ComposerAutoloaderInit5276aae4be0394ca6762535405f46b21
* @param string $file
* @return void
*/
function composerRequire5276aae4be0394ca6762535405f46b21($fileIdentifier, $file)
function composerRequire9da0770c110323f114e3815fa5500f6a($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 ComposerStaticInit5276aae4be0394ca6762535405f46b21
class ComposerStaticInit9da0770c110323f114e3815fa5500f6a
{
public static $files = array (
'0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php',
@ -3894,9 +3894,9 @@ class ComposerStaticInit5276aae4be0394ca6762535405f46b21
public static function getInitializer(ClassLoader $loader)
{
return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInit5276aae4be0394ca6762535405f46b21::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit5276aae4be0394ca6762535405f46b21::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit5276aae4be0394ca6762535405f46b21::$classMap;
$loader->prefixLengthsPsr4 = ComposerStaticInit9da0770c110323f114e3815fa5500f6a::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit9da0770c110323f114e3815fa5500f6a::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit9da0770c110323f114e3815fa5500f6a::$classMap;
}, null, ClassLoader::class);
}

View File

@ -3150,12 +3150,12 @@
},
"installation-source": "dist",
"autoload": {
"psr-4": {
"RectorPrefix20220211\\Symfony\\Contracts\\": ""
},
"files": [
"Deprecation\/function.php"
],
"psr-4": {
"RectorPrefix20220211\\Symfony\\Contracts\\": ""
},
"exclude-from-classmap": [
"**\/Tests\/"
]

View File

@ -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('RectorPrefix20220211\AutoloadIncluder');
}
if (!class_exists('ComposerAutoloaderInit5276aae4be0394ca6762535405f46b21', false) && !interface_exists('ComposerAutoloaderInit5276aae4be0394ca6762535405f46b21', false) && !trait_exists('ComposerAutoloaderInit5276aae4be0394ca6762535405f46b21', false)) {
spl_autoload_call('RectorPrefix20220211\ComposerAutoloaderInit5276aae4be0394ca6762535405f46b21');
if (!class_exists('ComposerAutoloaderInit9da0770c110323f114e3815fa5500f6a', false) && !interface_exists('ComposerAutoloaderInit9da0770c110323f114e3815fa5500f6a', false) && !trait_exists('ComposerAutoloaderInit9da0770c110323f114e3815fa5500f6a', false)) {
spl_autoload_call('RectorPrefix20220211\ComposerAutoloaderInit9da0770c110323f114e3815fa5500f6a');
}
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('RectorPrefix20220211\Helmich\TypoScriptParser\Parser\AST\Statement');
@ -71,9 +71,9 @@ if (!function_exists('print_node')) {
return \RectorPrefix20220211\print_node(...func_get_args());
}
}
if (!function_exists('composerRequire5276aae4be0394ca6762535405f46b21')) {
function composerRequire5276aae4be0394ca6762535405f46b21() {
return \RectorPrefix20220211\composerRequire5276aae4be0394ca6762535405f46b21(...func_get_args());
if (!function_exists('composerRequire9da0770c110323f114e3815fa5500f6a')) {
function composerRequire9da0770c110323f114e3815fa5500f6a() {
return \RectorPrefix20220211\composerRequire9da0770c110323f114e3815fa5500f6a(...func_get_args());
}
}
if (!function_exists('scanPath')) {