diff --git a/CHANGELOG.md b/CHANGELOG.md index ed7fe33..636e27f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,13 @@ 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.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [2.0.0] 2023-11-15 + +### Changed + +- All implementations of Data are now `readonly` +- KeyedData constructor changed from `private` to `public` + ## [1.2.0] 2023-11-11 ### Added diff --git a/src/DataProxy.php b/src/DataProxy.php index dbe3c2e..dbc70a0 100644 --- a/src/DataProxy.php +++ b/src/DataProxy.php @@ -4,7 +4,7 @@ namespace Focus\Data; -abstract class DataProxy implements Data +abstract readonly class DataProxy implements Data { abstract protected function source(): Data; diff --git a/src/JsonData.php b/src/JsonData.php index 48a897d..d7542a2 100644 --- a/src/JsonData.php +++ b/src/JsonData.php @@ -13,7 +13,7 @@ use const JSON_THROW_ON_ERROR; -final class JsonData extends DataProxy +final readonly class JsonData extends DataProxy { use DataProxyBehavior; diff --git a/src/KeyedData.php b/src/KeyedData.php index 02c90a3..b7d57f5 100644 --- a/src/KeyedData.php +++ b/src/KeyedData.php @@ -44,7 +44,7 @@ public static function tryFrom(mixed $value): self ); } - private function __construct( + public function __construct( private array|object $value = new stdClass(), ) { } diff --git a/tests/KeyedDataTest.php b/tests/KeyedDataTest.php index f6a41e4..331ea97 100644 --- a/tests/KeyedDataTest.php +++ b/tests/KeyedDataTest.php @@ -58,7 +58,7 @@ public static function unsupportedValues(): array public function testFromShouldCreateInstance(): void { - $data = KeyedData::from(self::$fixture); + $data = new KeyedData(self::$fixture); self::assertInstanceOf( expected: KeyedData::class, diff --git a/tests/ProxiesData.php b/tests/ProxiesData.php index 026d586..5c32d26 100644 --- a/tests/ProxiesData.php +++ b/tests/ProxiesData.php @@ -7,7 +7,7 @@ use Focus\Data\Behavior\DataProxyBehavior; use Focus\Data\DataProxy; -final class ProxiesData extends DataProxy +final readonly class ProxiesData extends DataProxy { use DataProxyBehavior; }