Updated Rector to commit 8be7ac6830f0f7191af7118814c779da3ebd9b56

8be7ac6830 Remove unused offset correction (#3843)
This commit is contained in:
Tomas Votruba 2023-05-14 15:14:10 +00:00
parent 5d75a302b5
commit f844a1b873
7 changed files with 14 additions and 66 deletions

View File

@ -1,43 +0,0 @@
<?php
declare (strict_types=1);
namespace Rector\NodeTypeResolver\NodeTypeCorrector;
use PHPStan\Type\Accessory\HasOffsetType;
use PHPStan\Type\Accessory\HasOffsetValueType;
use PHPStan\Type\Accessory\NonEmptyArrayType;
use PHPStan\Type\IntersectionType;
use PHPStan\Type\MixedType;
use PHPStan\Type\Type;
final class HasOffsetTypeCorrector
{
/**
* HasOffsetType breaks array mixed type, so we better get rid of it
*/
public function correct(Type $type) : Type
{
if (!$type instanceof IntersectionType) {
return $type;
}
$clearTypes = [];
foreach ($type->getTypes() as $intersectionedType) {
if ($intersectionedType instanceof HasOffsetType) {
continue;
}
if ($intersectionedType instanceof NonEmptyArrayType) {
continue;
}
if ($intersectionedType instanceof HasOffsetValueType) {
continue;
}
$clearTypes[] = $intersectionedType;
}
if ($clearTypes === []) {
return new MixedType();
}
if (\count($clearTypes) === 1) {
return $clearTypes[0];
}
return new IntersectionType($clearTypes);
}
}

View File

@ -37,7 +37,6 @@ use Rector\NodeTypeResolver\Contract\NodeTypeResolverInterface;
use Rector\NodeTypeResolver\Node\AttributeKey;
use Rector\NodeTypeResolver\NodeTypeCorrector\AccessoryNonEmptyStringTypeCorrector;
use Rector\NodeTypeResolver\NodeTypeCorrector\GenericClassStringTypeCorrector;
use Rector\NodeTypeResolver\NodeTypeCorrector\HasOffsetTypeCorrector;
use Rector\StaticTypeMapper\ValueObject\Type\AliasedObjectType;
use Rector\StaticTypeMapper\ValueObject\Type\ShortenedObjectType;
use Rector\TypeDeclaration\PHPStan\ObjectTypeSpecifier;
@ -67,11 +66,6 @@ final class NodeTypeResolver
* @var \PHPStan\Reflection\ReflectionProvider
*/
private $reflectionProvider;
/**
* @readonly
* @var \Rector\NodeTypeResolver\NodeTypeCorrector\HasOffsetTypeCorrector
*/
private $hasOffsetTypeCorrector;
/**
* @readonly
* @var \Rector\NodeTypeResolver\NodeTypeCorrector\AccessoryNonEmptyStringTypeCorrector
@ -85,13 +79,12 @@ final class NodeTypeResolver
/**
* @param NodeTypeResolverInterface[] $nodeTypeResolvers
*/
public function __construct(ObjectTypeSpecifier $objectTypeSpecifier, ClassAnalyzer $classAnalyzer, GenericClassStringTypeCorrector $genericClassStringTypeCorrector, ReflectionProvider $reflectionProvider, HasOffsetTypeCorrector $hasOffsetTypeCorrector, AccessoryNonEmptyStringTypeCorrector $accessoryNonEmptyStringTypeCorrector, RenamedClassesDataCollector $renamedClassesDataCollector, array $nodeTypeResolvers)
public function __construct(ObjectTypeSpecifier $objectTypeSpecifier, ClassAnalyzer $classAnalyzer, GenericClassStringTypeCorrector $genericClassStringTypeCorrector, ReflectionProvider $reflectionProvider, AccessoryNonEmptyStringTypeCorrector $accessoryNonEmptyStringTypeCorrector, RenamedClassesDataCollector $renamedClassesDataCollector, array $nodeTypeResolvers)
{
$this->objectTypeSpecifier = $objectTypeSpecifier;
$this->classAnalyzer = $classAnalyzer;
$this->genericClassStringTypeCorrector = $genericClassStringTypeCorrector;
$this->reflectionProvider = $reflectionProvider;
$this->hasOffsetTypeCorrector = $hasOffsetTypeCorrector;
$this->accessoryNonEmptyStringTypeCorrector = $accessoryNonEmptyStringTypeCorrector;
$this->renamedClassesDataCollector = $renamedClassesDataCollector;
foreach ($nodeTypeResolvers as $nodeTypeResolver) {
@ -170,7 +163,7 @@ final class NodeTypeResolver
$scope = $node->getAttribute(AttributeKey::SCOPE);
$type = $this->objectTypeSpecifier->narrowToFullyQualifiedOrAliasedObjectType($node, $type, $scope);
}
return $this->hasOffsetTypeCorrector->correct($type);
return $type;
}
$scope = $node->getAttribute(AttributeKey::SCOPE);
if (!$scope instanceof Scope) {

View File

@ -19,12 +19,12 @@ final class VersionResolver
* @api
* @var string
*/
public const PACKAGE_VERSION = 'f554fe1a836dc1b7015cda99e7e71f5dbe46d731';
public const PACKAGE_VERSION = '8be7ac6830f0f7191af7118814c779da3ebd9b56';
/**
* @api
* @var string
*/
public const RELEASE_DATE = '2023-05-14 16:06:49';
public const RELEASE_DATE = '2023-05-14 15:10:26';
/**
* @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 ComposerAutoloaderInit2b5e133a8608fad05563699514f047d0::getLoader();
return ComposerAutoloaderInitf409d7ed844dd2e8d596405f268f1b97::getLoader();

View File

@ -1968,7 +1968,6 @@ return array(
'Rector\\NodeTypeResolver\\NodeScopeAndMetadataDecorator' => $baseDir . '/packages/NodeTypeResolver/NodeScopeAndMetadataDecorator.php',
'Rector\\NodeTypeResolver\\NodeTypeCorrector\\AccessoryNonEmptyStringTypeCorrector' => $baseDir . '/packages/NodeTypeResolver/NodeTypeCorrector/AccessoryNonEmptyStringTypeCorrector.php',
'Rector\\NodeTypeResolver\\NodeTypeCorrector\\GenericClassStringTypeCorrector' => $baseDir . '/packages/NodeTypeResolver/NodeTypeCorrector/GenericClassStringTypeCorrector.php',
'Rector\\NodeTypeResolver\\NodeTypeCorrector\\HasOffsetTypeCorrector' => $baseDir . '/packages/NodeTypeResolver/NodeTypeCorrector/HasOffsetTypeCorrector.php',
'Rector\\NodeTypeResolver\\NodeTypeResolver' => $baseDir . '/packages/NodeTypeResolver/NodeTypeResolver.php',
'Rector\\NodeTypeResolver\\NodeTypeResolver\\CastTypeResolver' => $baseDir . '/packages/NodeTypeResolver/NodeTypeResolver/CastTypeResolver.php',
'Rector\\NodeTypeResolver\\NodeTypeResolver\\ClassAndInterfaceTypeResolver' => $baseDir . '/packages/NodeTypeResolver/NodeTypeResolver/ClassAndInterfaceTypeResolver.php',

View File

@ -2,7 +2,7 @@
// autoload_real.php @generated by Composer
class ComposerAutoloaderInit2b5e133a8608fad05563699514f047d0
class ComposerAutoloaderInitf409d7ed844dd2e8d596405f268f1b97
{
private static $loader;
@ -22,17 +22,17 @@ class ComposerAutoloaderInit2b5e133a8608fad05563699514f047d0
return self::$loader;
}
spl_autoload_register(array('ComposerAutoloaderInit2b5e133a8608fad05563699514f047d0', 'loadClassLoader'), true, true);
spl_autoload_register(array('ComposerAutoloaderInitf409d7ed844dd2e8d596405f268f1b97', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
spl_autoload_unregister(array('ComposerAutoloaderInit2b5e133a8608fad05563699514f047d0', 'loadClassLoader'));
spl_autoload_unregister(array('ComposerAutoloaderInitf409d7ed844dd2e8d596405f268f1b97', 'loadClassLoader'));
require __DIR__ . '/autoload_static.php';
call_user_func(\Composer\Autoload\ComposerStaticInit2b5e133a8608fad05563699514f047d0::getInitializer($loader));
call_user_func(\Composer\Autoload\ComposerStaticInitf409d7ed844dd2e8d596405f268f1b97::getInitializer($loader));
$loader->setClassMapAuthoritative(true);
$loader->register(true);
$filesToLoad = \Composer\Autoload\ComposerStaticInit2b5e133a8608fad05563699514f047d0::$files;
$filesToLoad = \Composer\Autoload\ComposerStaticInitf409d7ed844dd2e8d596405f268f1b97::$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 ComposerStaticInit2b5e133a8608fad05563699514f047d0
class ComposerStaticInitf409d7ed844dd2e8d596405f268f1b97
{
public static $files = array (
'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php',
@ -2210,7 +2210,6 @@ class ComposerStaticInit2b5e133a8608fad05563699514f047d0
'Rector\\NodeTypeResolver\\NodeScopeAndMetadataDecorator' => __DIR__ . '/../..' . '/packages/NodeTypeResolver/NodeScopeAndMetadataDecorator.php',
'Rector\\NodeTypeResolver\\NodeTypeCorrector\\AccessoryNonEmptyStringTypeCorrector' => __DIR__ . '/../..' . '/packages/NodeTypeResolver/NodeTypeCorrector/AccessoryNonEmptyStringTypeCorrector.php',
'Rector\\NodeTypeResolver\\NodeTypeCorrector\\GenericClassStringTypeCorrector' => __DIR__ . '/../..' . '/packages/NodeTypeResolver/NodeTypeCorrector/GenericClassStringTypeCorrector.php',
'Rector\\NodeTypeResolver\\NodeTypeCorrector\\HasOffsetTypeCorrector' => __DIR__ . '/../..' . '/packages/NodeTypeResolver/NodeTypeCorrector/HasOffsetTypeCorrector.php',
'Rector\\NodeTypeResolver\\NodeTypeResolver' => __DIR__ . '/../..' . '/packages/NodeTypeResolver/NodeTypeResolver.php',
'Rector\\NodeTypeResolver\\NodeTypeResolver\\CastTypeResolver' => __DIR__ . '/../..' . '/packages/NodeTypeResolver/NodeTypeResolver/CastTypeResolver.php',
'Rector\\NodeTypeResolver\\NodeTypeResolver\\ClassAndInterfaceTypeResolver' => __DIR__ . '/../..' . '/packages/NodeTypeResolver/NodeTypeResolver/ClassAndInterfaceTypeResolver.php',
@ -3111,9 +3110,9 @@ class ComposerStaticInit2b5e133a8608fad05563699514f047d0
public static function getInitializer(ClassLoader $loader)
{
return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInit2b5e133a8608fad05563699514f047d0::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit2b5e133a8608fad05563699514f047d0::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit2b5e133a8608fad05563699514f047d0::$classMap;
$loader->prefixLengthsPsr4 = ComposerStaticInitf409d7ed844dd2e8d596405f268f1b97::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInitf409d7ed844dd2e8d596405f268f1b97::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInitf409d7ed844dd2e8d596405f268f1b97::$classMap;
}, null, ClassLoader::class);
}