From 5cd3a821ecc82e44732a65826b9d08e5dca07379 Mon Sep 17 00:00:00 2001 From: Andrea Marco Sartori Date: Wed, 15 Jan 2025 00:14:08 +0100 Subject: [PATCH 1/3] Remove unneeded readonly modifiers --- src/Services/Annotator.php | 4 ++-- src/Services/Generator.php | 2 +- src/Services/Inspector.php | 4 ++-- src/Services/MethodAnnotations.php | 4 ++-- src/Services/TypeScript.php | 4 ++-- src/Services/UseStatements.php | 4 ++-- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/Services/Annotator.php b/src/Services/Annotator.php index a4bf270..2197cbb 100644 --- a/src/Services/Annotator.php +++ b/src/Services/Annotator.php @@ -42,7 +42,7 @@ class Annotator * * @var Inspector */ - protected readonly Inspector $inspector; + protected Inspector $inspector; /** * Instantiate the class. @@ -50,7 +50,7 @@ class Annotator * @param class-string $enum * @throws InvalidArgumentException */ - public function __construct(protected readonly string $enum) + public function __construct(protected string $enum) { $this->inspector = new Inspector($enum); } diff --git a/src/Services/Generator.php b/src/Services/Generator.php index ea90164..16d9584 100644 --- a/src/Services/Generator.php +++ b/src/Services/Generator.php @@ -17,7 +17,7 @@ class Generator /** * The enum being generated. */ - protected readonly GeneratingEnum $enum; + protected GeneratingEnum $enum; /** * Instantiate the class. diff --git a/src/Services/Inspector.php b/src/Services/Inspector.php index f70eb1b..7c9fe6a 100644 --- a/src/Services/Inspector.php +++ b/src/Services/Inspector.php @@ -28,7 +28,7 @@ class Inspector * * @var ReflectionEnum */ - protected readonly ReflectionEnum $reflection; + protected ReflectionEnum $reflection; /** * The method annotations. @@ -49,7 +49,7 @@ class Inspector * * @param class-string $enum */ - public function __construct(protected readonly string $enum) + public function __construct(protected string $enum) { $this->reflection = new ReflectionEnum($enum); diff --git a/src/Services/MethodAnnotations.php b/src/Services/MethodAnnotations.php index 7a188bd..8d0f213 100644 --- a/src/Services/MethodAnnotations.php +++ b/src/Services/MethodAnnotations.php @@ -32,8 +32,8 @@ class MethodAnnotations implements IteratorAggregate * @param Inspector $inspector */ public function __construct( - protected readonly Inspector $inspector, - protected readonly bool $includeExisting, + protected Inspector $inspector, + protected bool $includeExisting, ) {} /** diff --git a/src/Services/TypeScript.php b/src/Services/TypeScript.php index e4600de..b1e9844 100644 --- a/src/Services/TypeScript.php +++ b/src/Services/TypeScript.php @@ -18,14 +18,14 @@ class TypeScript /** * The TypeScript enums path. */ - protected readonly string $path; + protected string $path; /** * Instantiate the class. * * @param class-string $enum */ - public function __construct(protected readonly string $enum) + public function __construct(protected string $enum) { $this->path = Enums::basePath(Enums::typeScript($enum)); } diff --git a/src/Services/UseStatements.php b/src/Services/UseStatements.php index b28f4a8..b127c3f 100644 --- a/src/Services/UseStatements.php +++ b/src/Services/UseStatements.php @@ -31,8 +31,8 @@ class UseStatements implements IteratorAggregate * @param Inspector<\UnitEnum> $inspector */ public function __construct( - protected readonly Inspector $inspector, - protected readonly bool $includeExisting, + protected Inspector $inspector, + protected bool $includeExisting, ) {} /** From ec3b34722f7615f02acc6cfdcffdf2b5d634ef02 Mon Sep 17 00:00:00 2001 From: Andrea Marco Sartori Date: Wed, 15 Jan 2025 00:23:30 +0100 Subject: [PATCH 2/3] Update readme --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 1c68960..5fa85ca 100644 --- a/README.md +++ b/README.md @@ -149,7 +149,7 @@ BackedEnum::Two->color(); // green ``` > [!TIP] -> Our IDE can autocomplete meta methods thanks to the [`annotate` command](#-annotate). +> Our IDE can autocomplete meta methods thanks to the [`annotate` command](#%EF%B8%8F-annotate). `#[Meta]` attributes can also be attached to the enum itself to provide default values when a case does not declare its own meta values: @@ -319,7 +319,7 @@ BackedEnum::One(); // 1 ``` > [!TIP] -> Our IDE can autocomplete cases static methods thanks to the [`annotate` command](#-annotate). +> Our IDE can autocomplete cases static methods thanks to the [`annotate` command](#%EF%B8%8F-annotate). We can also obtain the name or value of a case by simply invoking it: @@ -340,7 +340,7 @@ BackedEnum::One->shape(); // 'triangle' ``` > [!TIP] -> Our IDE can autocomplete meta methods thanks to the [`annotate` command](#-annotate). +> Our IDE can autocomplete meta methods thanks to the [`annotate` command](#%EF%B8%8F-annotate). Depending on our needs, we can customize the default behavior of all enums in our application when invoking a case or calling inaccessible methods: @@ -500,7 +500,7 @@ php artisan enum:make App/Enums/Enum CaseOne CaseTwo --force php artisan enum:make App/Enums/Enum CaseOne CaseTwo -f ``` -Finally, we can generate the TypeScript counterpart of the newly created enum by adding the `--typescript` option: +We can generate the TypeScript counterpart of the newly created enum by adding the `--typescript` option: ```bash php artisan enum:make App/Enums/Enum CaseOne CaseTwo --typescript From ff0051524e411e13a0e17a4ca840490221743072 Mon Sep 17 00:00:00 2001 From: Andrea Marco Sartori Date: Wed, 15 Jan 2025 00:23:37 +0100 Subject: [PATCH 3/3] Update changelog --- CHANGELOG.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7353176..eb3af6a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,7 +26,13 @@ Updates should follow the [Keep a CHANGELOG](https://keepachangelog.com/) princi - Nothing -## 2.3.0 - 2024-12-22 +## 2.3.1 - 2025-01-15 + +### Changed +- Removed unneeded readonly modifiers + + +## 2.3.0 - 2025-01-12 ### Added - Enums discoverability