diff --git a/CHANGELOG.md b/CHANGELOG.md index fae9c7d..30cab1d 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. - Add support for PHP 8.2 +### Deprecated + +- Providing Argument #1 ($key) in `\Art4\JsonApiClient\Accessable::has()` not as `int|string` is deprecated and will throw an Exception in 2.0.0. +- Providing Argument #1 ($key) in `\Art4\JsonApiClient\Accessable::get()` not as `int|string` is deprecated and will throw an Exception in 2.0.0. + ## [1.1.0 - 2021-10-05](https://github.com/Art4/json-api-client/compare/1.0.0...1.1.0) ### Added @@ -25,16 +30,16 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ### Deprecated -- `\Art4\JsonApiClient\Accessable::has()` will add `bool` as a native return type declaration in v2.0, do the same in your implementation now to avoid errors. -- `\Art4\JsonApiClient\Accessable::getKeys()` will add `array` as a native return type declaration in v2.0, do the same in your implementation now to avoid errors. -- `\Art4\JsonApiClient\Exception\Exception` will extend `\Throwable` in v2.0, do the same in your implementation now to avoid errors. -- `\Art4\JsonApiClient\Factory::make()` methods first parameter signature will be `string` in v2.0. -- `\Art4\JsonApiClient\Factory::make()` will add `\Art4\JsonApiClient\Accessable` as a native return type declaration in v2.0, do the same in your implementation now to avoid errors. -- `\Art4\JsonApiClient\Input\Input::getAsObject()` will add `\stdClass` as a native return type declaration in v2.0, do the same in your implementation now to avoid errors. -- `\Art4\JsonApiClient\Manager::parse()` will add `\Art4\JsonApiClient\Accessable` as a native return type declaration in v2.0, do the same in your implementation now to avoid errors. -- `\Art4\JsonApiClient\Manager::getFactory()` will add `\Art4\JsonApiClient\Factory` as a native return type declaration in v2.0, do the same in your implementation now to avoid errors. -- `\Art4\JsonApiClient\Manager::getParam()` methods first parameter signature will be `string` in v2.0. -- `\Art4\JsonApiClient\Serializer\Serializer::serialize()` will add `?array` as a native return type declaration in v2.0, do the same in your implementation now to avoid errors. +- `\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. +- `\Art4\JsonApiClient\Accessable::getKeys()` will add `array` as a native return type declaration in 2.0.0, do the same in your implementation now to avoid errors. +- `\Art4\JsonApiClient\Exception\Exception` will extend `\Throwable` in 2.0.0, do the same in your implementation now to avoid errors. +- `\Art4\JsonApiClient\Factory::make()` methods first parameter signature will be `string` in 2.0.0. +- `\Art4\JsonApiClient\Factory::make()` will add `\Art4\JsonApiClient\Accessable` as a native return type declaration in 2.0.0, do the same in your implementation now to avoid errors. +- `\Art4\JsonApiClient\Input\Input::getAsObject()` will add `\stdClass` as a native return type declaration in 2.0.0, do the same in your implementation now to avoid errors. +- `\Art4\JsonApiClient\Manager::parse()` will add `\Art4\JsonApiClient\Accessable` as a native return type declaration in 2.0.0, do the same in your implementation now to avoid errors. +- `\Art4\JsonApiClient\Manager::getFactory()` will add `\Art4\JsonApiClient\Factory` as a native return type declaration in 2.0.0, do the same in your implementation now to avoid errors. +- `\Art4\JsonApiClient\Manager::getParam()` methods first parameter signature will be `string` in 2.0.0. +- `\Art4\JsonApiClient\Serializer\Serializer::serialize()` will add `?array` as a native return type declaration in 2.0.0, do the same in your implementation now to avoid errors. ## [1.0.0 - 2021-03-05](https://github.com/Art4/json-api-client/compare/0.10.2...1.0.0) diff --git a/src/Accessable.php b/src/Accessable.php index 8df8d91..11f3c93 100644 --- a/src/Accessable.php +++ b/src/Accessable.php @@ -27,7 +27,7 @@ public function get($key); /** * Check if a value exists * - * @return-type-will-change bool `\Art4\JsonApiClient\Accessable::has()` will add `bool` as a native return type declaration in v2.0. Do the same in your implementation now to avoid errors. + * @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 * @@ -38,7 +38,7 @@ public function has($key)/*: bool */; /** * Returns the keys of all setted values * - * @return-type-will-change array `\Art4\JsonApiClient\Accessable::getKeys()` will add `array` as a native return type declaration in v2.0. Do the same in your implementation now to avoid errors. + * @return-type-will-change array `\Art4\JsonApiClient\Accessable::getKeys()` will add `array` as a native return type declaration in 2.0.0, do the same in your implementation now to avoid errors. * * @return array Keys of all setted values */ diff --git a/src/Exception/Exception.php b/src/Exception/Exception.php index 87f6be5..ffdeb7c 100644 --- a/src/Exception/Exception.php +++ b/src/Exception/Exception.php @@ -9,7 +9,7 @@ namespace Art4\JsonApiClient\Exception; /** - * Please note: `\Art4\JsonApiClient\Exception\Exception` will extend `\Throwable` in v2.0. Do the same in your implementation now to avoid errors. + * Please note: `\Art4\JsonApiClient\Exception\Exception` will extend `\Throwable` in 2.0.0, do the same in your implementation now to avoid errors. */ interface Exception /*extends \Throwable */ {} diff --git a/src/Factory.php b/src/Factory.php index c3fa021..d25a5c1 100644 --- a/src/Factory.php +++ b/src/Factory.php @@ -16,7 +16,7 @@ interface Factory /** * Create a new instance of a class * - * @return-type-will-change Accessable `\Art4\JsonApiClient\Factory::make()` will add `\Art4\JsonApiClient\Accessable` as a native return type declaration in v2.0. Do the same in your implementation now to avoid errors. + * @return-type-will-change Accessable `\Art4\JsonApiClient\Factory::make()` will add `\Art4\JsonApiClient\Accessable` as a native return type declaration in 2.0.0, do the same in your implementation now to avoid errors. * * @param array $args * diff --git a/src/Helper/AccessableTrait.php b/src/Helper/AccessableTrait.php index 95a78af..4a6a6ce 100644 --- a/src/Helper/AccessableTrait.php +++ b/src/Helper/AccessableTrait.php @@ -57,10 +57,9 @@ final public function has($key): bool { if (! is_int($key) && ! is_string($key) && (! is_object($key) || ! $key instanceof AccessKey)) { trigger_error(sprintf( - '%s::has(): Providing Argument #1 ($key) as %s is deprecated since 1.2.0, please provide as int|string|%s instead.', + '%s::has(): Providing Argument #1 ($key) as `%s` is deprecated since 1.2.0, please provide as `int|string` instead.', get_class($this), - gettype($key), - AccessKey::class + gettype($key) ), \E_USER_DEPRECATED); $key = ''; @@ -101,10 +100,9 @@ public function get($key) { if (! is_int($key) && ! is_string($key) && (! is_object($key) || ! $key instanceof AccessKey)) { trigger_error(sprintf( - '%s::get(): Providing Argument #1 ($key) as %s is deprecated since 1.2.0, please provide as int|string|%s instead.', + '%s::get(): Providing Argument #1 ($key) as `%s` is deprecated since 1.2.0, please provide as `int|string` instead.', get_class($this), - gettype($key), - AccessKey::class + gettype($key) ), \E_USER_DEPRECATED); $key = ''; diff --git a/src/Input/Input.php b/src/Input/Input.php index 163b53a..bb168c4 100644 --- a/src/Input/Input.php +++ b/src/Input/Input.php @@ -16,7 +16,7 @@ interface Input /** * Get the input as simple object * - * @return-type-will-change \stdClass `\Art4\JsonApiClient\Input\Input::getAsObject()` will add `\stdClass` as a native return type declaration in v2.0. Do the same in your implementation now to avoid errors. + * @return-type-will-change \stdClass `\Art4\JsonApiClient\Input\Input::getAsObject()` will add `\stdClass` as a native return type declaration in 2.0.0, do the same in your implementation now to avoid errors. * * This should be a native PHP stdClass object, so Manager could * iterate over all public attributes diff --git a/src/Manager.php b/src/Manager.php index b9df215..0610da0 100644 --- a/src/Manager.php +++ b/src/Manager.php @@ -18,7 +18,7 @@ interface Manager /** * Parse the input * - * @return-type-will-change Accessable `\Art4\JsonApiClient\Manager::parse()` will add `\Art4\JsonApiClient\Accessable` as a native return type declaration in v2.0. Do the same in your implementation now to avoid errors. + * @return-type-will-change Accessable `\Art4\JsonApiClient\Manager::parse()` will add `\Art4\JsonApiClient\Accessable` as a native return type declaration in 2.0.0, do the same in your implementation now to avoid errors. * * @throws \Art4\JsonApiClient\Exception\InputException If $input contains invalid JSON API * @throws \Art4\JsonApiClient\Exception\ValidationException If $input contains invalid JSON API @@ -30,7 +30,7 @@ public function parse(Input $input)/*: Accessable */; /** * Get a factory from the manager * - * @return-type-will-change Factory `\Art4\JsonApiClient\Manager::getFactory()` will add `\Art4\JsonApiClient\Factory` as a native return type declaration in v2.0. Do the same in your implementation now to avoid errors. + * @return-type-will-change Factory `\Art4\JsonApiClient\Manager::getFactory()` will add `\Art4\JsonApiClient\Factory` as a native return type declaration in 2.0.0, do the same in your implementation now to avoid errors. * * @return \Art4\JsonApiClient\Factory */ diff --git a/src/Serializer/Serializer.php b/src/Serializer/Serializer.php index f6a4324..3801cbd 100644 --- a/src/Serializer/Serializer.php +++ b/src/Serializer/Serializer.php @@ -15,7 +15,7 @@ interface Serializer /** * Serialize data * - * @return-type-will-change ?array `\Art4\JsonApiClient\Serializer\Serializer::serialize()` will add `?array` as a native return type declaration in v2.0. Do the same in your implementation now to avoid errors. + * @return-type-will-change ?array `\Art4\JsonApiClient\Serializer\Serializer::serialize()` will add `?array` as a native return type declaration in 2.0.0, do the same in your implementation now to avoid errors. * * @return array|null */ diff --git a/src/V1/ResourceNull.php b/src/V1/ResourceNull.php index 935cf5a..d687293 100644 --- a/src/V1/ResourceNull.php +++ b/src/V1/ResourceNull.php @@ -39,10 +39,9 @@ public function has($key): bool { if (! is_int($key) && ! is_string($key) && (! is_object($key) || ! $key instanceof AccessKey)) { trigger_error(sprintf( - '%s::has(): Providing Argument #1 ($key) as %s is deprecated since 1.2.0, please provide as int|string|%s instead.', + '%s::has(): Providing Argument #1 ($key) as `%s` is deprecated since 1.2.0, please provide as `int|string` instead.', get_class($this), - gettype($key), - AccessKey::class + gettype($key) ), \E_USER_DEPRECATED); } diff --git a/tests/Unit/Helper/AccessableTraitTest.php b/tests/Unit/Helper/AccessableTraitTest.php index 9953cf6..f52ef81 100644 --- a/tests/Unit/Helper/AccessableTraitTest.php +++ b/tests/Unit/Helper/AccessableTraitTest.php @@ -30,7 +30,7 @@ public function testHasWithInvalidKeyTypeTriggersDeprecationError($key): void set_error_handler( function ($errno, $errstr) use ($key): bool { $this->assertSame( - 'Art4\JsonApiClient\Tests\Fixtures\AccessableTraitMock::has(): Providing Argument #1 ($key) as ' . gettype($key) . ' is deprecated since 1.2.0, please provide as int|string|Art4\JsonApiClient\Helper\AccessKey instead.', + 'Art4\JsonApiClient\Tests\Fixtures\AccessableTraitMock::has(): Providing Argument #1 ($key) as `' . gettype($key) . '` is deprecated since 1.2.0, please provide as `int|string` instead.', $errstr ); @@ -56,7 +56,7 @@ public function testGetWithInvalidKeyTypeTriggersDeprecationError($key): void set_error_handler( function ($errno, $errstr) use ($key): bool { $this->assertSame( - 'Art4\JsonApiClient\Tests\Fixtures\AccessableTraitMock::get(): Providing Argument #1 ($key) as ' . gettype($key) . ' is deprecated since 1.2.0, please provide as int|string|Art4\JsonApiClient\Helper\AccessKey instead.', + 'Art4\JsonApiClient\Tests\Fixtures\AccessableTraitMock::get(): Providing Argument #1 ($key) as `' . gettype($key) . '` is deprecated since 1.2.0, please provide as `int|string` instead.', $errstr ); diff --git a/tests/Unit/V1/ResourceNullTest.php b/tests/Unit/V1/ResourceNullTest.php index b59c69e..b476e3d 100644 --- a/tests/Unit/V1/ResourceNullTest.php +++ b/tests/Unit/V1/ResourceNullTest.php @@ -77,7 +77,7 @@ public function testHasWithObjectAsKeyTriggersException(): void set_error_handler( function ($errno, $errstr): bool { $this->assertSame( - 'Art4\JsonApiClient\V1\ResourceNull::has(): Providing Argument #1 ($key) as object is deprecated since 1.2.0, please provide as int|string|Art4\JsonApiClient\Helper\AccessKey instead.', + 'Art4\JsonApiClient\V1\ResourceNull::has(): Providing Argument #1 ($key) as `object` is deprecated since 1.2.0, please provide as `int|string` instead.', $errstr ); @@ -102,7 +102,7 @@ public function testHasWithArrayAsKeyTriggersException(): void set_error_handler( function ($errno, $errstr): bool { $this->assertSame( - 'Art4\JsonApiClient\V1\ResourceNull::has(): Providing Argument #1 ($key) as array is deprecated since 1.2.0, please provide as int|string|Art4\JsonApiClient\Helper\AccessKey instead.', + 'Art4\JsonApiClient\V1\ResourceNull::has(): Providing Argument #1 ($key) as `array` is deprecated since 1.2.0, please provide as `int|string` instead.', $errstr );