From 2afbaa02624892e7e26d8630e47ff0ce6dd5f186 Mon Sep 17 00:00:00 2001 From: Valentin Udaltsov Date: Fri, 9 Aug 2024 01:04:28 +0300 Subject: [PATCH] Remove Type template --- src/Reflection/ClassReflection.php | 3 - .../Internal/Data/BackingTypeKey.php | 2 +- .../NativeReflectionBasedReflector.php | 3 - .../Internal/PhpParser/NodeReflector.php | 1 - .../PhpParser/UnresolvedConstantType.php | 1 - src/Type/CHANGELOG.md | 6 ++ src/Type/Internal/AliasType.php | 1 - src/Type/Internal/ArgumentType.php | 1 - src/Type/Internal/ArrayType.php | 1 - src/Type/Internal/CallableType.php | 1 - src/Type/Internal/ClassConstantMaskType.php | 1 - src/Type/Internal/ClassConstantType.php | 1 - src/Type/Internal/ClassStringType.php | 1 - src/Type/Internal/ConditionalType.php | 1 - src/Type/Internal/ConstantType.php | 1 - src/Type/Internal/FloatType.php | 2 - src/Type/Internal/FloatValueType.php | 5 -- src/Type/Internal/IntMaskType.php | 1 - src/Type/Internal/IntType.php | 2 - src/Type/Internal/IntValueType.php | 5 -- src/Type/Internal/IntersectionType.php | 1 - src/Type/Internal/IterableType.php | 7 -- src/Type/Internal/KeyType.php | 1 - src/Type/Internal/ListType.php | 1 - src/Type/Internal/LiteralType.php | 5 -- src/Type/Internal/NamedObjectType.php | 1 - src/Type/Internal/NonEmptyArrayType.php | 1 - src/Type/Internal/NotType.php | 1 - src/Type/Internal/ObjectType.php | 1 - src/Type/Internal/OffsetType.php | 1 - src/Type/Internal/ParentType.php | 1 - src/Type/Internal/SelfType.php | 1 - src/Type/Internal/StaticType.php | 1 - src/Type/Internal/StringValueType.php | 5 -- src/Type/Internal/TemplateType.php | 1 - src/Type/Internal/UnionType.php | 4 +- src/Type/Internal/VarianceAwareType.php | 5 -- src/Type/Parameter.php | 4 - src/Type/ShapeElement.php | 4 - src/Type/Type.php | 1 - src/Type/types.php | 87 ------------------- 41 files changed, 8 insertions(+), 166 deletions(-) diff --git a/src/Reflection/ClassReflection.php b/src/Reflection/ClassReflection.php index d4655c3c..d221627e 100644 --- a/src/Reflection/ClassReflection.php +++ b/src/Reflection/ClassReflection.php @@ -242,9 +242,6 @@ public function isBackedEnum(): bool return $this->data[Data::BackingType] !== null; } - /** - * @return (TObject is \BackedEnum ? Type : ?Type) - */ public function enumBackingType(): ?Type { return $this->data[Data::BackingType]; diff --git a/src/Reflection/Internal/Data/BackingTypeKey.php b/src/Reflection/Internal/Data/BackingTypeKey.php index 37e57a1b..9d0f0094 100644 --- a/src/Reflection/Internal/Data/BackingTypeKey.php +++ b/src/Reflection/Internal/Data/BackingTypeKey.php @@ -11,7 +11,7 @@ /** * @internal * @psalm-internal Typhoon\Reflection\Internal - * @implements OptionalKey> + * @implements OptionalKey */ enum BackingTypeKey implements OptionalKey { diff --git a/src/Reflection/Internal/NativeReflector/NativeReflectionBasedReflector.php b/src/Reflection/Internal/NativeReflector/NativeReflectionBasedReflector.php index d264e327..45cae20a 100644 --- a/src/Reflection/Internal/NativeReflector/NativeReflectionBasedReflector.php +++ b/src/Reflection/Internal/NativeReflector/NativeReflectionBasedReflector.php @@ -134,9 +134,6 @@ private static function reflectParents(\ReflectionClass $class): array return $parents; } - /** - * @return ?Type - */ private static function reflectBackingType(\ReflectionEnum $enum): ?Type { $type = $enum->getBackingType(); diff --git a/src/Reflection/Internal/PhpParser/NodeReflector.php b/src/Reflection/Internal/PhpParser/NodeReflector.php index c809df83..615b1650 100644 --- a/src/Reflection/Internal/PhpParser/NodeReflector.php +++ b/src/Reflection/Internal/PhpParser/NodeReflector.php @@ -127,7 +127,6 @@ public function reflectClassLike(ClassLike $node, Context $context): TypedMap } if ($node instanceof Enum_) { - /** @var ?Type */ $backingType = $this->reflectType($context, $node->scalarType); return $data diff --git a/src/Reflection/Internal/PhpParser/UnresolvedConstantType.php b/src/Reflection/Internal/PhpParser/UnresolvedConstantType.php index 3c6e038c..edbd6190 100644 --- a/src/Reflection/Internal/PhpParser/UnresolvedConstantType.php +++ b/src/Reflection/Internal/PhpParser/UnresolvedConstantType.php @@ -11,7 +11,6 @@ /** * @internal * @psalm-internal Typhoon\Reflection\Internal\PhpParser - * @implements Type */ final class UnresolvedConstantType implements Type { diff --git a/src/Type/CHANGELOG.md b/src/Type/CHANGELOG.md index 2d5372d4..1380c707 100644 --- a/src/Type/CHANGELOG.md +++ b/src/Type/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [Unreleased] + +### Changed + +- Remove `Type` template in favor of future plugins for Psalm and PHPStan. + ## [0.4.3] 2024-08-06 ### Added diff --git a/src/Type/Internal/AliasType.php b/src/Type/Internal/AliasType.php index d0c6b546..8c81457d 100644 --- a/src/Type/Internal/AliasType.php +++ b/src/Type/Internal/AliasType.php @@ -11,7 +11,6 @@ /** * @internal * @psalm-internal Typhoon\Type - * @implements Type */ final class AliasType implements Type { diff --git a/src/Type/Internal/ArgumentType.php b/src/Type/Internal/ArgumentType.php index 2aef2568..e3e7cefd 100644 --- a/src/Type/Internal/ArgumentType.php +++ b/src/Type/Internal/ArgumentType.php @@ -11,7 +11,6 @@ /** * @internal * @psalm-internal Typhoon\Type - * @implements Type */ final class ArgumentType implements Type { diff --git a/src/Type/Internal/ArrayType.php b/src/Type/Internal/ArrayType.php index 19662e9d..05672be4 100644 --- a/src/Type/Internal/ArrayType.php +++ b/src/Type/Internal/ArrayType.php @@ -11,7 +11,6 @@ /** * @internal * @psalm-internal Typhoon\Type - * @implements Type> */ final class ArrayType implements Type { diff --git a/src/Type/Internal/CallableType.php b/src/Type/Internal/CallableType.php index 3b326e07..6672ddaa 100644 --- a/src/Type/Internal/CallableType.php +++ b/src/Type/Internal/CallableType.php @@ -11,7 +11,6 @@ /** * @internal * @psalm-internal Typhoon\Type - * @implements Type */ final class CallableType implements Type { diff --git a/src/Type/Internal/ClassConstantMaskType.php b/src/Type/Internal/ClassConstantMaskType.php index 38cf19c1..66eff511 100644 --- a/src/Type/Internal/ClassConstantMaskType.php +++ b/src/Type/Internal/ClassConstantMaskType.php @@ -10,7 +10,6 @@ /** * @internal * @psalm-internal Typhoon\Type - * @implements Type */ final class ClassConstantMaskType implements Type { diff --git a/src/Type/Internal/ClassConstantType.php b/src/Type/Internal/ClassConstantType.php index 4f5cf21d..54ba6be7 100644 --- a/src/Type/Internal/ClassConstantType.php +++ b/src/Type/Internal/ClassConstantType.php @@ -10,7 +10,6 @@ /** * @internal * @psalm-internal Typhoon\Type - * @implements Type */ final class ClassConstantType implements Type { diff --git a/src/Type/Internal/ClassStringType.php b/src/Type/Internal/ClassStringType.php index ce65941e..bc80cf21 100644 --- a/src/Type/Internal/ClassStringType.php +++ b/src/Type/Internal/ClassStringType.php @@ -10,7 +10,6 @@ /** * @internal * @psalm-internal Typhoon\Type - * @implements Type */ final class ClassStringType implements Type { diff --git a/src/Type/Internal/ConditionalType.php b/src/Type/Internal/ConditionalType.php index 6d08e6d6..3ea9447b 100644 --- a/src/Type/Internal/ConditionalType.php +++ b/src/Type/Internal/ConditionalType.php @@ -10,7 +10,6 @@ /** * @internal * @psalm-internal Typhoon\Type - * @implements Type */ final class ConditionalType implements Type { diff --git a/src/Type/Internal/ConstantType.php b/src/Type/Internal/ConstantType.php index 69c50487..3925128a 100644 --- a/src/Type/Internal/ConstantType.php +++ b/src/Type/Internal/ConstantType.php @@ -11,7 +11,6 @@ /** * @internal * @psalm-internal Typhoon\Type - * @implements Type */ final class ConstantType implements Type { diff --git a/src/Type/Internal/FloatType.php b/src/Type/Internal/FloatType.php index c44bba32..88e53ecd 100644 --- a/src/Type/Internal/FloatType.php +++ b/src/Type/Internal/FloatType.php @@ -11,8 +11,6 @@ * @internal * @psalm-internal Typhoon\Type * @readonly - * @template-covariant TValue of float - * @implements Type */ final class FloatType implements Type { diff --git a/src/Type/Internal/FloatValueType.php b/src/Type/Internal/FloatValueType.php index c4fa49d8..4b10a3a0 100644 --- a/src/Type/Internal/FloatValueType.php +++ b/src/Type/Internal/FloatValueType.php @@ -10,14 +10,9 @@ /** * @internal * @psalm-internal Typhoon\Type - * @template-covariant TValue of float - * @implements Type */ final class FloatValueType implements Type { - /** - * @param TValue $value - */ public function __construct( private readonly float $value, ) {} diff --git a/src/Type/Internal/IntMaskType.php b/src/Type/Internal/IntMaskType.php index b716900f..08a7d8d7 100644 --- a/src/Type/Internal/IntMaskType.php +++ b/src/Type/Internal/IntMaskType.php @@ -10,7 +10,6 @@ /** * @internal * @psalm-internal Typhoon\Type - * @implements Type */ final class IntMaskType implements Type { diff --git a/src/Type/Internal/IntType.php b/src/Type/Internal/IntType.php index 429c72b2..350ec13f 100644 --- a/src/Type/Internal/IntType.php +++ b/src/Type/Internal/IntType.php @@ -11,8 +11,6 @@ * @internal * @psalm-internal Typhoon\Type * @readonly - * @template-covariant TValue of int - * @implements Type */ final class IntType implements Type { diff --git a/src/Type/Internal/IntValueType.php b/src/Type/Internal/IntValueType.php index 69e78e33..e0b8a8bf 100644 --- a/src/Type/Internal/IntValueType.php +++ b/src/Type/Internal/IntValueType.php @@ -10,14 +10,9 @@ /** * @internal * @psalm-internal Typhoon\Type - * @template-covariant TValue of int - * @implements Type */ final class IntValueType implements Type { - /** - * @param TValue $value - */ public function __construct( private readonly int $value, ) {} diff --git a/src/Type/Internal/IntersectionType.php b/src/Type/Internal/IntersectionType.php index c8b924e6..eea5b4cd 100644 --- a/src/Type/Internal/IntersectionType.php +++ b/src/Type/Internal/IntersectionType.php @@ -10,7 +10,6 @@ /** * @internal * @psalm-internal Typhoon\Type - * @implements Type */ final class IntersectionType implements Type { diff --git a/src/Type/Internal/IterableType.php b/src/Type/Internal/IterableType.php index 85e291fd..1dd1a1e1 100644 --- a/src/Type/Internal/IterableType.php +++ b/src/Type/Internal/IterableType.php @@ -10,16 +10,9 @@ /** * @internal * @psalm-internal Typhoon\Type - * @template-covariant TKey - * @template-covariant TValue - * @implements Type> */ final class IterableType implements Type { - /** - * @param Type $key - * @param Type $value - */ public function __construct( private readonly Type $key, private readonly Type $value, diff --git a/src/Type/Internal/KeyType.php b/src/Type/Internal/KeyType.php index bb7969c8..a09f6883 100644 --- a/src/Type/Internal/KeyType.php +++ b/src/Type/Internal/KeyType.php @@ -10,7 +10,6 @@ /** * @internal * @psalm-internal Typhoon\Type - * @implements Type */ final class KeyType implements Type { diff --git a/src/Type/Internal/ListType.php b/src/Type/Internal/ListType.php index fdf50a67..0f1e1ae8 100644 --- a/src/Type/Internal/ListType.php +++ b/src/Type/Internal/ListType.php @@ -11,7 +11,6 @@ /** * @internal * @psalm-internal Typhoon\Type - * @implements Type> */ final class ListType implements Type { diff --git a/src/Type/Internal/LiteralType.php b/src/Type/Internal/LiteralType.php index 0be7447c..964cecdd 100644 --- a/src/Type/Internal/LiteralType.php +++ b/src/Type/Internal/LiteralType.php @@ -10,14 +10,9 @@ /** * @internal * @psalm-internal Typhoon\Type - * @template-covariant TType - * @implements Type */ final class LiteralType implements Type { - /** - * @param Type $type - */ public function __construct( private readonly Type $type, ) {} diff --git a/src/Type/Internal/NamedObjectType.php b/src/Type/Internal/NamedObjectType.php index 68ad2712..d93d9fbb 100644 --- a/src/Type/Internal/NamedObjectType.php +++ b/src/Type/Internal/NamedObjectType.php @@ -12,7 +12,6 @@ /** * @internal * @psalm-internal Typhoon\Type - * @implements Type */ final class NamedObjectType implements Type { diff --git a/src/Type/Internal/NonEmptyArrayType.php b/src/Type/Internal/NonEmptyArrayType.php index b957349e..782a647c 100644 --- a/src/Type/Internal/NonEmptyArrayType.php +++ b/src/Type/Internal/NonEmptyArrayType.php @@ -11,7 +11,6 @@ /** * @internal * @psalm-internal Typhoon\Type - * @implements Type> */ final class NonEmptyArrayType implements Type { diff --git a/src/Type/Internal/NotType.php b/src/Type/Internal/NotType.php index 33b91de2..4afd1592 100644 --- a/src/Type/Internal/NotType.php +++ b/src/Type/Internal/NotType.php @@ -10,7 +10,6 @@ /** * @internal * @psalm-internal Typhoon\Type - * @implements Type */ final class NotType implements Type { diff --git a/src/Type/Internal/ObjectType.php b/src/Type/Internal/ObjectType.php index 73dd6665..28019129 100644 --- a/src/Type/Internal/ObjectType.php +++ b/src/Type/Internal/ObjectType.php @@ -11,7 +11,6 @@ /** * @internal * @psalm-internal Typhoon\Type - * @implements Type */ final class ObjectType implements Type { diff --git a/src/Type/Internal/OffsetType.php b/src/Type/Internal/OffsetType.php index ac820557..ae937769 100644 --- a/src/Type/Internal/OffsetType.php +++ b/src/Type/Internal/OffsetType.php @@ -10,7 +10,6 @@ /** * @internal * @psalm-internal Typhoon\Type - * @implements Type */ final class OffsetType implements Type { diff --git a/src/Type/Internal/ParentType.php b/src/Type/Internal/ParentType.php index 3a2771d4..894c901b 100644 --- a/src/Type/Internal/ParentType.php +++ b/src/Type/Internal/ParentType.php @@ -11,7 +11,6 @@ /** * @internal * @psalm-internal Typhoon\Type - * @implements Type */ final class ParentType implements Type { diff --git a/src/Type/Internal/SelfType.php b/src/Type/Internal/SelfType.php index c28a9b31..046568c9 100644 --- a/src/Type/Internal/SelfType.php +++ b/src/Type/Internal/SelfType.php @@ -12,7 +12,6 @@ /** * @internal * @psalm-internal Typhoon\Type - * @implements Type */ final class SelfType implements Type { diff --git a/src/Type/Internal/StaticType.php b/src/Type/Internal/StaticType.php index f2679ed2..6a05c07a 100644 --- a/src/Type/Internal/StaticType.php +++ b/src/Type/Internal/StaticType.php @@ -12,7 +12,6 @@ /** * @internal * @psalm-internal Typhoon\Type - * @implements Type */ final class StaticType implements Type { diff --git a/src/Type/Internal/StringValueType.php b/src/Type/Internal/StringValueType.php index 4a6e404e..2f2a3b9f 100644 --- a/src/Type/Internal/StringValueType.php +++ b/src/Type/Internal/StringValueType.php @@ -10,14 +10,9 @@ /** * @internal * @psalm-internal Typhoon\Type - * @template-covariant TValue of string - * @implements Type */ final class StringValueType implements Type { - /** - * @param TValue $value - */ public function __construct( private readonly string $value, ) {} diff --git a/src/Type/Internal/TemplateType.php b/src/Type/Internal/TemplateType.php index b2434e6d..4b925bf3 100644 --- a/src/Type/Internal/TemplateType.php +++ b/src/Type/Internal/TemplateType.php @@ -11,7 +11,6 @@ /** * @internal * @psalm-internal Typhoon\Type - * @implements Type */ final class TemplateType implements Type { diff --git a/src/Type/Internal/UnionType.php b/src/Type/Internal/UnionType.php index 3a140a3b..7f716a4c 100644 --- a/src/Type/Internal/UnionType.php +++ b/src/Type/Internal/UnionType.php @@ -10,13 +10,11 @@ /** * @internal * @psalm-internal Typhoon\Type - * @template-covariant TType - * @implements Type */ final class UnionType implements Type { /** - * @param non-empty-list> $types + * @param non-empty-list $types */ public function __construct( private readonly array $types, diff --git a/src/Type/Internal/VarianceAwareType.php b/src/Type/Internal/VarianceAwareType.php index f7ea0389..7e58a015 100644 --- a/src/Type/Internal/VarianceAwareType.php +++ b/src/Type/Internal/VarianceAwareType.php @@ -11,14 +11,9 @@ /** * @internal * @psalm-internal Typhoon\Type - * @template-covariant TType - * @implements Type */ final class VarianceAwareType implements Type { - /** - * @param Type $type - */ public function __construct( private readonly Type $type, private readonly Variance $variance, diff --git a/src/Type/Parameter.php b/src/Type/Parameter.php index eb7c9ae1..88265de6 100644 --- a/src/Type/Parameter.php +++ b/src/Type/Parameter.php @@ -6,13 +6,9 @@ /** * @api - * @template-covariant TType */ final class Parameter { - /** - * @param Type $type - */ public function __construct( public readonly Type $type = types::mixed, public readonly bool $hasDefault = false, diff --git a/src/Type/ShapeElement.php b/src/Type/ShapeElement.php index c6f1fb40..424bd79a 100644 --- a/src/Type/ShapeElement.php +++ b/src/Type/ShapeElement.php @@ -6,13 +6,9 @@ /** * @api - * @template-covariant TType */ final class ShapeElement { - /** - * @param Type $type - */ public function __construct( public readonly Type $type, public readonly bool $optional = false, diff --git a/src/Type/Type.php b/src/Type/Type.php index 0a1229aa..01256a81 100644 --- a/src/Type/Type.php +++ b/src/Type/Type.php @@ -6,7 +6,6 @@ /** * @api - * @template-covariant TType */ interface Type { diff --git a/src/Type/types.php b/src/Type/types.php index 19e50d02..fd8bb326 100644 --- a/src/Type/types.php +++ b/src/Type/types.php @@ -16,7 +16,6 @@ /** * @api - * @implements Type */ enum types implements Type { @@ -57,19 +56,11 @@ enum types implements Type case scalar; case mixed; - /** - * @template TValue of int - * @param TValue $value - * @return Type - */ public static function int(int $value): Type { return new Internal\IntValueType($value); } - /** - * @return Type - */ public static function intRange(int|Type $min = self::PHP_INT_MIN, int|Type $max = self::PHP_INT_MAX): Type { return match (true) { @@ -89,7 +80,6 @@ public static function intRange(int|Type $min = self::PHP_INT_MIN, int|Type $max * @no-named-arguments * @param positive-int $value * @param positive-int ...$values - * @return Type */ public static function intMask(int $value, int ...$values): Type { @@ -99,27 +89,16 @@ public static function intMask(int $value, int ...$values): Type ))); } - /** - * @return Type - */ public static function intMaskOf(Type $type): Type { return new Internal\IntMaskType($type); } - /** - * @template TValue of float - * @param TValue $value - * @return Type - */ public static function float(float $value): Type { return new Internal\FloatValueType($value); } - /** - * @return Type - */ public static function floatRange(int|float|Type $min = self::PHP_FLOAT_MIN, int|float|Type $max = self::PHP_FLOAT_MAX): Type { if ($min === self::PHP_FLOAT_MIN && $max === self::PHP_FLOAT_MAX) { @@ -140,21 +119,11 @@ public static function floatRange(int|float|Type $min = self::PHP_FLOAT_MIN, int ); } - /** - * @template TType - * @param Type $type - * @return Type - */ public static function literal(Type $type): Type { return new Internal\LiteralType($type); } - /** - * @template TValue of string - * @param TValue $value - * @return Type - */ public static function string(string $value): Type { return new Internal\StringValueType($value); @@ -173,17 +142,11 @@ public static function classString(Type $class): Type return new Internal\ClassStringType($class); } - /** - * @return Type> - */ public static function list(Type $value = self::mixed): Type { return new Internal\ListType($value, []); } - /** - * @return Type> - */ public static function nonEmptyList(Type $value = self::mixed): Type { return new Internal\ListType($value, [new ShapeElement($value)]); @@ -191,7 +154,6 @@ public static function nonEmptyList(Type $value = self::mixed): Type /** * @param list $elements - * @return Type> */ public static function listShape(array $elements = []): Type { @@ -200,7 +162,6 @@ public static function listShape(array $elements = []): Type /** * @param array $elements - * @return Type> */ public static function unsealedListShape(array $elements = [], Type $value = self::mixed): Type { @@ -210,9 +171,6 @@ public static function unsealedListShape(array $elements = [], Type $value = sel )); } - /** - * @return Type> - */ public static function array(Type $key = self::arrayKey, Type $value = self::mixed): Type { if ($key === self::arrayKey && $value === self::mixed) { @@ -222,9 +180,6 @@ public static function array(Type $key = self::arrayKey, Type $value = self::mix return new Internal\ArrayType($key, $value, []); } - /** - * @return Type> - */ public static function nonEmptyArray(Type $key = self::arrayKey, Type $value = self::mixed): Type { return new Internal\NonEmptyArrayType($key, $value); @@ -232,7 +187,6 @@ public static function nonEmptyArray(Type $key = self::arrayKey, Type $value = s /** * @param array $elements - * @return Type> */ public static function arrayShape(array $elements = []): Type { @@ -241,7 +195,6 @@ public static function arrayShape(array $elements = []): Type /** * @param array $elements - * @return Type> */ public static function unsealedArrayShape(array $elements = [], Type $key = self::arrayKey, Type $value = self::mixed): Type { @@ -251,13 +204,6 @@ public static function unsealedArrayShape(array $elements = [], Type $key = self )); } - /** - * @template TKey - * @template TValue - * @param Type $key - * @param Type $value - * @return Type> - */ public static function iterable(Type $key = self::mixed, Type $value = self::mixed): Type { if ($key === self::mixed && $value === self::mixed) { @@ -282,11 +228,6 @@ public static function offset(Type $array, Type $key): Type return new Internal\OffsetType($array, $key); } - /** - * @template TType - * @param Type $type - * @return ShapeElement - */ public static function optional(Type $type): ShapeElement { return new ShapeElement($type, true); @@ -295,7 +236,6 @@ public static function optional(Type $type): ShapeElement /** * @param non-empty-string|NamedClassId|AnonymousClassId $class * @param list $arguments - * @return Type */ public static function object(string|NamedClassId|AnonymousClassId $class, array $arguments = []): Type { @@ -317,7 +257,6 @@ public static function Generator(Type $key = self::mixed, Type $value = self::mi /** * @param array $properties - * @return Type */ public static function objectShape(array $properties = []): Type { @@ -371,10 +310,7 @@ public static function static(array $arguments = [], null|string|NamedClassId|An } /** - * @template TReturn * @param list $parameters - * @param Type $return - * @return Type */ public static function callable(array $parameters = [], Type $return = self::mixed): Type { @@ -392,9 +328,7 @@ public static function callable(array $parameters = [], Type $return = self::mix } /** - * @template TReturn * @param list $parameters - * @param Type $return */ public static function callableString(array $parameters = [], Type $return = self::mixed): Type { @@ -402,9 +336,7 @@ public static function callableString(array $parameters = [], Type $return = sel } /** - * @template TReturn * @param list $parameters - * @param Type $return */ public static function callableArray(array $parameters = [], Type $return = self::mixed): Type { @@ -413,7 +345,6 @@ public static function callableArray(array $parameters = [], Type $return = self /** * @param list $parameters - * @return Type<\Closure> */ public static function Closure(array $parameters = [], Type $return = self::mixed): Type { @@ -433,11 +364,6 @@ public static function Closure(array $parameters = [], Type $return = self::mixe ]); } - /** - * @template TType - * @param Type $type - * @return Parameter - */ public static function param(Type $type = self::mixed, bool $hasDefault = false, bool $variadic = false, bool $byReference = false): Parameter { return new Parameter($type, $hasDefault, $variadic, $byReference); @@ -543,11 +469,6 @@ public static function methodTemplate(string|NamedClassId|AnonymousClassId $clas return new Internal\TemplateType(Id::template(Id::method($class, $method), $name)); } - /** - * @template TType - * @param Type $type - * @return Type - */ public static function varianceAware(Type $type, Variance $variance): Type { return new Internal\VarianceAwareType($type, $variance); @@ -555,9 +476,6 @@ public static function varianceAware(Type $type, Variance $variance): Type /** * @no-named-arguments - * @template TType - * @param Type ...$types - * @return Type */ public static function union(Type ...$types): Type { @@ -568,11 +486,6 @@ public static function union(Type ...$types): Type }; } - /** - * @template TType - * @param Type $type - * @return Type - */ public static function nullable(Type $type): Type { return new Internal\UnionType([self::null, $type]);