diff --git a/src/Psl/Type/Internal/ArrayKeyType.php b/src/Psl/Type/Internal/ArrayKeyType.php index 02834fe3..f12df41b 100644 --- a/src/Psl/Type/Internal/ArrayKeyType.php +++ b/src/Psl/Type/Internal/ArrayKeyType.php @@ -12,7 +12,7 @@ * * @internal */ -final class ArrayKeyType extends UnionType +final readonly class ArrayKeyType extends UnionType { /** * @psalm-mutation-free diff --git a/src/Psl/Type/Internal/BackedEnumType.php b/src/Psl/Type/Internal/BackedEnumType.php index b64f4c0d..563122f1 100644 --- a/src/Psl/Type/Internal/BackedEnumType.php +++ b/src/Psl/Type/Internal/BackedEnumType.php @@ -15,7 +15,7 @@ * * @extends Type\Type */ -final class BackedEnumType extends Type\Type +final readonly class BackedEnumType extends Type\Type { /** * @psalm-mutation-free diff --git a/src/Psl/Type/Internal/BoolType.php b/src/Psl/Type/Internal/BoolType.php index 810c03b7..39e67360 100644 --- a/src/Psl/Type/Internal/BoolType.php +++ b/src/Psl/Type/Internal/BoolType.php @@ -15,7 +15,7 @@ * * @internal */ -final class BoolType extends Type\Type +final readonly class BoolType extends Type\Type { /** * @psalm-assert-if-true bool $value diff --git a/src/Psl/Type/Internal/ClassStringType.php b/src/Psl/Type/Internal/ClassStringType.php index a31ab188..a441849c 100644 --- a/src/Psl/Type/Internal/ClassStringType.php +++ b/src/Psl/Type/Internal/ClassStringType.php @@ -15,7 +15,7 @@ * * @internal */ -final class ClassStringType extends Type +final readonly class ClassStringType extends Type { /** * @var class-string $classname diff --git a/src/Psl/Type/Internal/ConvertedType.php b/src/Psl/Type/Internal/ConvertedType.php index a80a0a0d..1a40340b 100644 --- a/src/Psl/Type/Internal/ConvertedType.php +++ b/src/Psl/Type/Internal/ConvertedType.php @@ -21,7 +21,7 @@ * * @internal */ -final class ConvertedType extends Type\Type +final readonly class ConvertedType extends Type\Type { /** * @psalm-mutation-free diff --git a/src/Psl/Type/Internal/DictType.php b/src/Psl/Type/Internal/DictType.php index a37908e7..9847745f 100644 --- a/src/Psl/Type/Internal/DictType.php +++ b/src/Psl/Type/Internal/DictType.php @@ -20,7 +20,7 @@ * * @internal */ -final class DictType extends Type\Type +final readonly class DictType extends Type\Type { /** * @psalm-mutation-free diff --git a/src/Psl/Type/Internal/F32Type.php b/src/Psl/Type/Internal/F32Type.php index 94dfc10f..3702c9bd 100644 --- a/src/Psl/Type/Internal/F32Type.php +++ b/src/Psl/Type/Internal/F32Type.php @@ -18,7 +18,7 @@ * * @internal */ -final class F32Type extends Type\Type +final readonly class F32Type extends Type\Type { /** * @ara-assert-if-true f32 $value diff --git a/src/Psl/Type/Internal/F64Type.php b/src/Psl/Type/Internal/F64Type.php index f9362c69..2c2cea12 100644 --- a/src/Psl/Type/Internal/F64Type.php +++ b/src/Psl/Type/Internal/F64Type.php @@ -17,7 +17,7 @@ * * @internal */ -final class F64Type extends Type\Type +final readonly class F64Type extends Type\Type { /** * @ara-assert-if-true f64 $value diff --git a/src/Psl/Type/Internal/FloatType.php b/src/Psl/Type/Internal/FloatType.php index 8cd79699..0621fe7d 100644 --- a/src/Psl/Type/Internal/FloatType.php +++ b/src/Psl/Type/Internal/FloatType.php @@ -19,7 +19,7 @@ * * @internal */ -final class FloatType extends Type\Type +final readonly class FloatType extends Type\Type { /** * @psalm-assert-if-true float $value diff --git a/src/Psl/Type/Internal/I16Type.php b/src/Psl/Type/Internal/I16Type.php index a49c4b12..104077a0 100644 --- a/src/Psl/Type/Internal/I16Type.php +++ b/src/Psl/Type/Internal/I16Type.php @@ -18,7 +18,7 @@ * * @internal */ -final class I16Type extends Type\Type +final readonly class I16Type extends Type\Type { /** * @ara-assert-if-true i16 $value diff --git a/src/Psl/Type/Internal/I32Type.php b/src/Psl/Type/Internal/I32Type.php index dfb13a58..a0d0937d 100644 --- a/src/Psl/Type/Internal/I32Type.php +++ b/src/Psl/Type/Internal/I32Type.php @@ -19,7 +19,7 @@ * * @internal */ -final class I32Type extends Type\Type +final readonly class I32Type extends Type\Type { /** * @ara-assert-if-true i32 $value diff --git a/src/Psl/Type/Internal/I64Type.php b/src/Psl/Type/Internal/I64Type.php index f3cb0e08..0a47da1c 100644 --- a/src/Psl/Type/Internal/I64Type.php +++ b/src/Psl/Type/Internal/I64Type.php @@ -17,7 +17,7 @@ * * @internal */ -final class I64Type extends Type\Type +final readonly class I64Type extends Type\Type { /** * @ara-assert-if-true i64 $value diff --git a/src/Psl/Type/Internal/I8Type.php b/src/Psl/Type/Internal/I8Type.php index 71fc2cfc..0f799ac0 100644 --- a/src/Psl/Type/Internal/I8Type.php +++ b/src/Psl/Type/Internal/I8Type.php @@ -18,7 +18,7 @@ * * @internal */ -final class I8Type extends Type\Type +final readonly class I8Type extends Type\Type { /** * @ara-assert-if-true i8 $value diff --git a/src/Psl/Type/Internal/InstanceOfType.php b/src/Psl/Type/Internal/InstanceOfType.php index 02296fa5..15d8ae92 100644 --- a/src/Psl/Type/Internal/InstanceOfType.php +++ b/src/Psl/Type/Internal/InstanceOfType.php @@ -15,7 +15,7 @@ * * @internal */ -final class InstanceOfType extends Type +final readonly class InstanceOfType extends Type { /** * @var class-string $classname diff --git a/src/Psl/Type/Internal/IntType.php b/src/Psl/Type/Internal/IntType.php index 5fbc27cd..ec55386d 100644 --- a/src/Psl/Type/Internal/IntType.php +++ b/src/Psl/Type/Internal/IntType.php @@ -19,7 +19,7 @@ * * @internal */ -final class IntType extends Type\Type +final readonly class IntType extends Type\Type { /** * @psalm-assert-if-true int $value diff --git a/src/Psl/Type/Internal/IntersectionType.php b/src/Psl/Type/Internal/IntersectionType.php index 99d01614..cf249013 100644 --- a/src/Psl/Type/Internal/IntersectionType.php +++ b/src/Psl/Type/Internal/IntersectionType.php @@ -19,7 +19,7 @@ * * @internal */ -final class IntersectionType extends Type +final readonly class IntersectionType extends Type { /** * @psalm-mutation-free diff --git a/src/Psl/Type/Internal/IterableType.php b/src/Psl/Type/Internal/IterableType.php index d91cabfd..accd8d66 100644 --- a/src/Psl/Type/Internal/IterableType.php +++ b/src/Psl/Type/Internal/IterableType.php @@ -21,7 +21,7 @@ * * @internal */ -final class IterableType extends Type\Type +final readonly class IterableType extends Type\Type { /** * @psalm-mutation-free diff --git a/src/Psl/Type/Internal/LiteralScalarType.php b/src/Psl/Type/Internal/LiteralScalarType.php index 402a6be6..ec5c0d83 100644 --- a/src/Psl/Type/Internal/LiteralScalarType.php +++ b/src/Psl/Type/Internal/LiteralScalarType.php @@ -16,7 +16,7 @@ * * @internal */ -final class LiteralScalarType extends Type\Type +final readonly class LiteralScalarType extends Type\Type { /** * @psalm-mutation-free diff --git a/src/Psl/Type/Internal/MapType.php b/src/Psl/Type/Internal/MapType.php index 315bdd1e..f2eacb16 100644 --- a/src/Psl/Type/Internal/MapType.php +++ b/src/Psl/Type/Internal/MapType.php @@ -23,7 +23,7 @@ * * @internal */ -final class MapType extends Type\Type +final readonly class MapType extends Type\Type { /** * @psalm-mutation-free diff --git a/src/Psl/Type/Internal/MixedDictType.php b/src/Psl/Type/Internal/MixedDictType.php index a63d7056..fa25c376 100644 --- a/src/Psl/Type/Internal/MixedDictType.php +++ b/src/Psl/Type/Internal/MixedDictType.php @@ -14,7 +14,7 @@ * * @internal */ -final class MixedDictType extends Type\Type +final readonly class MixedDictType extends Type\Type { /** * @throws CoercionException diff --git a/src/Psl/Type/Internal/MixedType.php b/src/Psl/Type/Internal/MixedType.php index c51015e7..aac44e7b 100644 --- a/src/Psl/Type/Internal/MixedType.php +++ b/src/Psl/Type/Internal/MixedType.php @@ -11,7 +11,7 @@ * * @internal */ -final class MixedType extends Type +final readonly class MixedType extends Type { /** * @psalm-assert-if-true mixed $value diff --git a/src/Psl/Type/Internal/MixedVecType.php b/src/Psl/Type/Internal/MixedVecType.php index d94f62d0..8ba485d0 100644 --- a/src/Psl/Type/Internal/MixedVecType.php +++ b/src/Psl/Type/Internal/MixedVecType.php @@ -13,7 +13,7 @@ * * @internal */ -final class MixedVecType extends Type\Type +final readonly class MixedVecType extends Type\Type { /** * @psalm-assert-if-true list $value diff --git a/src/Psl/Type/Internal/MutableMapType.php b/src/Psl/Type/Internal/MutableMapType.php index be89e1b1..8d947db1 100644 --- a/src/Psl/Type/Internal/MutableMapType.php +++ b/src/Psl/Type/Internal/MutableMapType.php @@ -23,7 +23,7 @@ * * @internal */ -final class MutableMapType extends Type\Type +final readonly class MutableMapType extends Type\Type { /** * @psalm-mutation-free diff --git a/src/Psl/Type/Internal/MutableVectorType.php b/src/Psl/Type/Internal/MutableVectorType.php index b8e3ea0c..785507e0 100644 --- a/src/Psl/Type/Internal/MutableVectorType.php +++ b/src/Psl/Type/Internal/MutableVectorType.php @@ -21,7 +21,7 @@ * * @internal */ -final class MutableVectorType extends Type\Type +final readonly class MutableVectorType extends Type\Type { /** * @psalm-mutation-free diff --git a/src/Psl/Type/Internal/NonEmptyDictType.php b/src/Psl/Type/Internal/NonEmptyDictType.php index 4187d5be..23aad44e 100644 --- a/src/Psl/Type/Internal/NonEmptyDictType.php +++ b/src/Psl/Type/Internal/NonEmptyDictType.php @@ -21,7 +21,7 @@ * * @internal */ -final class NonEmptyDictType extends Type\Type +final readonly class NonEmptyDictType extends Type\Type { /** * @psalm-mutation-free diff --git a/src/Psl/Type/Internal/NonEmptyStringType.php b/src/Psl/Type/Internal/NonEmptyStringType.php index ada92ce7..a3cb1c69 100644 --- a/src/Psl/Type/Internal/NonEmptyStringType.php +++ b/src/Psl/Type/Internal/NonEmptyStringType.php @@ -17,7 +17,7 @@ * * @internal */ -final class NonEmptyStringType extends Type\Type +final readonly class NonEmptyStringType extends Type\Type { /** * @psalm-assert-if-true non-empty-string $value diff --git a/src/Psl/Type/Internal/NonEmptyVecType.php b/src/Psl/Type/Internal/NonEmptyVecType.php index e88cb3b2..52b44976 100644 --- a/src/Psl/Type/Internal/NonEmptyVecType.php +++ b/src/Psl/Type/Internal/NonEmptyVecType.php @@ -20,7 +20,7 @@ * * @internal */ -final class NonEmptyVecType extends Type\Type +final readonly class NonEmptyVecType extends Type\Type { /** * @psalm-mutation-free diff --git a/src/Psl/Type/Internal/NonNullType.php b/src/Psl/Type/Internal/NonNullType.php index 92294ae0..fc428930 100644 --- a/src/Psl/Type/Internal/NonNullType.php +++ b/src/Psl/Type/Internal/NonNullType.php @@ -15,7 +15,7 @@ * * @internal */ -final class NonNullType extends Type\Type +final readonly class NonNullType extends Type\Type { /** * @psalm-assert-if-true mixed $value diff --git a/src/Psl/Type/Internal/NullType.php b/src/Psl/Type/Internal/NullType.php index a1396efd..869125c3 100644 --- a/src/Psl/Type/Internal/NullType.php +++ b/src/Psl/Type/Internal/NullType.php @@ -13,7 +13,7 @@ * * @internal */ -final class NullType extends Type\Type +final readonly class NullType extends Type\Type { /** * @psalm-assert-if-true null $value diff --git a/src/Psl/Type/Internal/NullableType.php b/src/Psl/Type/Internal/NullableType.php index 828fcd19..5cf0b4c2 100644 --- a/src/Psl/Type/Internal/NullableType.php +++ b/src/Psl/Type/Internal/NullableType.php @@ -15,7 +15,7 @@ * * @internal */ -final class NullableType extends Type\Type +final readonly class NullableType extends Type\Type { /** * @psalm-mutation-free diff --git a/src/Psl/Type/Internal/NumType.php b/src/Psl/Type/Internal/NumType.php index 11434d3a..aa4a40ea 100644 --- a/src/Psl/Type/Internal/NumType.php +++ b/src/Psl/Type/Internal/NumType.php @@ -9,7 +9,7 @@ * * @internal */ -final class NumType extends UnionType +final readonly class NumType extends UnionType { /** * @psalm-mutation-free diff --git a/src/Psl/Type/Internal/NumericStringType.php b/src/Psl/Type/Internal/NumericStringType.php index 0deccf9d..3ca35a68 100644 --- a/src/Psl/Type/Internal/NumericStringType.php +++ b/src/Psl/Type/Internal/NumericStringType.php @@ -17,7 +17,7 @@ * * @internal */ -final class NumericStringType extends Type\Type +final readonly class NumericStringType extends Type\Type { /** * @psalm-assert-if-true numeric-string $value diff --git a/src/Psl/Type/Internal/ObjectType.php b/src/Psl/Type/Internal/ObjectType.php index 56f03cdc..2181c65c 100644 --- a/src/Psl/Type/Internal/ObjectType.php +++ b/src/Psl/Type/Internal/ObjectType.php @@ -15,7 +15,7 @@ * * @internal */ -final class ObjectType extends Type +final readonly class ObjectType extends Type { /** * @psalm-assert-if-true T $value diff --git a/src/Psl/Type/Internal/OptionalType.php b/src/Psl/Type/Internal/OptionalType.php index f330e74b..db3b3111 100644 --- a/src/Psl/Type/Internal/OptionalType.php +++ b/src/Psl/Type/Internal/OptionalType.php @@ -15,7 +15,7 @@ * * @internal */ -final class OptionalType extends Type\Type +final readonly class OptionalType extends Type\Type { /** * @psalm-mutation-free diff --git a/src/Psl/Type/Internal/PathExpression.php b/src/Psl/Type/Internal/PathExpression.php index d26bd68c..dc57c0cc 100644 --- a/src/Psl/Type/Internal/PathExpression.php +++ b/src/Psl/Type/Internal/PathExpression.php @@ -14,7 +14,7 @@ * This class can be used for building the "path" parts of an exception message. * It is introduced to make sure the same path formatting is used when constructing the exception message. */ -final class PathExpression +final readonly class PathExpression { /** * @pure diff --git a/src/Psl/Type/Internal/PositiveIntType.php b/src/Psl/Type/Internal/PositiveIntType.php index 4ad723bb..79acbb24 100644 --- a/src/Psl/Type/Internal/PositiveIntType.php +++ b/src/Psl/Type/Internal/PositiveIntType.php @@ -19,7 +19,7 @@ * * @internal */ -final class PositiveIntType extends Type\Type +final readonly class PositiveIntType extends Type\Type { /** * @psalm-assert-if-true positive-int $value diff --git a/src/Psl/Type/Internal/ResourceType.php b/src/Psl/Type/Internal/ResourceType.php index 1f82c446..4af47667 100644 --- a/src/Psl/Type/Internal/ResourceType.php +++ b/src/Psl/Type/Internal/ResourceType.php @@ -16,7 +16,7 @@ * * @internal */ -final class ResourceType extends Type\Type +final readonly class ResourceType extends Type\Type { /** * @psalm-mutation-free diff --git a/src/Psl/Type/Internal/ScalarType.php b/src/Psl/Type/Internal/ScalarType.php index 13a634dc..cec90cf4 100644 --- a/src/Psl/Type/Internal/ScalarType.php +++ b/src/Psl/Type/Internal/ScalarType.php @@ -9,7 +9,7 @@ * * @internal */ -final class ScalarType extends UnionType +final readonly class ScalarType extends UnionType { /** * @psalm-mutation-free diff --git a/src/Psl/Type/Internal/ShapeType.php b/src/Psl/Type/Internal/ShapeType.php index 0e307353..fd24039a 100644 --- a/src/Psl/Type/Internal/ShapeType.php +++ b/src/Psl/Type/Internal/ShapeType.php @@ -26,7 +26,7 @@ * * @extends Type\Type> */ -final class ShapeType extends Type\Type +final readonly class ShapeType extends Type\Type { /** * @var array> diff --git a/src/Psl/Type/Internal/StringType.php b/src/Psl/Type/Internal/StringType.php index 5eaeb7f8..c4a01679 100644 --- a/src/Psl/Type/Internal/StringType.php +++ b/src/Psl/Type/Internal/StringType.php @@ -17,7 +17,7 @@ * * @internal */ -final class StringType extends Type\Type +final readonly class StringType extends Type\Type { /** * @psalm-assert-if-true string $value diff --git a/src/Psl/Type/Internal/U16Type.php b/src/Psl/Type/Internal/U16Type.php index b630ebe8..3e5dce8b 100644 --- a/src/Psl/Type/Internal/U16Type.php +++ b/src/Psl/Type/Internal/U16Type.php @@ -19,7 +19,7 @@ * * @internal */ -final class U16Type extends Type\Type +final readonly class U16Type extends Type\Type { /** * @ara-assert-if-true u16 $value diff --git a/src/Psl/Type/Internal/U32Type.php b/src/Psl/Type/Internal/U32Type.php index 1888afa9..e749fce6 100644 --- a/src/Psl/Type/Internal/U32Type.php +++ b/src/Psl/Type/Internal/U32Type.php @@ -19,7 +19,7 @@ * * @internal */ -final class U32Type extends Type\Type +final readonly class U32Type extends Type\Type { /** * @ara-assert-if-true u32 $value diff --git a/src/Psl/Type/Internal/U8Type.php b/src/Psl/Type/Internal/U8Type.php index 2411a578..4bca7c93 100644 --- a/src/Psl/Type/Internal/U8Type.php +++ b/src/Psl/Type/Internal/U8Type.php @@ -19,7 +19,7 @@ * * @internal */ -final class U8Type extends Type\Type +final readonly class U8Type extends Type\Type { /** * @ara-assert-if-true u8 $value diff --git a/src/Psl/Type/Internal/UIntType.php b/src/Psl/Type/Internal/UIntType.php index 58e41ef2..d195cbdc 100644 --- a/src/Psl/Type/Internal/UIntType.php +++ b/src/Psl/Type/Internal/UIntType.php @@ -21,7 +21,7 @@ * * @internal */ -final class UIntType extends Type\Type +final readonly class UIntType extends Type\Type { /** * @ara-assert-if-true unit $value diff --git a/src/Psl/Type/Internal/UnionType.php b/src/Psl/Type/Internal/UnionType.php index 7ad95c63..a6c76ac5 100644 --- a/src/Psl/Type/Internal/UnionType.php +++ b/src/Psl/Type/Internal/UnionType.php @@ -17,7 +17,8 @@ * * @internal */ -class UnionType extends Type\Type + +readonly class UnionType extends Type\Type { /** * @psalm-mutation-free diff --git a/src/Psl/Type/Internal/UnitEnumType.php b/src/Psl/Type/Internal/UnitEnumType.php index 58b27b6d..e61d60ce 100644 --- a/src/Psl/Type/Internal/UnitEnumType.php +++ b/src/Psl/Type/Internal/UnitEnumType.php @@ -15,7 +15,7 @@ * * @extends Type\Type */ -final class UnitEnumType extends Type\Type +final readonly class UnitEnumType extends Type\Type { /** * @psalm-mutation-free diff --git a/src/Psl/Type/Internal/VecType.php b/src/Psl/Type/Internal/VecType.php index afab71af..60c0bf19 100644 --- a/src/Psl/Type/Internal/VecType.php +++ b/src/Psl/Type/Internal/VecType.php @@ -20,7 +20,7 @@ * * @internal */ -final class VecType extends Type\Type +final readonly class VecType extends Type\Type { /** * @psalm-mutation-free diff --git a/src/Psl/Type/Internal/VectorType.php b/src/Psl/Type/Internal/VectorType.php index c223453d..9fe59e49 100644 --- a/src/Psl/Type/Internal/VectorType.php +++ b/src/Psl/Type/Internal/VectorType.php @@ -21,7 +21,7 @@ * * @internal */ -final class VectorType extends Type\Type +final readonly class VectorType extends Type\Type { /** * @psalm-mutation-free diff --git a/src/Psl/Type/Type.php b/src/Psl/Type/Type.php index 1935157b..226c9b18 100644 --- a/src/Psl/Type/Type.php +++ b/src/Psl/Type/Type.php @@ -11,7 +11,7 @@ * * @implements TypeInterface */ -abstract class Type implements TypeInterface +abstract readonly class Type implements TypeInterface { /** * @psalm-assert-if-true T $value diff --git a/tests/unit/Class/ClassTest.php b/tests/unit/Class/ClassTest.php index 379577eb..dd7d0884 100644 --- a/tests/unit/Class/ClassTest.php +++ b/tests/unit/Class/ClassTest.php @@ -52,7 +52,7 @@ public function provideData(): iterable yield [Collection\MutableVector::class, true, true, false, false, ['first', 'last'], []]; yield [Collection\Map::class, true, true, true, false, ['first', 'last'], []]; yield [Collection\MutableMap::class, true, true, false, false, ['first', 'last'], []]; - yield [Type\Type::class, true, false, false, true, ['matches', 'isOptional'], []]; + yield [Type\Type::class, true, false, true, true, ['matches', 'isOptional'], []]; yield ['Psl\\Not\\Class', false, false, false, false, [], []]; }