Updated Rector to commit 1c651e2d02058a7370f65cf3ac3ce75c8b265535

1c651e2d02 [TypeDeclaration] Skip Prevent object in intersection type on ReturnTypeDeclarationRector (#1727)
This commit is contained in:
Tomas Votruba 2022-01-25 14:27:20 +00:00
parent 538fae2da2
commit 231856524e
6 changed files with 30 additions and 23 deletions

View File

@ -5,9 +5,14 @@ namespace Rector\NodeTypeResolver\NodeTypeCorrector;
use PHPStan\Type\Accessory\AccessoryNonEmptyStringType;
use PHPStan\Type\IntersectionType;
use PHPStan\Type\ObjectWithoutClassType;
use PHPStan\Type\Type;
final class AccessoryNonEmptyStringTypeCorrector
{
/**
* @var array<class-string<Type>>
*/
private const INTERSECTION_DISALLOWED_TYPES = [\PHPStan\Type\Accessory\AccessoryNonEmptyStringType::class, \PHPStan\Type\ObjectWithoutClassType::class];
/**
* @return \PHPStan\Type\IntersectionType|\PHPStan\Type\Type
*/
@ -16,12 +21,9 @@ final class AccessoryNonEmptyStringTypeCorrector
if (!$mainType instanceof \PHPStan\Type\IntersectionType) {
return $mainType;
}
if (!$mainType->isSubTypeOf(new \PHPStan\Type\Accessory\AccessoryNonEmptyStringType())->yes()) {
return $mainType;
}
$clearIntersectionedTypes = [];
foreach ($mainType->getTypes() as $intersectionedType) {
if ($intersectionedType instanceof \PHPStan\Type\Accessory\AccessoryNonEmptyStringType) {
if (\in_array(\get_class($intersectionedType), self::INTERSECTION_DISALLOWED_TYPES, \true)) {
continue;
}
$clearIntersectionedTypes[] = $intersectionedType;
@ -29,6 +31,11 @@ final class AccessoryNonEmptyStringTypeCorrector
if (\count($clearIntersectionedTypes) === 1) {
return $clearIntersectionedTypes[0];
}
$countIntersectionTypes = \count($mainType->getTypes());
$countClearIntersectionedTypes = \count($clearIntersectionedTypes);
if ($countIntersectionTypes === $countClearIntersectionedTypes) {
return $mainType;
}
return new \PHPStan\Type\IntersectionType($clearIntersectionedTypes);
}
}

View File

@ -16,11 +16,11 @@ final class VersionResolver
/**
* @var string
*/
public const PACKAGE_VERSION = '1869c1dc00370ac88497f295fc5782abdb294180';
public const PACKAGE_VERSION = '1c651e2d02058a7370f65cf3ac3ce75c8b265535';
/**
* @var string
*/
public const RELEASE_DATE = '2022-01-25 11:45:18';
public const RELEASE_DATE = '2022-01-25 15:19:09';
public static function resolvePackageVersion() : string
{
$process = new \RectorPrefix20220125\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 ComposerAutoloaderInit6a0f5e6211b82304a4250dfb190dadee::getLoader();
return ComposerAutoloaderInit965950fd15707eac587bd0b9788cf167::getLoader();

View File

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

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