mirror of https://github.com/rectorphp/rector.git
Updated Rector to commit 77258018af10a7c23477831e0eab49dd7c0b2bfe
77258018af
Trigger Rectify (#4701)
This commit is contained in:
parent
4cf14d6438
commit
ad2ad2a097
|
@ -3,10 +3,10 @@
|
|||
declare (strict_types=1);
|
||||
namespace Rector\NodeTypeResolver\NodeTypeResolver;
|
||||
|
||||
use PHPStan\Analyser\Scope;
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Name;
|
||||
use PhpParser\Node\Name\FullyQualified;
|
||||
use PHPStan\Analyser\Scope;
|
||||
use PHPStan\Reflection\ClassReflection;
|
||||
use PHPStan\Type\ArrayType;
|
||||
use PHPStan\Type\MixedType;
|
||||
|
@ -30,17 +30,6 @@ final class NameTypeResolver implements NodeTypeResolverInterface
|
|||
{
|
||||
return [Name::class, FullyQualified::class];
|
||||
}
|
||||
/**
|
||||
* @param \PhpParser\Node\Name|\PhpParser\Node\Name\FullyQualified $node
|
||||
*/
|
||||
private function resolveClassReflection($node) : ?ClassReflection
|
||||
{
|
||||
$scope = $node->getAttribute(AttributeKey::SCOPE);
|
||||
if (!$scope instanceof Scope) {
|
||||
return null;
|
||||
}
|
||||
return $scope->getClassReflection();
|
||||
}
|
||||
/**
|
||||
* @param Name $node
|
||||
*/
|
||||
|
@ -55,6 +44,17 @@ final class NameTypeResolver implements NodeTypeResolverInterface
|
|||
}
|
||||
return new ObjectType($fullyQualifiedName);
|
||||
}
|
||||
/**
|
||||
* @param \PhpParser\Node\Name|\PhpParser\Node\Name\FullyQualified $node
|
||||
*/
|
||||
private function resolveClassReflection($node) : ?ClassReflection
|
||||
{
|
||||
$scope = $node->getAttribute(AttributeKey::SCOPE);
|
||||
if (!$scope instanceof Scope) {
|
||||
return null;
|
||||
}
|
||||
return $scope->getClassReflection();
|
||||
}
|
||||
/**
|
||||
* @return \PHPStan\Type\MixedType|\PHPStan\Type\ObjectType|\PHPStan\Type\UnionType
|
||||
*/
|
||||
|
|
|
@ -58,6 +58,10 @@ final class ArrayTypeMapper implements TypeMapperInterface
|
|||
* @var string
|
||||
*/
|
||||
public const HAS_GENERIC_TYPE_PARENT = 'has_generic_type_parent';
|
||||
/**
|
||||
* @var \Rector\PHPStanStaticTypeMapper\PHPStanStaticTypeMapper
|
||||
*/
|
||||
private $phpStanStaticTypeMapper;
|
||||
public function __construct(UnionTypeCommonTypeNarrower $unionTypeCommonTypeNarrower, ReflectionProvider $reflectionProvider, GenericClassStringTypeNormalizer $genericClassStringTypeNormalizer, DetailedTypeAnalyzer $detailedTypeAnalyzer)
|
||||
{
|
||||
$this->unionTypeCommonTypeNarrower = $unionTypeCommonTypeNarrower;
|
||||
|
@ -65,10 +69,6 @@ final class ArrayTypeMapper implements TypeMapperInterface
|
|||
$this->genericClassStringTypeNormalizer = $genericClassStringTypeNormalizer;
|
||||
$this->detailedTypeAnalyzer = $detailedTypeAnalyzer;
|
||||
}
|
||||
/**
|
||||
* @var \Rector\PHPStanStaticTypeMapper\PHPStanStaticTypeMapper
|
||||
*/
|
||||
private $phpStanStaticTypeMapper;
|
||||
// To avoid circular dependency
|
||||
/**
|
||||
* @required
|
||||
|
|
|
@ -5,14 +5,14 @@ namespace Rector\StaticTypeMapper\PhpDocParser;
|
|||
|
||||
use PhpParser\Node;
|
||||
use PHPStan\Analyser\NameScope;
|
||||
use PHPStan\PhpDoc\TypeNodeResolver;
|
||||
use PHPStan\PhpDocParser\Ast\Type\IdentifierTypeNode;
|
||||
use PHPStan\PhpDocParser\Ast\Type\IntersectionTypeNode;
|
||||
use PHPStan\PhpDocParser\Ast\Type\TypeNode;
|
||||
use PHPStan\PhpDocParser\Ast\Type\UnionTypeNode;
|
||||
use PHPStan\Type\Type;
|
||||
use Rector\NodeTypeResolver\PHPStan\Type\TypeFactory;
|
||||
use Rector\StaticTypeMapper\Contract\PhpDocParser\PhpDocTypeMapperInterface;
|
||||
use PHPStan\PhpDoc\TypeNodeResolver;
|
||||
use PHPStan\PhpDocParser\Ast\Type\IntersectionTypeNode;
|
||||
/**
|
||||
* @implements PhpDocTypeMapperInterface<UnionTypeNode>
|
||||
*/
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
declare (strict_types=1);
|
||||
namespace Rector\VendorLocker\Exception;
|
||||
|
||||
final class UnresolvableClassException extends \Exception
|
||||
use Exception;
|
||||
final class UnresolvableClassException extends Exception
|
||||
{
|
||||
}
|
||||
|
|
|
@ -62,16 +62,23 @@ final class ParentClassMethodTypeOverrideGuard
|
|||
public function getParentClassMethod(ClassMethod $classMethod) : ?MethodReflection
|
||||
{
|
||||
try {
|
||||
$parentClassMethod = $this->resolveParentClassMethod($classMethod);
|
||||
return $parentClassMethod;
|
||||
return $this->resolveParentClassMethod($classMethod);
|
||||
} catch (UnresolvableClassException $exception) {
|
||||
// we don't know all involved parents.
|
||||
throw new ShouldNotHappenException('Unable to resolve involved class. You are likely missing hasParentClassMethod() before calling getParentClassMethod().');
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @throws UnresolvableClassException
|
||||
*/
|
||||
public function shouldSkipReturnTypeChange(ClassMethod $classMethod, Type $parentType) : bool
|
||||
{
|
||||
if ($classMethod->returnType === null) {
|
||||
return \false;
|
||||
}
|
||||
$currentReturnType = $this->staticTypeMapper->mapPhpParserNodePHPStanType($classMethod->returnType);
|
||||
if ($this->typeComparator->isSubtype($currentReturnType, $parentType)) {
|
||||
return \true;
|
||||
}
|
||||
return $this->typeComparator->areTypesEqual($currentReturnType, $parentType);
|
||||
}
|
||||
private function resolveParentClassMethod(ClassMethod $classMethod) : ?MethodReflection
|
||||
{
|
||||
$classReflection = $this->reflectionResolver->resolveClassReflection($classMethod);
|
||||
|
@ -109,15 +116,4 @@ final class ParentClassMethodTypeOverrideGuard
|
|||
$parentClassName = $this->privatesAccessor->getPrivateProperty($betterReflectionClass, 'parentClassName');
|
||||
return $parentClassName !== null;
|
||||
}
|
||||
public function shouldSkipReturnTypeChange(ClassMethod $classMethod, Type $parentType) : bool
|
||||
{
|
||||
if ($classMethod->returnType === null) {
|
||||
return \false;
|
||||
}
|
||||
$currentReturnType = $this->staticTypeMapper->mapPhpParserNodePHPStanType($classMethod->returnType);
|
||||
if ($this->typeComparator->isSubtype($currentReturnType, $parentType)) {
|
||||
return \true;
|
||||
}
|
||||
return $this->typeComparator->areTypesEqual($currentReturnType, $parentType);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,7 +20,6 @@ use PHPStan\Type\TypeWithClassName;
|
|||
use PHPStan\Type\UnionType;
|
||||
use Rector\Core\NodeAnalyzer\PropertyFetchAnalyzer;
|
||||
use Rector\Core\PhpParser\AstResolver;
|
||||
use Rector\Core\PhpParser\ClassLikeAstResolver;
|
||||
use Rector\Core\Reflection\ReflectionResolver;
|
||||
use Rector\NodeNameResolver\NodeNameResolver;
|
||||
use Rector\NodeTypeResolver\NodeTypeResolver;
|
||||
|
|
|
@ -15,7 +15,6 @@ use PhpParser\Node\Stmt\ClassMethod;
|
|||
use PhpParser\Node\Stmt\Property;
|
||||
use PHPStan\Reflection\ReflectionProvider;
|
||||
use Rector\Core\PhpParser\AstResolver;
|
||||
use Rector\Core\PhpParser\ClassLikeAstResolver;
|
||||
use Rector\NodeNameResolver\NodeNameResolver;
|
||||
use Rector\PhpAttribute\Enum\DocTagNodeState;
|
||||
final class PhpAttributeAnalyzer
|
||||
|
|
|
@ -15,7 +15,6 @@ use Rector\Core\Enum\ObjectReference;
|
|||
use Rector\Core\NodeAnalyzer\PropertyFetchAnalyzer;
|
||||
use Rector\Core\NodeManipulator\PropertyManipulator;
|
||||
use Rector\Core\PhpParser\AstResolver;
|
||||
use Rector\Core\PhpParser\ClassLikeAstResolver;
|
||||
use Rector\Core\PhpParser\Node\BetterNodeFinder;
|
||||
use Rector\Core\Util\Reflection\PrivatesAccessor;
|
||||
use Rector\NodeNameResolver\NodeNameResolver;
|
||||
|
|
|
@ -8,7 +8,6 @@ use PhpParser\Node\Stmt\Property;
|
|||
use PHPStan\Reflection\ClassReflection;
|
||||
use PHPStan\Type\Type;
|
||||
use Rector\Core\PhpParser\AstResolver;
|
||||
use Rector\Core\PhpParser\ClassLikeAstResolver;
|
||||
use Rector\NodeNameResolver\NodeNameResolver;
|
||||
use Rector\TypeDeclaration\TypeInferer\AssignToPropertyTypeInferer;
|
||||
final class AllAssignNodePropertyTypeInferer
|
||||
|
|
|
@ -19,12 +19,12 @@ final class VersionResolver
|
|||
* @api
|
||||
* @var string
|
||||
*/
|
||||
public const PACKAGE_VERSION = '493e4f89c9f9a033668301cd4eee4df7e77df0cb';
|
||||
public const PACKAGE_VERSION = '77258018af10a7c23477831e0eab49dd7c0b2bfe';
|
||||
/**
|
||||
* @api
|
||||
* @var string
|
||||
*/
|
||||
public const RELEASE_DATE = '2023-08-07 17:52:00';
|
||||
public const RELEASE_DATE = '2023-08-07 10:59:16';
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
|
|
|
@ -19,7 +19,6 @@ use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfo;
|
|||
use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory;
|
||||
use Rector\Core\NodeAnalyzer\PropertyFetchAnalyzer;
|
||||
use Rector\Core\PhpParser\AstResolver;
|
||||
use Rector\Core\PhpParser\ClassLikeAstResolver;
|
||||
use Rector\Core\PhpParser\Node\BetterNodeFinder;
|
||||
use Rector\Core\PhpParser\NodeFinder\PropertyFetchFinder;
|
||||
use Rector\Core\ValueObject\MethodName;
|
||||
|
|
|
@ -22,4 +22,4 @@ if (PHP_VERSION_ID < 50600) {
|
|||
|
||||
require_once __DIR__ . '/composer/autoload_real.php';
|
||||
|
||||
return ComposerAutoloaderInitd60879e03e03619f65217abab90852fe::getLoader();
|
||||
return ComposerAutoloaderInita4d07eec2414baf8f8ca642d6f63e446::getLoader();
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
// autoload_real.php @generated by Composer
|
||||
|
||||
class ComposerAutoloaderInitd60879e03e03619f65217abab90852fe
|
||||
class ComposerAutoloaderInita4d07eec2414baf8f8ca642d6f63e446
|
||||
{
|
||||
private static $loader;
|
||||
|
||||
|
@ -22,17 +22,17 @@ class ComposerAutoloaderInitd60879e03e03619f65217abab90852fe
|
|||
return self::$loader;
|
||||
}
|
||||
|
||||
spl_autoload_register(array('ComposerAutoloaderInitd60879e03e03619f65217abab90852fe', 'loadClassLoader'), true, true);
|
||||
spl_autoload_register(array('ComposerAutoloaderInita4d07eec2414baf8f8ca642d6f63e446', 'loadClassLoader'), true, true);
|
||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInitd60879e03e03619f65217abab90852fe', 'loadClassLoader'));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInita4d07eec2414baf8f8ca642d6f63e446', 'loadClassLoader'));
|
||||
|
||||
require __DIR__ . '/autoload_static.php';
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInitd60879e03e03619f65217abab90852fe::getInitializer($loader));
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInita4d07eec2414baf8f8ca642d6f63e446::getInitializer($loader));
|
||||
|
||||
$loader->setClassMapAuthoritative(true);
|
||||
$loader->register(true);
|
||||
|
||||
$filesToLoad = \Composer\Autoload\ComposerStaticInitd60879e03e03619f65217abab90852fe::$files;
|
||||
$filesToLoad = \Composer\Autoload\ComposerStaticInita4d07eec2414baf8f8ca642d6f63e446::$files;
|
||||
$requireFile = \Closure::bind(static function ($fileIdentifier, $file) {
|
||||
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
||||
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
namespace Composer\Autoload;
|
||||
|
||||
class ComposerStaticInitd60879e03e03619f65217abab90852fe
|
||||
class ComposerStaticInita4d07eec2414baf8f8ca642d6f63e446
|
||||
{
|
||||
public static $files = array (
|
||||
'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php',
|
||||
|
@ -3011,9 +3011,9 @@ class ComposerStaticInitd60879e03e03619f65217abab90852fe
|
|||
public static function getInitializer(ClassLoader $loader)
|
||||
{
|
||||
return \Closure::bind(function () use ($loader) {
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInitd60879e03e03619f65217abab90852fe::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInitd60879e03e03619f65217abab90852fe::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInitd60879e03e03619f65217abab90852fe::$classMap;
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInita4d07eec2414baf8f8ca642d6f63e446::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInita4d07eec2414baf8f8ca642d6f63e446::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInita4d07eec2414baf8f8ca642d6f63e446::$classMap;
|
||||
|
||||
}, null, ClassLoader::class);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue