diff --git a/CHANGELOG.md b/CHANGELOG.md index d853df2..b22d1ab 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Dropped support for PHP 7.4 and PHP 8.0 +### Deprecated + +- `\Art4\Accessable::get()` will add `mixed` as a native return type declaration in 2.0.0, do the same in your implementation now to avoid errors. +- `\Art4\Manager::getParam()` will add `mixed` as a native return type declaration in 2.0.0, do the same in your implementation now to avoid errors. + ## [1.2.0 - 2023-11-28](https://github.com/Art4/json-api-client/compare/1.1.0...1.2.0) ### Added diff --git a/src/Accessable.php b/src/Accessable.php index 11f3c93..90798ce 100644 --- a/src/Accessable.php +++ b/src/Accessable.php @@ -18,22 +18,20 @@ interface Accessable /** * Get a value by a key * - * @param mixed $key The key + * @return-type-will-change mixed `\Art4\JsonApiClient\Accessable::get()` will add `mixed` as a native return type declaration in 2.0.0, do the same in your implementation now to avoid errors. * * @return mixed */ - public function get($key); + public function get(mixed $key)/*: mixed */; /** * Check if a value exists * * @return-type-will-change bool `\Art4\JsonApiClient\Accessable::has()` will add `bool` as a native return type declaration in 2.0.0, do the same in your implementation now to avoid errors. * - * @param mixed $key The key - * * @return bool */ - public function has($key)/*: bool */; + public function has(mixed $key)/*: bool */; /** * Returns the keys of all setted values diff --git a/src/Element.php b/src/Element.php index 2951a2e..0bc71ba 100644 --- a/src/Element.php +++ b/src/Element.php @@ -18,5 +18,5 @@ interface Element * * @param mixed $data The data for this Element */ - public function __construct($data, Manager $manager, Accessable $parent); + public function __construct(mixed $data, Manager $manager, Accessable $parent); } diff --git a/src/Helper/AbstractElement.php b/src/Helper/AbstractElement.php index f15a62c..016b25e 100644 --- a/src/Helper/AbstractElement.php +++ b/src/Helper/AbstractElement.php @@ -30,7 +30,7 @@ abstract class AbstractElement implements Accessable, Element * * @param mixed $data The data for this Element */ - public function __construct($data, Manager $manager, Accessable $parent) + public function __construct(mixed $data, Manager $manager, Accessable $parent) { $this->manager = $manager; $this->parent = $parent; @@ -56,10 +56,8 @@ protected function getParent(): Accessable /** * Create an element - * - * @param mixed $data */ - protected function create(string $name, $data): Accessable + protected function create(string $name, mixed $data): Accessable { return $this->getManager()->getFactory()->make( $name, @@ -69,8 +67,6 @@ protected function create(string $name, $data): Accessable /** * Parse the data - * - * @param mixed $data */ - abstract protected function parse($data): void; + abstract protected function parse(mixed $data): void; } diff --git a/src/Manager.php b/src/Manager.php index 0610da0..4f38c72 100644 --- a/src/Manager.php +++ b/src/Manager.php @@ -39,9 +39,9 @@ public function getFactory()/*: Factory */; /** * Get a param by key * - * @param mixed $default + * @return-type-will-change mixed `\Art4\JsonApiClient\Manager::getParam()` will add `mixed` as a native return type declaration in 2.0.0, do the same in your implementation now to avoid errors. * * @return mixed */ - public function getParam(string $key, $default); + public function getParam(string $key, mixed $default)/*: mixed*/; } diff --git a/tests/Unit/Helper/AccessableTraitTest.php b/tests/Unit/Helper/AccessableTraitTest.php index f52ef81..583f436 100644 --- a/tests/Unit/Helper/AccessableTraitTest.php +++ b/tests/Unit/Helper/AccessableTraitTest.php @@ -19,10 +19,8 @@ class AccessableTraitTest extends TestCase /** * @dataProvider jsonValuesProviderWithoutStringAndInt - * - * @param mixed $key */ - public function testHasWithInvalidKeyTypeTriggersDeprecationError($key): void + public function testHasWithInvalidKeyTypeTriggersDeprecationError(mixed $key): void { $resource = new AccessableTraitMock(); @@ -45,10 +43,8 @@ function ($errno, $errstr) use ($key): bool { /** * @dataProvider jsonValuesProviderWithoutStringAndInt - * - * @param mixed $key */ - public function testGetWithInvalidKeyTypeTriggersDeprecationError($key): void + public function testGetWithInvalidKeyTypeTriggersDeprecationError(mixed $key): void { $resource = new AccessableTraitMock();