Skip to content

Commit bcaf045

Browse files
committed
Remove final keyword from all typed value classes for flexibility
- Updated definitions of classes (`NonNegativeFloat`, `WeekDayInt`, `StringBasic`, `DateTimeAtom`, `IntegerBasic`, `NonEmptyStr`, `PositiveInt`, `NonNegativeInt`, `FloatBasic`) to remove `final` keyword. - Adjusted architecture tests to reflect changes, ensuring only `readonly` checks are enforced.
1 parent 72571db commit bcaf045

File tree

10 files changed

+9
-13
lines changed

10 files changed

+9
-13
lines changed

src/DateTime/DateTimeAtom.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
*
1717
* @psalm-immutable
1818
*/
19-
final readonly class DateTimeAtom extends DateTimeType
19+
readonly class DateTimeAtom extends DateTimeType
2020
{
2121
protected const FORMAT = DATE_ATOM;
2222

src/Float/FloatBasic.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
*
1313
* @psalm-immutable
1414
*/
15-
final readonly class FloatBasic extends FloatType
15+
readonly class FloatBasic extends FloatType
1616
{
1717
protected float $value;
1818

src/Float/NonNegativeFloat.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
/**
1212
* @psalm-immutable
1313
*/
14-
final readonly class NonNegativeFloat extends FloatType
14+
readonly class NonNegativeFloat extends FloatType
1515
{
1616
protected float $value;
1717

src/Integer/IntegerBasic.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
/**
1111
* @psalm-immutable
1212
*/
13-
final readonly class IntegerBasic extends IntType
13+
readonly class IntegerBasic extends IntType
1414
{
1515
protected int $value;
1616

src/Integer/NonNegativeInt.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
/**
1212
* @psalm-immutable
1313
*/
14-
final readonly class NonNegativeInt extends IntType
14+
readonly class NonNegativeInt extends IntType
1515
{
1616
/** @var non-negative-int */
1717
protected int $value;

src/Integer/PositiveInt.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
/**
1212
* @psalm-immutable
1313
*/
14-
final readonly class PositiveInt extends IntType
14+
readonly class PositiveInt extends IntType
1515
{
1616
/** @var positive-int */
1717
protected int $value;

src/Integer/WeekDayInt.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
/**
1212
* @psalm-immutable
1313
*/
14-
final readonly class WeekDayInt extends IntType
14+
readonly class WeekDayInt extends IntType
1515
{
1616
/** @var int<1, 7> */
1717
protected int $value;

src/String/NonEmptyStr.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
/**
1212
* @psalm-immutable
1313
*/
14-
final readonly class NonEmptyStr extends StrType
14+
readonly class NonEmptyStr extends StrType
1515
{
1616
/** @var non-empty-string */
1717
protected string $value;

src/String/StringBasic.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
*
1212
* @psalm-immutable
1313
*/
14-
final readonly class StringBasic extends StrType
14+
readonly class StringBasic extends StrType
1515
{
1616
protected string $value;
1717

tests/Arch/StructureTest.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,26 +17,22 @@
1717
->expect('PhpTypedValues\Integer')
1818
->toExtend(IntType::class)
1919
->toBeClasses()
20-
->toBeFinal()
2120
->toBeReadonly();
2221

2322
arch('Float classes are final and read-only')
2423
->expect('PhpTypedValues\Float')
2524
->toExtend(FloatType::class)
2625
->toBeClasses()
27-
->toBeFinal()
2826
->toBeReadonly();
2927

3028
arch('String classes are final and read-only')
3129
->expect('PhpTypedValues\String')
3230
->toExtend(StrType::class)
3331
->toBeClasses()
34-
->toBeFinal()
3532
->toBeReadonly();
3633

3734
arch('Datetime classes are final and read-only')
3835
->expect('PhpTypedValues\DateTime')
3936
->toExtend(DateTimeType::class)
4037
->toBeClasses()
41-
->toBeFinal()
4238
->toBeReadonly();

0 commit comments

Comments
 (0)