|
1 | 1 | # CHANGELOG |
2 | 2 |
|
| 3 | +## [v3.1.0] - 2025-10-29 |
| 4 | + |
| 5 | +### ⚠️Note |
| 6 | +> Starting from this release, the CHANGELOG will be maintained in English only.<br> |
| 7 | +> 自本版本後僅提供英文版 CHANGELOG,不再提供中文版內容。 |
| 8 | +
|
| 9 | +### Added |
| 10 | + |
| 11 | +* Added `fromArray()` and `fromJson()` as new object construction entry points. |
| 12 | + Direct instantiation via `new` is no longer recommended. |
| 13 | +* Added **Traditional Chinese documentation** `README_TW.md`, providing bilingual documentation and badges. |
| 14 | +* Added **class-based object APIs**: `ReallifeKip\ImmutableBase\Objects\{DataTransferObject, ValueObject, Entity}`, allowing direct inheritance via `extends`. |
| 15 | +* Added **Attributes namespace**: `ReallifeKip\ImmutableBase\Attributes\{DataTransferObject, ValueObject, Entity, ArrayOf}`. |
| 16 | +* Added a set of **granular exception classes** (main ones listed): |
| 17 | + `ImmutableBaseException`, `RuntimeException`, `LogicException`, |
| 18 | + `InvalidTypeException`, `InvalidJsonException`, |
| 19 | + `InvalidArrayException`, `InvalidArrayItemException`, `InvalidArrayValueException`, |
| 20 | + `InvalidArrayOfClassException`, `InvalidPropertyVisibilityException`, |
| 21 | + `AttributeException`, `InheritanceException`, `NonNullablePropertyException`. |
| 22 | +* `with()` and `ArrayOf` now support automatic instantiation of array elements into specified classes. |
| 23 | + They accept **JSON strings, plain arrays, or existing instances** as input. |
| 24 | +* Completed PHPDoc for the `toArrayOrValue()` core method. |
| 25 | + |
| 26 | +### Changed |
| 27 | + |
| 28 | +* Refactored and simplified parts of the core logic in `src/ImmutableBase.php`. |
| 29 | +* Extracted **Attributes** and **Objects** into separate namespaces to improve project structure and code readability. |
| 30 | +* `with()` now supports modifying nested properties that are themselves subclasses of `ImmutableBase`, without requiring re-instantiation. |
| 31 | +* Updated `composer.json` to include relevant keywords for better package discovery. |
| 32 | + |
| 33 | +### Deprecated |
| 34 | + |
| 35 | +* Direct instantiation (e.g., `new Example()`) **will be removed in v4.0.0**. |
| 36 | + Please use `Example::fromArray()` or `Example::fromJson()` instead. |
| 37 | +* `#[DataTransferObject]`, `#[ValueObject]`, and `#[Entity]` **will be deprecated in v4.0.0**. |
| 38 | + Use the **class-based API** (`Objects\*`) going forward. |
| 39 | + |
| 40 | + |
3 | 41 | ## [v3.0.3] - 2025-10-17 |
4 | 42 |
|
5 | 43 | - 修復 PHP 8.2 取得反射屬性名稱失敗 bug |
|
0 commit comments