Updated Rector to commit 83b13f530c9612a65ff921c994e7fa0cd29a21bf

83b13f530c Remove deprecated ParamTypeDeclarationRector, that treated docs as strict types to keep type declaration set reliable (#3111)
This commit is contained in:
Tomas Votruba 2022-11-27 23:28:48 +00:00
parent 997c77c140
commit d27ad935cb
18 changed files with 78 additions and 434 deletions

View File

@ -25,7 +25,6 @@ use Rector\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromStrictNewArrayRector
use Rector\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromStrictTypedPropertyRector;
use Rector\TypeDeclaration\Rector\Closure\AddClosureReturnTypeRector;
use Rector\TypeDeclaration\Rector\FunctionLike\AddParamTypeSplFixedArrayRector;
use Rector\TypeDeclaration\Rector\FunctionLike\ParamTypeDeclarationRector;
use Rector\TypeDeclaration\Rector\FunctionLike\ReturnTypeDeclarationRector;
use Rector\TypeDeclaration\Rector\Param\ParamTypeFromStrictTypedPropertyRector;
use Rector\TypeDeclaration\Rector\Property\PropertyTypeDeclarationRector;
@ -35,5 +34,5 @@ use Rector\TypeDeclaration\Rector\Property\TypedPropertyFromStrictGetterMethodRe
use Rector\TypeDeclaration\Rector\Property\TypedPropertyFromStrictSetUpRector;
use Rector\TypeDeclaration\Rector\Property\VarAnnotationIncorrectNullableRector;
return static function (RectorConfig $rectorConfig) : void {
$rectorConfig->rules([ParamTypeDeclarationRector::class, ReturnTypeDeclarationRector::class, PropertyTypeDeclarationRector::class, AddClosureReturnTypeRector::class, AddArrowFunctionReturnTypeRector::class, AddArrayParamDocTypeRector::class, AddArrayReturnDocTypeRector::class, ParamTypeByMethodCallTypeRector::class, TypedPropertyFromAssignsRector::class, ReturnAnnotationIncorrectNullableRector::class, VarAnnotationIncorrectNullableRector::class, ParamAnnotationIncorrectNullableRector::class, AddReturnTypeDeclarationBasedOnParentClassMethodRector::class, ReturnTypeFromStrictTypedPropertyRector::class, TypedPropertyFromStrictConstructorRector::class, ParamTypeFromStrictTypedPropertyRector::class, AddVoidReturnTypeWhereNoReturnRector::class, ReturnTypeFromReturnNewRector::class, TypedPropertyFromStrictGetterMethodReturnTypeRector::class, AddMethodCallBasedStrictParamTypeRector::class, ArrayShapeFromConstantArrayReturnRector::class, ReturnTypeFromStrictBoolReturnExprRector::class, ReturnTypeFromStrictNativeCallRector::class, ReturnTypeFromStrictNewArrayRector::class, ReturnTypeFromStrictScalarReturnExprRector::class, TypedPropertyFromStrictSetUpRector::class, ParamTypeByParentCallTypeRector::class, AddParamTypeSplFixedArrayRector::class, AddParamTypeBasedOnPHPUnitDataProviderRector::class, AddParamTypeFromPropertyTypeRector::class]);
$rectorConfig->rules([ReturnTypeDeclarationRector::class, PropertyTypeDeclarationRector::class, AddClosureReturnTypeRector::class, AddArrowFunctionReturnTypeRector::class, AddArrayParamDocTypeRector::class, AddArrayReturnDocTypeRector::class, ParamTypeByMethodCallTypeRector::class, TypedPropertyFromAssignsRector::class, ReturnAnnotationIncorrectNullableRector::class, VarAnnotationIncorrectNullableRector::class, ParamAnnotationIncorrectNullableRector::class, AddReturnTypeDeclarationBasedOnParentClassMethodRector::class, ReturnTypeFromStrictTypedPropertyRector::class, TypedPropertyFromStrictConstructorRector::class, ParamTypeFromStrictTypedPropertyRector::class, AddVoidReturnTypeWhereNoReturnRector::class, ReturnTypeFromReturnNewRector::class, TypedPropertyFromStrictGetterMethodReturnTypeRector::class, AddMethodCallBasedStrictParamTypeRector::class, ArrayShapeFromConstantArrayReturnRector::class, ReturnTypeFromStrictBoolReturnExprRector::class, ReturnTypeFromStrictNativeCallRector::class, ReturnTypeFromStrictNewArrayRector::class, ReturnTypeFromStrictScalarReturnExprRector::class, TypedPropertyFromStrictSetUpRector::class, ParamTypeByParentCallTypeRector::class, AddParamTypeSplFixedArrayRector::class, AddParamTypeBasedOnPHPUnitDataProviderRector::class, AddParamTypeFromPropertyTypeRector::class]);
};

View File

@ -9152,30 +9152,13 @@ Change `@param` types to type declarations if not a BC-break
- class: [`Rector\TypeDeclaration\Rector\FunctionLike\ParamTypeDeclarationRector`](../rules/TypeDeclaration/Rector/FunctionLike/ParamTypeDeclarationRector.php)
```diff
abstract class VendorParentClass
final class SomeClass
{
/**
* @param int $number
*/
public function keep($number)
{
}
}
final class ChildClass extends VendorParentClass
{
/**
* @param int $number
*/
public function keep($number)
{
}
- /**
- * @param int $number
- */
- public function change($number)
+ public function change(int $number)
- public function run($number)
+ public function run(int $number)
{
}
}

View File

@ -11,13 +11,11 @@ use PHPStan\Reflection\ParametersAcceptorSelector;
use PHPStan\Type\MixedType;
use PHPStan\Type\Type;
use Rector\Core\FileSystem\FilePathHelper;
use Rector\Core\PhpParser\AstResolver;
use Rector\Core\Reflection\ReflectionResolver;
use Rector\Core\ValueObject\MethodName;
use Rector\NodeNameResolver\NodeNameResolver;
use Rector\NodeTypeResolver\TypeComparator\TypeComparator;
use Rector\StaticTypeMapper\StaticTypeMapper;
use Rector\TypeDeclaration\TypeInferer\ParamTypeInferer;
final class ParentClassMethodTypeOverrideGuard
{
/**
@ -25,16 +23,6 @@ final class ParentClassMethodTypeOverrideGuard
* @var \Rector\NodeNameResolver\NodeNameResolver
*/
private $nodeNameResolver;
/**
* @readonly
* @var \Rector\Core\PhpParser\AstResolver
*/
private $astResolver;
/**
* @readonly
* @var \Rector\TypeDeclaration\TypeInferer\ParamTypeInferer
*/
private $paramTypeInferer;
/**
* @readonly
* @var \Rector\Core\Reflection\ReflectionResolver
@ -55,11 +43,9 @@ final class ParentClassMethodTypeOverrideGuard
* @var \Rector\Core\FileSystem\FilePathHelper
*/
private $filePathHelper;
public function __construct(NodeNameResolver $nodeNameResolver, AstResolver $astResolver, ParamTypeInferer $paramTypeInferer, ReflectionResolver $reflectionResolver, TypeComparator $typeComparator, StaticTypeMapper $staticTypeMapper, FilePathHelper $filePathHelper)
public function __construct(NodeNameResolver $nodeNameResolver, ReflectionResolver $reflectionResolver, TypeComparator $typeComparator, StaticTypeMapper $staticTypeMapper, FilePathHelper $filePathHelper)
{
$this->nodeNameResolver = $nodeNameResolver;
$this->astResolver = $astResolver;
$this->paramTypeInferer = $paramTypeInferer;
$this->reflectionResolver = $reflectionResolver;
$this->typeComparator = $typeComparator;
$this->staticTypeMapper = $staticTypeMapper;
@ -114,28 +100,6 @@ final class ParentClassMethodTypeOverrideGuard
{
return $this->getParentClassMethod($classMethod) instanceof MethodReflection;
}
public function hasParentClassMethodDifferentType(ClassMethod $classMethod, int $position, Type $currentType) : bool
{
if ($classMethod->isPrivate()) {
return \false;
}
$methodReflection = $this->getParentClassMethod($classMethod);
if (!$methodReflection instanceof MethodReflection) {
return \false;
}
$classMethod = $this->astResolver->resolveClassMethodFromMethodReflection($methodReflection);
if (!$classMethod instanceof ClassMethod) {
return \false;
}
if ($classMethod->isPrivate()) {
return \false;
}
if (!isset($classMethod->params[$position])) {
return \false;
}
$inferedType = $this->paramTypeInferer->inferParam($classMethod->params[$position]);
return \get_class($inferedType) !== \get_class($currentType);
}
public function getParentClassMethod(ClassMethod $classMethod) : ?MethodReflection
{
$classReflection = $this->reflectionResolver->resolveClassReflection($classMethod);

View File

@ -1,53 +0,0 @@
<?php
declare (strict_types=1);
namespace Rector\VendorLocker;
use PhpParser\Node\Stmt\ClassMethod;
use PhpParser\Node\Stmt\Function_;
use PhpParser\Node\Stmt\Property;
use Rector\VendorLocker\NodeVendorLocker\ClassMethodParamVendorLockResolver;
use Rector\VendorLocker\NodeVendorLocker\ClassMethodReturnVendorLockResolver;
use Rector\VendorLocker\NodeVendorLocker\PropertyTypeVendorLockResolver;
final class VendorLockResolver
{
/**
* @readonly
* @var \Rector\VendorLocker\NodeVendorLocker\ClassMethodParamVendorLockResolver
*/
private $classMethodParamVendorLockResolver;
/**
* @readonly
* @var \Rector\VendorLocker\NodeVendorLocker\ClassMethodReturnVendorLockResolver
*/
private $classMethodReturnVendorLockResolver;
/**
* @readonly
* @var \Rector\VendorLocker\NodeVendorLocker\PropertyTypeVendorLockResolver
*/
private $propertyTypeVendorLockResolver;
public function __construct(ClassMethodParamVendorLockResolver $classMethodParamVendorLockResolver, ClassMethodReturnVendorLockResolver $classMethodReturnVendorLockResolver, PropertyTypeVendorLockResolver $propertyTypeVendorLockResolver)
{
$this->classMethodParamVendorLockResolver = $classMethodParamVendorLockResolver;
$this->classMethodReturnVendorLockResolver = $classMethodReturnVendorLockResolver;
$this->propertyTypeVendorLockResolver = $propertyTypeVendorLockResolver;
}
/**
* @param \PhpParser\Node\Stmt\ClassMethod|\PhpParser\Node\Stmt\Function_ $node
*/
public function isClassMethodParamLockedIn($node) : bool
{
if (!$node instanceof ClassMethod) {
return \false;
}
return $this->classMethodParamVendorLockResolver->isVendorLocked($node);
}
public function isReturnChangeVendorLockedIn(ClassMethod $classMethod) : bool
{
return $this->classMethodReturnVendorLockResolver->isVendorLocked($classMethod);
}
public function isPropertyTypeChangeVendorLockedIn(Property $property) : bool
{
return $this->propertyTypeVendorLockResolver->isVendorLocked($property);
}
}

View File

@ -23,7 +23,7 @@ use Rector\Php74\TypeAnalyzer\ObjectTypeAnalyzer;
use Rector\PHPStanStaticTypeMapper\Enum\TypeKind;
use Rector\TypeDeclaration\AlreadyAssignDetector\ConstructorAssignDetector;
use Rector\TypeDeclaration\TypeInferer\VarDocPropertyTypeInferer;
use Rector\VendorLocker\VendorLockResolver;
use Rector\VendorLocker\NodeVendorLocker\PropertyTypeVendorLockResolver;
use Rector\VersionBonding\Contract\MinPhpVersionInterface;
use Symplify\RuleDocGenerator\ValueObject\CodeSample\ConfiguredCodeSample;
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
@ -32,6 +32,9 @@ use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
*
* @see \Rector\Tests\Php74\Rector\Property\TypedPropertyRector\TypedPropertyRectorTest
* @see \Rector\Tests\Php74\Rector\Property\TypedPropertyRector\ImportedTest
*
* @deprecated Moving doc types to type declarations is dangerous. Use specific strict types instead.
* This rule will be split info many small ones.
*/
final class TypedPropertyRector extends AbstractScopeAwareRector implements AllowEmptyConfigurableRectorInterface, MinPhpVersionInterface
{
@ -55,11 +58,6 @@ final class TypedPropertyRector extends AbstractScopeAwareRector implements Allo
* @var \Rector\TypeDeclaration\TypeInferer\VarDocPropertyTypeInferer
*/
private $varDocPropertyTypeInferer;
/**
* @readonly
* @var \Rector\VendorLocker\VendorLockResolver
*/
private $vendorLockResolver;
/**
* @readonly
* @var \Rector\DeadCode\PhpDoc\TagRemover\VarTagRemover
@ -85,15 +83,20 @@ final class TypedPropertyRector extends AbstractScopeAwareRector implements Allo
* @var \Rector\TypeDeclaration\AlreadyAssignDetector\ConstructorAssignDetector
*/
private $constructorAssignDetector;
public function __construct(VarDocPropertyTypeInferer $varDocPropertyTypeInferer, VendorLockResolver $vendorLockResolver, VarTagRemover $varTagRemover, FamilyRelationsAnalyzer $familyRelationsAnalyzer, ObjectTypeAnalyzer $objectTypeAnalyzer, MakePropertyTypedGuard $makePropertyTypedGuard, ConstructorAssignDetector $constructorAssignDetector)
/**
* @readonly
* @var \Rector\VendorLocker\NodeVendorLocker\PropertyTypeVendorLockResolver
*/
private $propertyTypeVendorLockResolver;
public function __construct(VarDocPropertyTypeInferer $varDocPropertyTypeInferer, VarTagRemover $varTagRemover, FamilyRelationsAnalyzer $familyRelationsAnalyzer, ObjectTypeAnalyzer $objectTypeAnalyzer, MakePropertyTypedGuard $makePropertyTypedGuard, ConstructorAssignDetector $constructorAssignDetector, PropertyTypeVendorLockResolver $propertyTypeVendorLockResolver)
{
$this->varDocPropertyTypeInferer = $varDocPropertyTypeInferer;
$this->vendorLockResolver = $vendorLockResolver;
$this->varTagRemover = $varTagRemover;
$this->familyRelationsAnalyzer = $familyRelationsAnalyzer;
$this->objectTypeAnalyzer = $objectTypeAnalyzer;
$this->makePropertyTypedGuard = $makePropertyTypedGuard;
$this->constructorAssignDetector = $constructorAssignDetector;
$this->propertyTypeVendorLockResolver = $propertyTypeVendorLockResolver;
}
public function configure(array $configuration) : void
{
@ -173,12 +176,12 @@ CODE_SAMPLE
}
// false positive
if (!$node instanceof Name) {
return $this->vendorLockResolver->isPropertyTypeChangeVendorLockedIn($property);
return $this->propertyTypeVendorLockResolver->isVendorLocked($property);
}
if ($this->isName($node, 'mixed')) {
return \true;
}
return $this->vendorLockResolver->isPropertyTypeChangeVendorLockedIn($property);
return $this->propertyTypeVendorLockResolver->isVendorLocked($property);
}
private function addDefaultValueNullForNullableType(Property $property, Type $propertyType) : void
{

View File

@ -1,14 +0,0 @@
<?php
declare (strict_types=1);
namespace Rector\TypeDeclaration\Contract\TypeInferer;
use PhpParser\Node\Param;
use PHPStan\Type\Type;
/**
* @deprecated This interface is not used anymore. Use the exact Rector rules instead.
*/
interface ParamTypeInfererInterface
{
public function inferParam(Param $param) : Type;
}

View File

@ -6,6 +6,10 @@ namespace Rector\TypeDeclaration\Contract\TypeInferer;
use PhpParser\Node\FunctionLike;
use PHPStan\Type\Type;
use Rector\TypeDeclaration\Contract\PriorityAwareInterface;
/**
* @deprecated These inferers are complex and work with non-reliable docblocks.
* Instead split them to specific rules that work with strict types.
*/
interface ReturnTypeInfererInterface extends PriorityAwareInterface
{
public function inferFunctionLike(FunctionLike $functionLike) : Type;

View File

@ -33,34 +33,17 @@ final class ControllerRenderMethodAnalyzer
$this->phpDocInfoFactory = $phpDocInfoFactory;
$this->reflectionResolver = $reflectionResolver;
}
/**
* @api
*/
public function isRenderMethod(ClassMethod $classMethod) : bool
{
// nette one?
$classReflection = $this->reflectionResolver->resolveClassReflection($classMethod);
if (!$classReflection instanceof ClassReflection) {
return \false;
}
if ($this->isNetteRenderMethod($classReflection, $classMethod)) {
return \true;
}
return $this->isSymfonyRenderMethod($classReflection, $classMethod);
}
private function isNetteRenderMethod(ClassReflection $classReflection, ClassMethod $classMethod) : bool
{
if (!$classReflection->isSubclassOf('Nette\\Application\\UI\\Control')) {
return \false;
}
if (!$classMethod->isPublic()) {
return \false;
}
$classMethodName = $classMethod->name->toString();
foreach (['render', 'handle', 'action'] as $methodPrefix) {
if (\strncmp($classMethodName, $methodPrefix, \strlen($methodPrefix)) === 0) {
return \true;
}
}
return \false;
}
private function isSymfonyRenderMethod(ClassReflection $classReflection, ClassMethod $classMethod) : bool
{
if (!$classReflection->isSubclassOf('Symfony\\Bundle\\FrameworkBundle\\Controller\\Controller') && !$classReflection->isSubclassOf('Symfony\\Bundle\\FrameworkBundle\\Controller\\AbstractController')) {

View File

@ -1,39 +0,0 @@
<?php
declare (strict_types=1);
namespace Rector\TypeDeclaration\NodeTypeAnalyzer;
use PHPStan\Reflection\ReflectionProvider;
use PHPStan\Type\Type;
use PHPStan\Type\TypeWithClassName;
use Rector\NodeTypeResolver\NodeTypeResolver;
final class TraitTypeAnalyzer
{
/**
* @readonly
* @var \Rector\NodeTypeResolver\NodeTypeResolver
*/
private $nodeTypeResolver;
/**
* @readonly
* @var \PHPStan\Reflection\ReflectionProvider
*/
private $reflectionProvider;
public function __construct(NodeTypeResolver $nodeTypeResolver, ReflectionProvider $reflectionProvider)
{
$this->nodeTypeResolver = $nodeTypeResolver;
$this->reflectionProvider = $reflectionProvider;
}
public function isTraitType(Type $type) : bool
{
if (!$type instanceof TypeWithClassName) {
return \false;
}
$fullyQualifiedName = $this->nodeTypeResolver->getFullyQualifiedClassName($type);
if (!$this->reflectionProvider->hasClass($fullyQualifiedName)) {
return \false;
}
$classReflection = $this->reflectionProvider->getClass($fullyQualifiedName);
return $classReflection->isTrait();
}
}

View File

@ -4,83 +4,17 @@ declare (strict_types=1);
namespace Rector\TypeDeclaration\Rector\FunctionLike;
use PhpParser\Node;
use PhpParser\Node\Name\FullyQualified;
use PhpParser\Node\Param;
use PhpParser\Node\Stmt\ClassMethod;
use PhpParser\Node\Stmt\Function_;
use PhpParser\Node\Stmt\Interface_;
use PHPStan\Type\MixedType;
use PHPStan\Type\ObjectType;
use PHPStan\Type\UnionType;
use Rector\Core\Rector\AbstractRector;
use Rector\Core\ValueObject\PhpVersionFeature;
use Rector\DeadCode\PhpDoc\TagRemover\ParamTagRemover;
use Rector\NodeTypeResolver\Node\AttributeKey;
use Rector\PHPStanStaticTypeMapper\Enum\TypeKind;
use Rector\StaticTypeMapper\ValueObject\Type\NonExistingObjectType;
use Rector\TypeDeclaration\NodeAnalyzer\ControllerRenderMethodAnalyzer;
use Rector\TypeDeclaration\NodeTypeAnalyzer\TraitTypeAnalyzer;
use Rector\TypeDeclaration\TypeInferer\ParamTypeInferer;
use Rector\VendorLocker\ParentClassMethodTypeOverrideGuard;
use Rector\VendorLocker\VendorLockResolver;
use Rector\VersionBonding\Contract\MinPhpVersionInterface;
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
/**
* @changelog https://wiki.php.net/rfc/scalar_type_hints_v5
* @changelog https://github.com/nikic/TypeUtil
* @changelog https://github.com/nette/type-fixer
* @changelog https://github.com/FriendsOfPHP/PHP-CS-Fixer/issues/3258
*
* @see \Rector\Tests\TypeDeclaration\Rector\FunctionLike\ParamTypeDeclarationRector\ParamTypeDeclarationRectorTest
*
* @deprecated Use specific rules to infer params instead. This rule will be split info many small ones.
* @deprecated Moving doc types to type declarations is dangerous. Use specific strict type inferers instead.
* Use specific rules to infer params instead. This rule will be split info many small ones.
*/
final class ParamTypeDeclarationRector extends AbstractRector implements MinPhpVersionInterface
final class ParamTypeDeclarationRector extends AbstractRector
{
/**
* @var bool
*/
private $hasChanged = \false;
/**
* @readonly
* @var \Rector\VendorLocker\VendorLockResolver
*/
private $vendorLockResolver;
/**
* @readonly
* @var \Rector\TypeDeclaration\TypeInferer\ParamTypeInferer
*/
private $paramTypeInferer;
/**
* @readonly
* @var \Rector\TypeDeclaration\NodeTypeAnalyzer\TraitTypeAnalyzer
*/
private $traitTypeAnalyzer;
/**
* @readonly
* @var \Rector\DeadCode\PhpDoc\TagRemover\ParamTagRemover
*/
private $paramTagRemover;
/**
* @readonly
* @var \Rector\VendorLocker\ParentClassMethodTypeOverrideGuard
*/
private $parentClassMethodTypeOverrideGuard;
/**
* @readonly
* @var \Rector\TypeDeclaration\NodeAnalyzer\ControllerRenderMethodAnalyzer
*/
private $controllerRenderMethodAnalyzer;
public function __construct(VendorLockResolver $vendorLockResolver, ParamTypeInferer $paramTypeInferer, TraitTypeAnalyzer $traitTypeAnalyzer, ParamTagRemover $paramTagRemover, ParentClassMethodTypeOverrideGuard $parentClassMethodTypeOverrideGuard, ControllerRenderMethodAnalyzer $controllerRenderMethodAnalyzer)
{
$this->vendorLockResolver = $vendorLockResolver;
$this->paramTypeInferer = $paramTypeInferer;
$this->traitTypeAnalyzer = $traitTypeAnalyzer;
$this->paramTagRemover = $paramTagRemover;
$this->parentClassMethodTypeOverrideGuard = $parentClassMethodTypeOverrideGuard;
$this->controllerRenderMethodAnalyzer = $controllerRenderMethodAnalyzer;
}
/**
* @return array<class-string<Node>>
*/
@ -92,54 +26,20 @@ final class ParamTypeDeclarationRector extends AbstractRector implements MinPhpV
public function getRuleDefinition() : RuleDefinition
{
return new RuleDefinition('Change @param types to type declarations if not a BC-break', [new CodeSample(<<<'CODE_SAMPLE'
abstract class VendorParentClass
final class SomeClass
{
/**
* @param int $number
*/
public function keep($number)
{
}
}
final class ChildClass extends VendorParentClass
{
/**
* @param int $number
*/
public function keep($number)
{
}
/**
* @param int $number
*/
public function change($number)
public function run($number)
{
}
}
CODE_SAMPLE
, <<<'CODE_SAMPLE'
abstract class VendorParentClass
final class SomeClass
{
/**
* @param int $number
*/
public function keep($number)
{
}
}
final class ChildClass extends VendorParentClass
{
/**
* @param int $number
*/
public function keep($number)
{
}
public function change(int $number)
public function run(int $number)
{
}
}
@ -151,84 +51,8 @@ CODE_SAMPLE
*/
public function refactor(Node $node) : ?Node
{
$this->hasChanged = \false;
if ($node->params === []) {
return null;
}
if ($node instanceof ClassMethod && $this->controllerRenderMethodAnalyzer->isRenderMethod($node)) {
return null;
}
foreach ($node->params as $position => $param) {
$this->refactorParam($param, $position, $node);
}
if ($this->hasChanged) {
return $node;
}
\trigger_error('Use specific rules to infer params instead. This rule will was split info many small ones.', \E_ERROR);
\sleep(3);
return null;
}
public function provideMinPhpVersion() : int
{
return PhpVersionFeature::SCALAR_TYPES;
}
/**
* @param \PhpParser\Node\Stmt\ClassMethod|\PhpParser\Node\Stmt\Function_ $functionLike
*/
private function refactorParam(Param $param, int $position, $functionLike) : void
{
if ($this->shouldSkipParam($param, $functionLike)) {
return;
}
$inferedType = $this->paramTypeInferer->inferParam($param);
if ($inferedType instanceof MixedType) {
return;
}
// mixed type cannot be part of union
if ($inferedType instanceof UnionType && $inferedType->isSuperTypeOf(new MixedType())->yes()) {
return;
}
if ($inferedType instanceof NonExistingObjectType) {
return;
}
if ($this->traitTypeAnalyzer->isTraitType($inferedType)) {
return;
}
$paramTypeNode = $this->staticTypeMapper->mapPHPStanTypeToPhpParserNode($inferedType, TypeKind::PARAM);
if (!$paramTypeNode instanceof Node) {
return;
}
$parentNode = $functionLike->getAttribute(AttributeKey::PARENT_NODE);
if ($parentNode instanceof Interface_ && $parentNode->extends !== []) {
return;
}
if ($functionLike instanceof ClassMethod && $this->parentClassMethodTypeOverrideGuard->hasParentClassMethodDifferentType($functionLike, $position, $inferedType)) {
return;
}
$param->type = $paramTypeNode;
$functionLikePhpDocInfo = $this->phpDocInfoFactory->createFromNodeOrEmpty($functionLike);
$this->paramTagRemover->removeParamTagsIfUseless($functionLikePhpDocInfo, $functionLike);
$this->hasChanged = \true;
}
/**
* @param \PhpParser\Node\Stmt\ClassMethod|\PhpParser\Node\Stmt\Function_ $functionLike
*/
private function shouldSkipParam(Param $param, $functionLike) : bool
{
if ($param->variadic) {
return \true;
}
if ($this->vendorLockResolver->isClassMethodParamLockedIn($functionLike)) {
return \true;
}
// is nette return type?
$returnType = $functionLike->returnType;
if ($returnType instanceof FullyQualified) {
$objectType = new ObjectType('Nette\\Application\\UI\\Control');
$returnObjectType = $this->staticTypeMapper->mapPhpParserNodePHPStanType($returnType);
if ($objectType->isSuperTypeOf($returnObjectType)->yes()) {
return \true;
}
}
// no type → check it
return $param->type !== null;
}
}

View File

@ -28,7 +28,7 @@ use Rector\TypeDeclaration\TypeAnalyzer\ObjectTypeComparator;
use Rector\TypeDeclaration\TypeInferer\ReturnTypeInferer;
use Rector\TypeDeclaration\TypeInferer\ReturnTypeInferer\ReturnTypeDeclarationReturnTypeInfererTypeInferer;
use Rector\VendorLocker\NodeVendorLocker\ClassMethodReturnTypeOverrideGuard;
use Rector\VendorLocker\VendorLockResolver;
use Rector\VendorLocker\NodeVendorLocker\ClassMethodReturnVendorLockResolver;
use Rector\VersionBonding\Contract\MinPhpVersionInterface;
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
@ -36,6 +36,9 @@ use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
* @changelog https://wiki.php.net/rfc/scalar_type_hints_v5
*
* @see \Rector\Tests\TypeDeclaration\Rector\FunctionLike\ReturnTypeDeclarationRector\ReturnTypeDeclarationRectorTest
*
* @deprecated Moving doc types to type declarations is dangerous. Use specific strict types instead.
* This rule will be split info many small ones.
*/
final class ReturnTypeDeclarationRector extends AbstractRector implements MinPhpVersionInterface
{
@ -59,11 +62,6 @@ final class ReturnTypeDeclarationRector extends AbstractRector implements MinPhp
* @var \Rector\VendorLocker\NodeVendorLocker\ClassMethodReturnTypeOverrideGuard
*/
private $classMethodReturnTypeOverrideGuard;
/**
* @readonly
* @var \Rector\VendorLocker\VendorLockResolver
*/
private $vendorLockResolver;
/**
* @readonly
* @var \Rector\TypeDeclaration\PhpParserTypeAnalyzer
@ -79,16 +77,21 @@ final class ReturnTypeDeclarationRector extends AbstractRector implements MinPhp
* @var \Rector\Core\Php\PhpVersionProvider
*/
private $phpVersionProvider;
public function __construct(ReturnTypeInferer $returnTypeInferer, ReturnTypeAlreadyAddedChecker $returnTypeAlreadyAddedChecker, NonInformativeReturnTagRemover $nonInformativeReturnTagRemover, ClassMethodReturnTypeOverrideGuard $classMethodReturnTypeOverrideGuard, VendorLockResolver $vendorLockResolver, PhpParserTypeAnalyzer $phpParserTypeAnalyzer, ObjectTypeComparator $objectTypeComparator, PhpVersionProvider $phpVersionProvider)
/**
* @readonly
* @var \Rector\VendorLocker\NodeVendorLocker\ClassMethodReturnVendorLockResolver
*/
private $classMethodReturnVendorLockResolver;
public function __construct(ReturnTypeInferer $returnTypeInferer, ReturnTypeAlreadyAddedChecker $returnTypeAlreadyAddedChecker, NonInformativeReturnTagRemover $nonInformativeReturnTagRemover, ClassMethodReturnTypeOverrideGuard $classMethodReturnTypeOverrideGuard, PhpParserTypeAnalyzer $phpParserTypeAnalyzer, ObjectTypeComparator $objectTypeComparator, PhpVersionProvider $phpVersionProvider, ClassMethodReturnVendorLockResolver $classMethodReturnVendorLockResolver)
{
$this->returnTypeInferer = $returnTypeInferer;
$this->returnTypeAlreadyAddedChecker = $returnTypeAlreadyAddedChecker;
$this->nonInformativeReturnTagRemover = $nonInformativeReturnTagRemover;
$this->classMethodReturnTypeOverrideGuard = $classMethodReturnTypeOverrideGuard;
$this->vendorLockResolver = $vendorLockResolver;
$this->phpParserTypeAnalyzer = $phpParserTypeAnalyzer;
$this->objectTypeComparator = $objectTypeComparator;
$this->phpVersionProvider = $phpVersionProvider;
$this->classMethodReturnVendorLockResolver = $classMethodReturnVendorLockResolver;
}
/**
* @return array<class-string<Node>>
@ -180,7 +183,7 @@ CODE_SAMPLE
if ($this->classMethodReturnTypeOverrideGuard->shouldSkipClassMethod($classMethod)) {
return \true;
}
return $this->vendorLockResolver->isReturnChangeVendorLockedIn($classMethod);
return $this->classMethodReturnVendorLockResolver->isVendorLocked($classMethod);
}
/**
* @param \PhpParser\Node\Stmt\ClassMethod|\PhpParser\Node\Stmt\Function_ $functionLike
@ -201,7 +204,7 @@ CODE_SAMPLE
if ($functionLike->returnType === null) {
return \false;
}
if ($functionLike instanceof ClassMethod && $this->vendorLockResolver->isReturnChangeVendorLockedIn($functionLike)) {
if ($functionLike instanceof ClassMethod && $this->classMethodReturnVendorLockResolver->isVendorLocked($functionLike)) {
return \true;
}
$currentType = $this->staticTypeMapper->mapPhpParserNodePHPStanType($functionLike->returnType);

View File

@ -8,8 +8,8 @@ use PhpParser\Node\Param;
use PHPStan\Type\MixedType;
use PHPStan\Type\Type;
use Rector\NodeTypeResolver\NodeTypeResolver;
use Rector\TypeDeclaration\Contract\TypeInferer\ParamTypeInfererInterface;
use Rector\TypeDeclaration\TypeAnalyzer\GenericClassStringTypeNormalizer;
use Rector\TypeDeclaration\TypeInferer\ParamTypeInferer\FunctionLikeDocParamTypeInferer;
final class ParamTypeInferer
{
/**
@ -18,40 +18,34 @@ final class ParamTypeInferer
*/
private $genericClassStringTypeNormalizer;
/**
* @var ParamTypeInfererInterface[]
* @readonly
* @var \Rector\TypeDeclaration\TypeInferer\ParamTypeInferer\FunctionLikeDocParamTypeInferer
*/
private $paramTypeInferers;
private $functionLikeDocParamTypeInferer;
/**
* @readonly
* @var \Rector\NodeTypeResolver\NodeTypeResolver
*/
private $nodeTypeResolver;
/**
* @param ParamTypeInfererInterface[] $paramTypeInferers
*/
public function __construct(GenericClassStringTypeNormalizer $genericClassStringTypeNormalizer, array $paramTypeInferers, NodeTypeResolver $nodeTypeResolver)
public function __construct(GenericClassStringTypeNormalizer $genericClassStringTypeNormalizer, FunctionLikeDocParamTypeInferer $functionLikeDocParamTypeInferer, NodeTypeResolver $nodeTypeResolver)
{
$this->genericClassStringTypeNormalizer = $genericClassStringTypeNormalizer;
$this->paramTypeInferers = $paramTypeInferers;
$this->functionLikeDocParamTypeInferer = $functionLikeDocParamTypeInferer;
$this->nodeTypeResolver = $nodeTypeResolver;
}
public function inferParam(Param $param) : Type
{
foreach ($this->paramTypeInferers as $paramTypeInferer) {
$paramType = $paramTypeInferer->inferParam($param);
if ($paramType instanceof MixedType) {
continue;
}
$inferedType = $this->genericClassStringTypeNormalizer->normalize($paramType);
if ($param->default instanceof Node) {
$paramDefaultType = $this->nodeTypeResolver->getType($param->default);
if (!$paramDefaultType instanceof $inferedType) {
return new MixedType();
}
}
return $inferedType;
$paramType = $this->functionLikeDocParamTypeInferer->inferParam($param);
if ($paramType instanceof MixedType) {
return new MixedType();
}
return new MixedType();
$inferedType = $this->genericClassStringTypeNormalizer->normalize($paramType);
if ($param->default instanceof Node) {
$paramDefaultType = $this->nodeTypeResolver->getType($param->default);
if (!$paramDefaultType instanceof $inferedType) {
return new MixedType();
}
}
return $inferedType;
}
}

View File

@ -13,8 +13,7 @@ use PHPStan\Type\Type;
use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory;
use Rector\Core\PhpParser\Node\BetterNodeFinder;
use Rector\NodeNameResolver\NodeNameResolver;
use Rector\TypeDeclaration\Contract\TypeInferer\ParamTypeInfererInterface;
final class FunctionLikeDocParamTypeInferer implements ParamTypeInfererInterface
final class FunctionLikeDocParamTypeInferer
{
/**
* @readonly

View File

@ -17,12 +17,12 @@ final class VersionResolver
* @api
* @var string
*/
public const PACKAGE_VERSION = '0d8c29645d2beaf5e0c1b96215628e5bae16c7f5';
public const PACKAGE_VERSION = '83b13f530c9612a65ff921c994e7fa0cd29a21bf';
/**
* @api
* @var string
*/
public const RELEASE_DATE = '2022-11-27 23:58:54';
public const RELEASE_DATE = '2022-11-27 23:24:44';
/**
* @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 ComposerAutoloaderInit9a055792afbc031cf4fb8034f35e29e2::getLoader();
return ComposerAutoloaderInit52de9b4294aee6ed7dc3a6bd6f0e5143::getLoader();

View File

@ -2662,7 +2662,6 @@ return array(
'Rector\\TypeDeclaration\\AlreadyAssignDetector\\PropertyDefaultAssignDetector' => $baseDir . '/rules/TypeDeclaration/AlreadyAssignDetector/PropertyDefaultAssignDetector.php',
'Rector\\TypeDeclaration\\Contract\\PHPStan\\TypeWithClassTypeSpecifierInterface' => $baseDir . '/rules/TypeDeclaration/Contract/PHPStan/TypeWithClassTypeSpecifierInterface.php',
'Rector\\TypeDeclaration\\Contract\\PriorityAwareInterface' => $baseDir . '/rules/TypeDeclaration/Contract/PriorityAwareInterface.php',
'Rector\\TypeDeclaration\\Contract\\TypeInferer\\ParamTypeInfererInterface' => $baseDir . '/rules/TypeDeclaration/Contract/TypeInferer/ParamTypeInfererInterface.php',
'Rector\\TypeDeclaration\\Contract\\TypeInferer\\ReturnTypeInfererInterface' => $baseDir . '/rules/TypeDeclaration/Contract/TypeInferer/ReturnTypeInfererInterface.php',
'Rector\\TypeDeclaration\\Exception\\ConflictingPriorityException' => $baseDir . '/rules/TypeDeclaration/Exception/ConflictingPriorityException.php',
'Rector\\TypeDeclaration\\FunctionLikeReturnTypeResolver' => $baseDir . '/rules/TypeDeclaration/FunctionLikeReturnTypeResolver.php',
@ -2687,7 +2686,6 @@ return array(
'Rector\\TypeDeclaration\\NodeAnalyzer\\ReturnTypeAnalyzer\\StrictScalarReturnTypeAnalyzer' => $baseDir . '/rules/TypeDeclaration/NodeAnalyzer/ReturnTypeAnalyzer/StrictScalarReturnTypeAnalyzer.php',
'Rector\\TypeDeclaration\\NodeTypeAnalyzer\\DetailedTypeAnalyzer' => $baseDir . '/rules/TypeDeclaration/NodeTypeAnalyzer/DetailedTypeAnalyzer.php',
'Rector\\TypeDeclaration\\NodeTypeAnalyzer\\PropertyTypeDecorator' => $baseDir . '/rules/TypeDeclaration/NodeTypeAnalyzer/PropertyTypeDecorator.php',
'Rector\\TypeDeclaration\\NodeTypeAnalyzer\\TraitTypeAnalyzer' => $baseDir . '/rules/TypeDeclaration/NodeTypeAnalyzer/TraitTypeAnalyzer.php',
'Rector\\TypeDeclaration\\PHPStan\\ObjectTypeSpecifier' => $baseDir . '/rules/TypeDeclaration/PHPStan/ObjectTypeSpecifier.php',
'Rector\\TypeDeclaration\\PHPStan\\TypeSpecifier\\SameNamespacedTypeSpecifier' => $baseDir . '/rules/TypeDeclaration/PHPStan/TypeSpecifier/SameNamespacedTypeSpecifier.php',
'Rector\\TypeDeclaration\\PHPStan\\TypeSpecifier\\SelfStaticParentTypeSpecifier' => $baseDir . '/rules/TypeDeclaration/PHPStan/TypeSpecifier/SelfStaticParentTypeSpecifier.php',
@ -2763,7 +2761,6 @@ return array(
'Rector\\VendorLocker\\NodeVendorLocker\\ClassMethodReturnVendorLockResolver' => $baseDir . '/packages/VendorLocker/NodeVendorLocker/ClassMethodReturnVendorLockResolver.php',
'Rector\\VendorLocker\\NodeVendorLocker\\PropertyTypeVendorLockResolver' => $baseDir . '/packages/VendorLocker/NodeVendorLocker/PropertyTypeVendorLockResolver.php',
'Rector\\VendorLocker\\ParentClassMethodTypeOverrideGuard' => $baseDir . '/packages/VendorLocker/ParentClassMethodTypeOverrideGuard.php',
'Rector\\VendorLocker\\VendorLockResolver' => $baseDir . '/packages/VendorLocker/VendorLockResolver.php',
'Rector\\VersionBonding\\Contract\\MinPhpVersionInterface' => $baseDir . '/packages/VersionBonding/Contract/MinPhpVersionInterface.php',
'Rector\\VersionBonding\\PhpVersionedFilter' => $baseDir . '/packages/VersionBonding/PhpVersionedFilter.php',
'Rector\\Visibility\\Rector\\ClassConst\\ChangeConstantVisibilityRector' => $baseDir . '/rules/Visibility/Rector/ClassConst/ChangeConstantVisibilityRector.php',

View File

@ -2,7 +2,7 @@
// autoload_real.php @generated by Composer
class ComposerAutoloaderInit9a055792afbc031cf4fb8034f35e29e2
class ComposerAutoloaderInit52de9b4294aee6ed7dc3a6bd6f0e5143
{
private static $loader;
@ -22,19 +22,19 @@ class ComposerAutoloaderInit9a055792afbc031cf4fb8034f35e29e2
return self::$loader;
}
spl_autoload_register(array('ComposerAutoloaderInit9a055792afbc031cf4fb8034f35e29e2', 'loadClassLoader'), true, true);
spl_autoload_register(array('ComposerAutoloaderInit52de9b4294aee6ed7dc3a6bd6f0e5143', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
spl_autoload_unregister(array('ComposerAutoloaderInit9a055792afbc031cf4fb8034f35e29e2', 'loadClassLoader'));
spl_autoload_unregister(array('ComposerAutoloaderInit52de9b4294aee6ed7dc3a6bd6f0e5143', 'loadClassLoader'));
require __DIR__ . '/autoload_static.php';
call_user_func(\Composer\Autoload\ComposerStaticInit9a055792afbc031cf4fb8034f35e29e2::getInitializer($loader));
call_user_func(\Composer\Autoload\ComposerStaticInit52de9b4294aee6ed7dc3a6bd6f0e5143::getInitializer($loader));
$loader->setClassMapAuthoritative(true);
$loader->register(true);
$includeFiles = \Composer\Autoload\ComposerStaticInit9a055792afbc031cf4fb8034f35e29e2::$files;
$includeFiles = \Composer\Autoload\ComposerStaticInit52de9b4294aee6ed7dc3a6bd6f0e5143::$files;
foreach ($includeFiles as $fileIdentifier => $file) {
composerRequire9a055792afbc031cf4fb8034f35e29e2($fileIdentifier, $file);
composerRequire52de9b4294aee6ed7dc3a6bd6f0e5143($fileIdentifier, $file);
}
return $loader;
@ -46,7 +46,7 @@ class ComposerAutoloaderInit9a055792afbc031cf4fb8034f35e29e2
* @param string $file
* @return void
*/
function composerRequire9a055792afbc031cf4fb8034f35e29e2($fileIdentifier, $file)
function composerRequire52de9b4294aee6ed7dc3a6bd6f0e5143($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 ComposerStaticInit9a055792afbc031cf4fb8034f35e29e2
class ComposerStaticInit52de9b4294aee6ed7dc3a6bd6f0e5143
{
public static $files = array (
'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php',
@ -2907,7 +2907,6 @@ class ComposerStaticInit9a055792afbc031cf4fb8034f35e29e2
'Rector\\TypeDeclaration\\AlreadyAssignDetector\\PropertyDefaultAssignDetector' => __DIR__ . '/../..' . '/rules/TypeDeclaration/AlreadyAssignDetector/PropertyDefaultAssignDetector.php',
'Rector\\TypeDeclaration\\Contract\\PHPStan\\TypeWithClassTypeSpecifierInterface' => __DIR__ . '/../..' . '/rules/TypeDeclaration/Contract/PHPStan/TypeWithClassTypeSpecifierInterface.php',
'Rector\\TypeDeclaration\\Contract\\PriorityAwareInterface' => __DIR__ . '/../..' . '/rules/TypeDeclaration/Contract/PriorityAwareInterface.php',
'Rector\\TypeDeclaration\\Contract\\TypeInferer\\ParamTypeInfererInterface' => __DIR__ . '/../..' . '/rules/TypeDeclaration/Contract/TypeInferer/ParamTypeInfererInterface.php',
'Rector\\TypeDeclaration\\Contract\\TypeInferer\\ReturnTypeInfererInterface' => __DIR__ . '/../..' . '/rules/TypeDeclaration/Contract/TypeInferer/ReturnTypeInfererInterface.php',
'Rector\\TypeDeclaration\\Exception\\ConflictingPriorityException' => __DIR__ . '/../..' . '/rules/TypeDeclaration/Exception/ConflictingPriorityException.php',
'Rector\\TypeDeclaration\\FunctionLikeReturnTypeResolver' => __DIR__ . '/../..' . '/rules/TypeDeclaration/FunctionLikeReturnTypeResolver.php',
@ -2932,7 +2931,6 @@ class ComposerStaticInit9a055792afbc031cf4fb8034f35e29e2
'Rector\\TypeDeclaration\\NodeAnalyzer\\ReturnTypeAnalyzer\\StrictScalarReturnTypeAnalyzer' => __DIR__ . '/../..' . '/rules/TypeDeclaration/NodeAnalyzer/ReturnTypeAnalyzer/StrictScalarReturnTypeAnalyzer.php',
'Rector\\TypeDeclaration\\NodeTypeAnalyzer\\DetailedTypeAnalyzer' => __DIR__ . '/../..' . '/rules/TypeDeclaration/NodeTypeAnalyzer/DetailedTypeAnalyzer.php',
'Rector\\TypeDeclaration\\NodeTypeAnalyzer\\PropertyTypeDecorator' => __DIR__ . '/../..' . '/rules/TypeDeclaration/NodeTypeAnalyzer/PropertyTypeDecorator.php',
'Rector\\TypeDeclaration\\NodeTypeAnalyzer\\TraitTypeAnalyzer' => __DIR__ . '/../..' . '/rules/TypeDeclaration/NodeTypeAnalyzer/TraitTypeAnalyzer.php',
'Rector\\TypeDeclaration\\PHPStan\\ObjectTypeSpecifier' => __DIR__ . '/../..' . '/rules/TypeDeclaration/PHPStan/ObjectTypeSpecifier.php',
'Rector\\TypeDeclaration\\PHPStan\\TypeSpecifier\\SameNamespacedTypeSpecifier' => __DIR__ . '/../..' . '/rules/TypeDeclaration/PHPStan/TypeSpecifier/SameNamespacedTypeSpecifier.php',
'Rector\\TypeDeclaration\\PHPStan\\TypeSpecifier\\SelfStaticParentTypeSpecifier' => __DIR__ . '/../..' . '/rules/TypeDeclaration/PHPStan/TypeSpecifier/SelfStaticParentTypeSpecifier.php',
@ -3008,7 +3006,6 @@ class ComposerStaticInit9a055792afbc031cf4fb8034f35e29e2
'Rector\\VendorLocker\\NodeVendorLocker\\ClassMethodReturnVendorLockResolver' => __DIR__ . '/../..' . '/packages/VendorLocker/NodeVendorLocker/ClassMethodReturnVendorLockResolver.php',
'Rector\\VendorLocker\\NodeVendorLocker\\PropertyTypeVendorLockResolver' => __DIR__ . '/../..' . '/packages/VendorLocker/NodeVendorLocker/PropertyTypeVendorLockResolver.php',
'Rector\\VendorLocker\\ParentClassMethodTypeOverrideGuard' => __DIR__ . '/../..' . '/packages/VendorLocker/ParentClassMethodTypeOverrideGuard.php',
'Rector\\VendorLocker\\VendorLockResolver' => __DIR__ . '/../..' . '/packages/VendorLocker/VendorLockResolver.php',
'Rector\\VersionBonding\\Contract\\MinPhpVersionInterface' => __DIR__ . '/../..' . '/packages/VersionBonding/Contract/MinPhpVersionInterface.php',
'Rector\\VersionBonding\\PhpVersionedFilter' => __DIR__ . '/../..' . '/packages/VersionBonding/PhpVersionedFilter.php',
'Rector\\Visibility\\Rector\\ClassConst\\ChangeConstantVisibilityRector' => __DIR__ . '/../..' . '/rules/Visibility/Rector/ClassConst/ChangeConstantVisibilityRector.php',
@ -3036,9 +3033,9 @@ class ComposerStaticInit9a055792afbc031cf4fb8034f35e29e2
public static function getInitializer(ClassLoader $loader)
{
return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInit9a055792afbc031cf4fb8034f35e29e2::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit9a055792afbc031cf4fb8034f35e29e2::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit9a055792afbc031cf4fb8034f35e29e2::$classMap;
$loader->prefixLengthsPsr4 = ComposerStaticInit52de9b4294aee6ed7dc3a6bd6f0e5143::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit52de9b4294aee6ed7dc3a6bd6f0e5143::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit52de9b4294aee6ed7dc3a6bd6f0e5143::$classMap;
}, null, ClassLoader::class);
}