From 886fa8b3c02f1a33e0a55f3eca37a669132441ec Mon Sep 17 00:00:00 2001 From: Jan Nedbal Date: Thu, 3 Oct 2024 12:37:22 +0200 Subject: [PATCH] Spread list usages in Reflection, Scope, Type --- src/Analyser/MutatingScope.php | 4 ++-- src/Analyser/StatementResult.php | 4 ++-- src/PhpDoc/TypeNodeResolver.php | 7 ++++--- .../AnnotationMethodReflection.php | 4 ++-- .../Callables/FunctionCallableVariant.php | 2 +- src/Reflection/ClassReflection.php | 20 +++++++++---------- .../Dummy/ChangedTypeMethodReflection.php | 4 ++-- .../ExtendedCallableFunctionVariant.php | 2 +- src/Reflection/ExtendedFunctionVariant.php | 6 +++--- src/Reflection/ExtendedMethodReflection.php | 4 ++-- src/Reflection/ExtendedParametersAcceptor.php | 2 +- src/Reflection/FunctionReflection.php | 4 ++-- src/Reflection/FunctionVariant.php | 4 ++-- src/Reflection/InaccessibleMethod.php | 3 --- src/Reflection/MethodReflection.php | 2 +- .../Native/NativeFunctionReflection.php | 4 ++-- .../Native/NativeMethodReflection.php | 4 ++-- src/Reflection/ParametersAcceptor.php | 2 +- src/Reflection/ParametersAcceptorSelector.php | 13 ++++++------ src/Reflection/Php/ExitFunctionReflection.php | 2 +- .../PhpFunctionFromParserNodeReflection.php | 7 ++----- src/Reflection/Php/PhpFunctionReflection.php | 7 ++----- src/Reflection/Php/PhpMethodReflection.php | 8 ++++---- .../ResolvedFunctionVariantWithOriginal.php | 2 +- src/Reflection/ResolvedMethodReflection.php | 6 +++--- .../SignatureMap/FunctionSignature.php | 4 ++-- .../SignatureMap/SignatureMapParser.php | 2 +- src/Type/Accessory/HasPropertyType.php | 3 --- src/Type/ArrayType.php | 3 --- src/Type/CallableType.php | 9 +++------ src/Type/ClosureType.php | 9 +++------ src/Type/FloatType.php | 3 --- src/Type/Generic/GenericObjectType.php | 3 --- src/Type/IterableType.php | 3 --- src/Type/JustNullableTypeTrait.php | 3 --- src/Type/MixedType.php | 3 --- src/Type/NeverType.php | 3 --- src/Type/NullType.php | 3 --- src/Type/ObjectType.php | 3 --- src/Type/ObjectWithoutClassType.php | 3 --- src/Type/StaticType.php | 3 --- src/Type/Type.php | 4 ++-- src/Type/TypeUtils.php | 6 +++--- src/Type/UnionType.php | 3 --- src/Type/VoidType.php | 3 --- 45 files changed, 74 insertions(+), 129 deletions(-) diff --git a/src/Analyser/MutatingScope.php b/src/Analyser/MutatingScope.php index 461ab91c4f..b145afa082 100644 --- a/src/Analyser/MutatingScope.php +++ b/src/Analyser/MutatingScope.php @@ -552,7 +552,7 @@ public function getVariableType(string $variableName): Type /** * @api - * @return array + * @return list */ public function getDefinedVariables(): array { @@ -573,7 +573,7 @@ public function getDefinedVariables(): array /** * @api - * @return array + * @return list */ public function getMaybeDefinedVariables(): array { diff --git a/src/Analyser/StatementResult.php b/src/Analyser/StatementResult.php index 71f0ddc740..dad528dc18 100644 --- a/src/Analyser/StatementResult.php +++ b/src/Analyser/StatementResult.php @@ -81,7 +81,7 @@ public function getExitPoints(): array /** * @param class-string|class-string $stmtClass - * @return StatementExitPoint[] + * @return list */ public function getExitPointsByType(string $stmtClass): array { @@ -115,7 +115,7 @@ public function getExitPointsByType(string $stmtClass): array } /** - * @return StatementExitPoint[] + * @return list */ public function getExitPointsForOuterLoop(): array { diff --git a/src/PhpDoc/TypeNodeResolver.php b/src/PhpDoc/TypeNodeResolver.php index ee7ef34786..6dd4f821b9 100644 --- a/src/PhpDoc/TypeNodeResolver.php +++ b/src/PhpDoc/TypeNodeResolver.php @@ -107,6 +107,7 @@ use Traversable; use function array_key_exists; use function array_map; +use function array_values; use function count; use function explode; use function get_class; @@ -927,7 +928,7 @@ private function resolveCallableTypeNode(CallableTypeNode $typeNode, NameScope $ $mainType = $this->resolve($typeNode->identifier, $nameScope); $isVariadic = false; - $parameters = array_map( + $parameters = array_values(array_map( function (CallableTypeParameterNode $parameterNode) use ($nameScope, &$isVariadic): NativeParameterReflection { $isVariadic = $isVariadic || $parameterNode->isVariadic; $parameterName = $parameterNode->parameterName; @@ -945,7 +946,7 @@ function (CallableTypeParameterNode $parameterNode) use ($nameScope, &$isVariadi ); }, $typeNode->parameters, - ); + )); $returnType = $this->resolve($typeNode->returnType, $nameScope); @@ -1196,7 +1197,7 @@ private function expandIntMaskToType(Type $type): ?Type /** * @api * @param TypeNode[] $typeNodes - * @return Type[] + * @return list */ public function resolveMultiple(array $typeNodes, NameScope $nameScope): array { diff --git a/src/Reflection/Annotations/AnnotationMethodReflection.php b/src/Reflection/Annotations/AnnotationMethodReflection.php index 847a444eb5..865abdbe04 100644 --- a/src/Reflection/Annotations/AnnotationMethodReflection.php +++ b/src/Reflection/Annotations/AnnotationMethodReflection.php @@ -17,11 +17,11 @@ final class AnnotationMethodReflection implements ExtendedMethodReflection { - /** @var ExtendedFunctionVariant[]|null */ + /** @var list|null */ private ?array $variants = null; /** - * @param AnnotationsMethodParameterReflection[] $parameters + * @param list $parameters */ public function __construct( private string $name, diff --git a/src/Reflection/Callables/FunctionCallableVariant.php b/src/Reflection/Callables/FunctionCallableVariant.php index 66bd629a3e..71ea905c52 100644 --- a/src/Reflection/Callables/FunctionCallableVariant.php +++ b/src/Reflection/Callables/FunctionCallableVariant.php @@ -52,7 +52,7 @@ public function getResolvedTemplateTypeMap(): TemplateTypeMap } /** - * @return array + * @return list */ public function getParameters(): array { diff --git a/src/Reflection/ClassReflection.php b/src/Reflection/ClassReflection.php index 7d966f83d5..a557218fd5 100644 --- a/src/Reflection/ClassReflection.php +++ b/src/Reflection/ClassReflection.php @@ -130,7 +130,7 @@ final class ClassReflection private false|ResolvedPhpDocBlock $traitContextResolvedPhpDocBlock = false; - /** @var ClassReflection[]|null */ + /** @var array|null */ private ?array $cachedInterfaces = null; private ClassReflection|false|null $cachedParentClass = false; @@ -360,7 +360,7 @@ public function getClassHierarchyDistances(): array } /** - * @return ReflectionClass[] + * @return list */ private function collectTraits(ReflectionClass|ReflectionEnum $class): array { @@ -845,7 +845,7 @@ public function implementsInterface(string $className): bool } /** - * @return ClassReflection[] + * @return list */ public function getParents(): array { @@ -860,7 +860,7 @@ public function getParents(): array } /** - * @return ClassReflection[] + * @return array */ public function getInterfaces(): array { @@ -894,7 +894,7 @@ public function getInterfaces(): array } /** - * @return ClassReflection[] + * @return array */ private function collectInterfaces(ClassReflection $interface): array { @@ -910,7 +910,7 @@ private function collectInterfaces(ClassReflection $interface): array } /** - * @return ClassReflection[] + * @return array */ public function getImmediateInterfaces(): array { @@ -1102,7 +1102,7 @@ public function hasTraitUse(string $traitName): bool } /** - * @return string[] + * @return list */ private function getTraitNames(): array { @@ -1459,7 +1459,7 @@ public function varianceMapFromList(array $variances): TemplateTypeVarianceMap return new TemplateTypeVarianceMap($map); } - /** @return array */ + /** @return list */ public function typeMapToList(TemplateTypeMap $typeMap): array { $resolvedPhpDoc = $this->getResolvedPhpDoc(); @@ -1475,7 +1475,7 @@ public function typeMapToList(TemplateTypeMap $typeMap): array return $list; } - /** @return array */ + /** @return list */ public function varianceMapToList(TemplateTypeVarianceMap $varianceMap): array { $resolvedPhpDoc = $this->getResolvedPhpDoc(); @@ -1775,7 +1775,7 @@ public function getMethodTags(): array } /** - * @return array + * @return list */ public function getResolvedMixinTypes(): array { diff --git a/src/Reflection/Dummy/ChangedTypeMethodReflection.php b/src/Reflection/Dummy/ChangedTypeMethodReflection.php index bc0a557157..3b3279596a 100644 --- a/src/Reflection/Dummy/ChangedTypeMethodReflection.php +++ b/src/Reflection/Dummy/ChangedTypeMethodReflection.php @@ -17,8 +17,8 @@ final class ChangedTypeMethodReflection implements ExtendedMethodReflection { /** - * @param ExtendedParametersAcceptor[] $variants - * @param ExtendedParametersAcceptor[]|null $namedArgumentsVariants + * @param list $variants + * @param list|null $namedArgumentsVariants */ public function __construct(private ClassReflection $declaringClass, private ExtendedMethodReflection $reflection, private array $variants, private ?array $namedArgumentsVariants) { diff --git a/src/Reflection/ExtendedCallableFunctionVariant.php b/src/Reflection/ExtendedCallableFunctionVariant.php index 5b67d210cc..5e2d3a9c10 100644 --- a/src/Reflection/ExtendedCallableFunctionVariant.php +++ b/src/Reflection/ExtendedCallableFunctionVariant.php @@ -15,7 +15,7 @@ final class ExtendedCallableFunctionVariant extends ExtendedFunctionVariant impl { /** - * @param array $parameters + * @param list $parameters * @param SimpleThrowPoint[] $throwPoints * @param SimpleImpurePoint[] $impurePoints * @param InvalidateExprNode[] $invalidateExpressions diff --git a/src/Reflection/ExtendedFunctionVariant.php b/src/Reflection/ExtendedFunctionVariant.php index 33c8e72c00..e45f402bb0 100644 --- a/src/Reflection/ExtendedFunctionVariant.php +++ b/src/Reflection/ExtendedFunctionVariant.php @@ -13,7 +13,7 @@ class ExtendedFunctionVariant extends FunctionVariant implements ExtendedParamet { /** - * @param array $parameters + * @param list $parameters * @api */ public function __construct( @@ -38,11 +38,11 @@ public function __construct( } /** - * @return array + * @return list */ public function getParameters(): array { - /** @var array $parameters */ + /** @var list $parameters */ $parameters = parent::getParameters(); return $parameters; diff --git a/src/Reflection/ExtendedMethodReflection.php b/src/Reflection/ExtendedMethodReflection.php index e8a65b00b6..b49a71bb1a 100644 --- a/src/Reflection/ExtendedMethodReflection.php +++ b/src/Reflection/ExtendedMethodReflection.php @@ -23,7 +23,7 @@ interface ExtendedMethodReflection extends MethodReflection { /** - * @return ExtendedParametersAcceptor[] + * @return list */ public function getVariants(): array; @@ -33,7 +33,7 @@ public function getVariants(): array; public function getOnlyVariant(): ExtendedParametersAcceptor; /** - * @return ExtendedParametersAcceptor[]|null + * @return list|null */ public function getNamedArgumentsVariants(): ?array; diff --git a/src/Reflection/ExtendedParametersAcceptor.php b/src/Reflection/ExtendedParametersAcceptor.php index 002a8a930d..77fb213b49 100644 --- a/src/Reflection/ExtendedParametersAcceptor.php +++ b/src/Reflection/ExtendedParametersAcceptor.php @@ -10,7 +10,7 @@ interface ExtendedParametersAcceptor extends ParametersAcceptor { /** - * @return array + * @return list */ public function getParameters(): array; diff --git a/src/Reflection/FunctionReflection.php b/src/Reflection/FunctionReflection.php index e6770e08a5..33b355b844 100644 --- a/src/Reflection/FunctionReflection.php +++ b/src/Reflection/FunctionReflection.php @@ -14,7 +14,7 @@ public function getName(): string; public function getFileName(): ?string; /** - * @return ExtendedParametersAcceptor[] + * @return list */ public function getVariants(): array; @@ -24,7 +24,7 @@ public function getVariants(): array; public function getOnlyVariant(): ExtendedParametersAcceptor; /** - * @return ExtendedParametersAcceptor[]|null + * @return list|null */ public function getNamedArgumentsVariants(): ?array; diff --git a/src/Reflection/FunctionVariant.php b/src/Reflection/FunctionVariant.php index b6023cae16..7c69274ef0 100644 --- a/src/Reflection/FunctionVariant.php +++ b/src/Reflection/FunctionVariant.php @@ -16,7 +16,7 @@ class FunctionVariant implements ParametersAcceptor /** * @api - * @param array $parameters + * @param list $parameters */ public function __construct( private TemplateTypeMap $templateTypeMap, @@ -46,7 +46,7 @@ public function getCallSiteVarianceMap(): TemplateTypeVarianceMap } /** - * @return array + * @return list */ public function getParameters(): array { diff --git a/src/Reflection/InaccessibleMethod.php b/src/Reflection/InaccessibleMethod.php index fef9716d6c..037f4e8137 100644 --- a/src/Reflection/InaccessibleMethod.php +++ b/src/Reflection/InaccessibleMethod.php @@ -37,9 +37,6 @@ public function getCallSiteVarianceMap(): TemplateTypeVarianceMap return TemplateTypeVarianceMap::createEmpty(); } - /** - * @return array - */ public function getParameters(): array { return []; diff --git a/src/Reflection/MethodReflection.php b/src/Reflection/MethodReflection.php index 8d601e9471..529a5011dd 100644 --- a/src/Reflection/MethodReflection.php +++ b/src/Reflection/MethodReflection.php @@ -14,7 +14,7 @@ public function getName(): string; public function getPrototype(): ClassMemberReflection; /** - * @return ParametersAcceptor[] + * @return list */ public function getVariants(): array; diff --git a/src/Reflection/Native/NativeFunctionReflection.php b/src/Reflection/Native/NativeFunctionReflection.php index 852392d750..730f8c61e9 100644 --- a/src/Reflection/Native/NativeFunctionReflection.php +++ b/src/Reflection/Native/NativeFunctionReflection.php @@ -18,8 +18,8 @@ final class NativeFunctionReflection implements FunctionReflection private TrinaryLogic $returnsByReference; /** - * @param ExtendedParametersAcceptor[] $variants - * @param ExtendedParametersAcceptor[]|null $namedArgumentsVariants + * @param list $variants + * @param list|null $namedArgumentsVariants */ public function __construct( private string $name, diff --git a/src/Reflection/Native/NativeMethodReflection.php b/src/Reflection/Native/NativeMethodReflection.php index b167f1223f..8f1e21d7c9 100644 --- a/src/Reflection/Native/NativeMethodReflection.php +++ b/src/Reflection/Native/NativeMethodReflection.php @@ -22,8 +22,8 @@ final class NativeMethodReflection implements ExtendedMethodReflection { /** - * @param ExtendedParametersAcceptor[] $variants - * @param ExtendedParametersAcceptor[]|null $namedArgumentsVariants + * @param list $variants + * @param list|null $namedArgumentsVariants */ public function __construct( private ReflectionProvider $reflectionProvider, diff --git a/src/Reflection/ParametersAcceptor.php b/src/Reflection/ParametersAcceptor.php index f4c2d4f1c0..b5fa5f1a2d 100644 --- a/src/Reflection/ParametersAcceptor.php +++ b/src/Reflection/ParametersAcceptor.php @@ -20,7 +20,7 @@ public function getTemplateTypeMap(): TemplateTypeMap; public function getResolvedTemplateTypeMap(): TemplateTypeMap; /** - * @return array + * @return list */ public function getParameters(): array; diff --git a/src/Reflection/ParametersAcceptorSelector.php b/src/Reflection/ParametersAcceptorSelector.php index 57609ab0c7..cc36c1d951 100644 --- a/src/Reflection/ParametersAcceptorSelector.php +++ b/src/Reflection/ParametersAcceptorSelector.php @@ -44,6 +44,7 @@ use function array_map; use function array_merge; use function array_slice; +use function array_values; use function constant; use function count; use function defined; @@ -143,7 +144,7 @@ public static function selectFromArgs( new FunctionVariant( $acceptor->getTemplateTypeMap(), $acceptor->getResolvedTemplateTypeMap(), - $parameters, + array_values($parameters), $acceptor->isVariadic(), $acceptor->getReturnType(), $acceptor instanceof ExtendedParametersAcceptor ? $acceptor->getCallSiteVarianceMap() : TemplateTypeVarianceMap::createEmpty(), @@ -193,7 +194,7 @@ public static function selectFromArgs( new FunctionVariant( $acceptor->getTemplateTypeMap(), $acceptor->getResolvedTemplateTypeMap(), - $parameters, + array_values($parameters), $acceptor->isVariadic(), $acceptor->getReturnType(), $acceptor instanceof ExtendedParametersAcceptor ? $acceptor->getCallSiteVarianceMap() : TemplateTypeVarianceMap::createEmpty(), @@ -224,7 +225,7 @@ public static function selectFromArgs( new FunctionVariant( $acceptor->getTemplateTypeMap(), $acceptor->getResolvedTemplateTypeMap(), - $parameters, + array_values($parameters), $acceptor->isVariadic(), $acceptor->getReturnType(), $acceptor instanceof ExtendedParametersAcceptor ? $acceptor->getCallSiteVarianceMap() : TemplateTypeVarianceMap::createEmpty(), @@ -309,7 +310,7 @@ public static function selectFromArgs( new FunctionVariant( $acceptor->getTemplateTypeMap(), $acceptor->getResolvedTemplateTypeMap(), - $parameters, + array_values($parameters), $acceptor->isVariadic(), $acceptor->getReturnType(), $acceptor instanceof ExtendedParametersAcceptor ? $acceptor->getCallSiteVarianceMap() : TemplateTypeVarianceMap::createEmpty(), @@ -688,7 +689,7 @@ public static function combineAcceptors(array $acceptors): ExtendedParametersAcc return new ExtendedCallableFunctionVariant( TemplateTypeMap::createEmpty(), null, - $parameters, + array_values($parameters), $isVariadic, $returnType, $phpDocReturnType ?? $returnType, @@ -706,7 +707,7 @@ public static function combineAcceptors(array $acceptors): ExtendedParametersAcc return new ExtendedFunctionVariant( TemplateTypeMap::createEmpty(), null, - $parameters, + array_values($parameters), $isVariadic, $returnType, $phpDocReturnType ?? $returnType, diff --git a/src/Reflection/Php/ExitFunctionReflection.php b/src/Reflection/Php/ExitFunctionReflection.php index 12eb38927d..76c8e7cf7a 100644 --- a/src/Reflection/Php/ExitFunctionReflection.php +++ b/src/Reflection/Php/ExitFunctionReflection.php @@ -75,7 +75,7 @@ public function getOnlyVariant(): ExtendedParametersAcceptor } /** - * @return ExtendedParametersAcceptor[] + * @return list */ public function getNamedArgumentsVariants(): array { diff --git a/src/Reflection/Php/PhpFunctionFromParserNodeReflection.php b/src/Reflection/Php/PhpFunctionFromParserNodeReflection.php index dc44c0d17d..1d157476df 100644 --- a/src/Reflection/Php/PhpFunctionFromParserNodeReflection.php +++ b/src/Reflection/Php/PhpFunctionFromParserNodeReflection.php @@ -33,7 +33,7 @@ class PhpFunctionFromParserNodeReflection implements FunctionReflection, Extende /** @var Function_|ClassMethod */ private Node\FunctionLike $functionLike; - /** @var ExtendedFunctionVariant[]|null */ + /** @var list|null */ private ?array $variants = null; /** @@ -93,9 +93,6 @@ public function getName(): string return (string) $this->functionLike->namespacedName; } - /** - * @return ExtendedParametersAcceptor[] - */ public function getVariants(): array { if ($this->variants === null) { @@ -136,7 +133,7 @@ public function getResolvedTemplateTypeMap(): TemplateTypeMap } /** - * @return array + * @return list */ public function getParameters(): array { diff --git a/src/Reflection/Php/PhpFunctionReflection.php b/src/Reflection/Php/PhpFunctionReflection.php index 4669701c79..6209323f77 100644 --- a/src/Reflection/Php/PhpFunctionReflection.php +++ b/src/Reflection/Php/PhpFunctionReflection.php @@ -32,7 +32,7 @@ final class PhpFunctionReflection implements FunctionReflection { - /** @var ExtendedFunctionVariant[]|null */ + /** @var list|null */ private ?array $variants = null; /** @@ -85,9 +85,6 @@ public function getFileName(): ?string return $this->filename; } - /** - * @return ExtendedParametersAcceptor[] - */ public function getVariants(): array { if ($this->variants === null) { @@ -118,7 +115,7 @@ public function getNamedArgumentsVariants(): ?array } /** - * @return ExtendedParameterReflection[] + * @return list */ private function getParameters(): array { diff --git a/src/Reflection/Php/PhpMethodReflection.php b/src/Reflection/Php/PhpMethodReflection.php index afa4f56a46..d0e008a7ed 100644 --- a/src/Reflection/Php/PhpMethodReflection.php +++ b/src/Reflection/Php/PhpMethodReflection.php @@ -52,14 +52,14 @@ final class PhpMethodReflection implements ExtendedMethodReflection { - /** @var PhpParameterReflection[]|null */ + /** @var list|null */ private ?array $parameters = null; private ?Type $returnType = null; private ?Type $nativeReturnType = null; - /** @var ExtendedFunctionVariant[]|null */ + /** @var list|null */ private ?array $variants = null; /** @@ -191,7 +191,7 @@ private function getMethodNameWithCorrectCase(string $lowercaseMethodName, strin } /** - * @return ExtendedParametersAcceptor[] + * @return list */ public function getVariants(): array { @@ -223,7 +223,7 @@ public function getNamedArgumentsVariants(): ?array } /** - * @return ExtendedParameterReflection[] + * @return list */ private function getParameters(): array { diff --git a/src/Reflection/ResolvedFunctionVariantWithOriginal.php b/src/Reflection/ResolvedFunctionVariantWithOriginal.php index 4dda7b8685..dcf68ca1ef 100644 --- a/src/Reflection/ResolvedFunctionVariantWithOriginal.php +++ b/src/Reflection/ResolvedFunctionVariantWithOriginal.php @@ -21,7 +21,7 @@ final class ResolvedFunctionVariantWithOriginal implements ResolvedFunctionVariant { - /** @var ExtendedParameterReflection[]|null */ + /** @var list|null */ private ?array $parameters = null; private ?Type $returnTypeWithUnresolvableTemplateTypes = null; diff --git a/src/Reflection/ResolvedMethodReflection.php b/src/Reflection/ResolvedMethodReflection.php index b04803c13c..33b70bafe4 100644 --- a/src/Reflection/ResolvedMethodReflection.php +++ b/src/Reflection/ResolvedMethodReflection.php @@ -14,10 +14,10 @@ final class ResolvedMethodReflection implements ExtendedMethodReflection { - /** @var ExtendedParametersAcceptor[]|null */ + /** @var list|null */ private ?array $variants = null; - /** @var ExtendedParametersAcceptor[]|null */ + /** @var list|null */ private ?array $namedArgumentVariants = null; private ?Assertions $asserts = null; @@ -74,7 +74,7 @@ public function getNamedArgumentsVariants(): ?array /** * @param ExtendedParametersAcceptor[] $variants - * @return ResolvedFunctionVariant[] + * @return list */ private function resolveVariants(array $variants): array { diff --git a/src/Reflection/SignatureMap/FunctionSignature.php b/src/Reflection/SignatureMap/FunctionSignature.php index 07886541f8..f9107d4b23 100644 --- a/src/Reflection/SignatureMap/FunctionSignature.php +++ b/src/Reflection/SignatureMap/FunctionSignature.php @@ -8,7 +8,7 @@ final class FunctionSignature { /** - * @param array $parameters + * @param list $parameters */ public function __construct( private array $parameters, @@ -20,7 +20,7 @@ public function __construct( } /** - * @return array + * @return list */ public function getParameters(): array { diff --git a/src/Reflection/SignatureMap/SignatureMapParser.php b/src/Reflection/SignatureMap/SignatureMapParser.php index 0652b11383..e60cede66d 100644 --- a/src/Reflection/SignatureMap/SignatureMapParser.php +++ b/src/Reflection/SignatureMap/SignatureMapParser.php @@ -57,7 +57,7 @@ private function getTypeFromString(string $typeString, ?string $className): Type /** * @param array $parameterMap - * @return array + * @return list */ private function getParameters(array $parameterMap): array { diff --git a/src/Type/Accessory/HasPropertyType.php b/src/Type/Accessory/HasPropertyType.php index f65b2bbe48..759230b2cd 100644 --- a/src/Type/Accessory/HasPropertyType.php +++ b/src/Type/Accessory/HasPropertyType.php @@ -35,9 +35,6 @@ public function __construct(private string $propertyName) { } - /** - * @return string[] - */ public function getReferencedClasses(): array { return []; diff --git a/src/Type/ArrayType.php b/src/Type/ArrayType.php index 97ebb9a196..11304c9edd 100644 --- a/src/Type/ArrayType.php +++ b/src/Type/ArrayType.php @@ -64,9 +64,6 @@ public function getItemType(): Type return $this->itemType; } - /** - * @return string[] - */ public function getReferencedClasses(): array { return array_merge( diff --git a/src/Type/CallableType.php b/src/Type/CallableType.php index 325a195d27..353b5622ea 100644 --- a/src/Type/CallableType.php +++ b/src/Type/CallableType.php @@ -52,7 +52,7 @@ class CallableType implements CompoundType, CallableParametersAcceptor use NonRemoveableTypeTrait; use NonGeneralizableTypeTrait; - /** @var array */ + /** @var list */ private array $parameters; private Type $returnType; @@ -67,7 +67,7 @@ class CallableType implements CompoundType, CallableParametersAcceptor /** * @api - * @param array|null $parameters + * @param list|null $parameters * @param array $templateTags */ public function __construct( @@ -101,9 +101,6 @@ public function isPure(): TrinaryLogic return $this->isPure; } - /** - * @return string[] - */ public function getReferencedClasses(): array { $classes = []; @@ -345,7 +342,7 @@ public function getCallSiteVarianceMap(): TemplateTypeVarianceMap } /** - * @return array + * @return list */ public function getParameters(): array { diff --git a/src/Type/ClosureType.php b/src/Type/ClosureType.php index 46101a4bfe..f4e50f8089 100644 --- a/src/Type/ClosureType.php +++ b/src/Type/ClosureType.php @@ -59,7 +59,7 @@ class ClosureType implements TypeWithClassName, CallableParametersAcceptor use NonRemoveableTypeTrait; use NonGeneralizableTypeTrait; - /** @var array */ + /** @var list */ private array $parameters; private Type $returnType; @@ -81,7 +81,7 @@ class ClosureType implements TypeWithClassName, CallableParametersAcceptor /** * @api - * @param array|null $parameters + * @param list|null $parameters * @param array $templateTags * @param SimpleThrowPoint[] $throwPoints * @param ?SimpleImpurePoint[] $impurePoints @@ -165,9 +165,6 @@ public function getAncestorWithClassName(string $className): ?TypeWithClassName return $this->objectType->getAncestorWithClassName($className); } - /** - * @return string[] - */ public function getReferencedClasses(): array { $classes = $this->objectType->getReferencedClasses(); @@ -481,7 +478,7 @@ public function getCallSiteVarianceMap(): TemplateTypeVarianceMap } /** - * @return array + * @return list */ public function getParameters(): array { diff --git a/src/Type/FloatType.php b/src/Type/FloatType.php index a9bea4a070..829f1cb8ed 100644 --- a/src/Type/FloatType.php +++ b/src/Type/FloatType.php @@ -41,9 +41,6 @@ public function __construct() { } - /** - * @return string[] - */ public function getReferencedClasses(): array { return []; diff --git a/src/Type/Generic/GenericObjectType.php b/src/Type/Generic/GenericObjectType.php index b73a7efc94..f7c18de70b 100644 --- a/src/Type/Generic/GenericObjectType.php +++ b/src/Type/Generic/GenericObjectType.php @@ -91,9 +91,6 @@ public function equals(Type $type): bool return true; } - /** - * @return string[] - */ public function getReferencedClasses(): array { $classes = parent::getReferencedClasses(); diff --git a/src/Type/IterableType.php b/src/Type/IterableType.php index 512f88ac7a..6d375c7e2c 100644 --- a/src/Type/IterableType.php +++ b/src/Type/IterableType.php @@ -52,9 +52,6 @@ public function getItemType(): Type return $this->itemType; } - /** - * @return string[] - */ public function getReferencedClasses(): array { return array_merge( diff --git a/src/Type/JustNullableTypeTrait.php b/src/Type/JustNullableTypeTrait.php index 481e9fb3ac..24f2974ae4 100644 --- a/src/Type/JustNullableTypeTrait.php +++ b/src/Type/JustNullableTypeTrait.php @@ -8,9 +8,6 @@ trait JustNullableTypeTrait { - /** - * @return string[] - */ public function getReferencedClasses(): array { return []; diff --git a/src/Type/MixedType.php b/src/Type/MixedType.php index 5353a10290..8ffc633771 100644 --- a/src/Type/MixedType.php +++ b/src/Type/MixedType.php @@ -61,9 +61,6 @@ public function __construct( $this->subtractedType = $subtractedType; } - /** - * @return string[] - */ public function getReferencedClasses(): array { return []; diff --git a/src/Type/NeverType.php b/src/Type/NeverType.php index 21f58c0c29..5e2291a38b 100644 --- a/src/Type/NeverType.php +++ b/src/Type/NeverType.php @@ -39,9 +39,6 @@ public function isExplicit(): bool return $this->isExplicit; } - /** - * @return string[] - */ public function getReferencedClasses(): array { return []; diff --git a/src/Type/NullType.php b/src/Type/NullType.php index b8ba6be336..f9296f32ff 100644 --- a/src/Type/NullType.php +++ b/src/Type/NullType.php @@ -36,9 +36,6 @@ public function __construct() { } - /** - * @return string[] - */ public function getReferencedClasses(): array { return []; diff --git a/src/Type/ObjectType.php b/src/Type/ObjectType.php index 804147910e..c08fc0af10 100644 --- a/src/Type/ObjectType.php +++ b/src/Type/ObjectType.php @@ -252,9 +252,6 @@ public function getPropertyWithoutTransformingStatic(string $propertyName, Class return $classReflection->getProperty($propertyName, $scope); } - /** - * @return string[] - */ public function getReferencedClasses(): array { return [$this->className]; diff --git a/src/Type/ObjectWithoutClassType.php b/src/Type/ObjectWithoutClassType.php index e9cd001bdc..69f10e8dba 100644 --- a/src/Type/ObjectWithoutClassType.php +++ b/src/Type/ObjectWithoutClassType.php @@ -34,9 +34,6 @@ public function __construct( $this->subtractedType = $subtractedType; } - /** - * @return string[] - */ public function getReferencedClasses(): array { return []; diff --git a/src/Type/StaticType.php b/src/Type/StaticType.php index 7d73571c4f..cb3a135431 100644 --- a/src/Type/StaticType.php +++ b/src/Type/StaticType.php @@ -99,9 +99,6 @@ public function getStaticObjectType(): ObjectType return $this->staticObjectType; } - /** - * @return string[] - */ public function getReferencedClasses(): array { return $this->getStaticObjectType()->getReferencedClasses(); diff --git a/src/Type/Type.php b/src/Type/Type.php index 398bc0d4f2..2e0557ba0c 100644 --- a/src/Type/Type.php +++ b/src/Type/Type.php @@ -28,7 +28,7 @@ interface Type { /** - * @return string[] + * @return list */ public function getReferencedClasses(): array; @@ -313,7 +313,7 @@ public function inferTemplateTypes(Type $receivedType): TemplateTypeMap; * which the receiver type was * found. * - * @return TemplateTypeReference[] + * @return list */ public function getReferencedTemplateTypes(TemplateTypeVariance $positionVariance): array; diff --git a/src/Type/TypeUtils.php b/src/Type/TypeUtils.php index c00c7602ec..65268fba79 100644 --- a/src/Type/TypeUtils.php +++ b/src/Type/TypeUtils.php @@ -18,7 +18,7 @@ final class TypeUtils { /** - * @return ConstantIntegerType[] + * @return list */ public static function getConstantIntegers(Type $type): array { @@ -26,7 +26,7 @@ public static function getConstantIntegers(Type $type): array } /** - * @return IntegerRangeType[] + * @return list */ public static function getIntegerRanges(Type $type): array { @@ -34,7 +34,7 @@ public static function getIntegerRanges(Type $type): array } /** - * @return mixed[] + * @return list */ private static function map( string $typeClass, diff --git a/src/Type/UnionType.php b/src/Type/UnionType.php index 4e38c38566..3c8b9ef1ff 100644 --- a/src/Type/UnionType.php +++ b/src/Type/UnionType.php @@ -106,9 +106,6 @@ protected function getSortedTypes(): array return $this->types; } - /** - * @return string[] - */ public function getReferencedClasses(): array { $classes = []; diff --git a/src/Type/VoidType.php b/src/Type/VoidType.php index a49c642aca..5895449145 100644 --- a/src/Type/VoidType.php +++ b/src/Type/VoidType.php @@ -37,9 +37,6 @@ public function __construct() { } - /** - * @return string[] - */ public function getReferencedClasses(): array { return [];