diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index 01609e7..e070a53 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -14,7 +14,7 @@ jobs: fail-fast: false matrix: operating-system: ['ubuntu-latest'] - php: ['7.4', '8.0', '8.1', '8.2', '8.3', '8.4'] + php: ['8.1', '8.2', '8.3', '8.4'] steps: - name: Checkout diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index 6de33d4..5e6d7a5 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -13,8 +13,8 @@ ->setRules([ '@PER-CS2.0' => true, '@PER-CS2.0:risky' => true, - '@PHP74Migration' => true, - '@PHP74Migration:risky' => true, + '@PHP81Migration' => true, + '@PHP80Migration:risky' => true, '@PHPUnit84Migration:risky' => true, 'no_alias_functions' => true, ]) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7547f7c..b22d1ab 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,15 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## [Unreleased](https://github.com/Art4/json-api-client/compare/1.2.0...v1.x) +### Changed + +- 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/composer.json b/composer.json index f01bf94..58a139b 100644 --- a/composer.json +++ b/composer.json @@ -13,13 +13,13 @@ } ], "require": { - "php": "^7.4 || ~8.0.0 || ~8.1.0 || ~8.2.0 || ~8.3.0" + "php": "~8.1.0 || ~8.2.0 || ~8.3.0" }, "require-dev": { - "friendsofphp/php-cs-fixer": "^3.35", + "friendsofphp/php-cs-fixer": "^3.40", "phpstan/phpstan": "^1.10", "phpstan/phpstan-phpunit": "^1.3", - "phpunit/phpunit": "^9 || ^10" + "phpunit/phpunit": "^10.4" }, "autoload": { "psr-4": { 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/Helper/AccessableTrait.php b/src/Helper/AccessableTrait.php index 6ab503d..6898173 100644 --- a/src/Helper/AccessableTrait.php +++ b/src/Helper/AccessableTrait.php @@ -25,10 +25,8 @@ trait AccessableTrait /** * Set a value - * - * @param mixed $value The Value */ - final protected function set(string $key, $value): void + final protected function set(string $key, mixed $value): void { // Allow non-associative array for collections if ($key === '') { @@ -93,10 +91,8 @@ final public function has($key): bool * Get a value by a key * * @param int|string|AccessKey $key The key - * - * @return mixed */ - public function get($key) + public function get($key): mixed { if (!is_int($key) && !is_string($key) && (!is_object($key) || !$key instanceof AccessKey)) { trigger_error(sprintf( @@ -131,10 +127,8 @@ public function get($key) * Get a value by the key * * @throws AccessException - * - * @return mixed The value */ - private function getValue(string $key) + private function getValue(string $key): mixed { if (array_key_exists($key, $this->data)) { return $this->data[$key]; diff --git a/src/Input/StringInputTrait.php b/src/Input/StringInputTrait.php index f04042c..f620b3e 100644 --- a/src/Input/StringInputTrait.php +++ b/src/Input/StringInputTrait.php @@ -41,10 +41,8 @@ final public function prepareString($string): string * Decodes a json string * * @throws InputException if something went wrong with the input - * - * @return mixed */ - final protected function decodeJson(string $jsonString) + final protected function decodeJson(string $jsonString): mixed { $jsonErrors = [ \JSON_ERROR_DEPTH => 'JSON_ERROR_DEPTH - Maximum stack depth exceeded', 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/src/Manager/ErrorAbortManager.php b/src/Manager/ErrorAbortManager.php index db8567c..5e937c5 100644 --- a/src/Manager/ErrorAbortManager.php +++ b/src/Manager/ErrorAbortManager.php @@ -78,12 +78,8 @@ public function getFactory(): Factory /** * Get a param by key - * - * @param mixed $default - * - * @return mixed */ - public function getParam(string $key, $default) + public function getParam(string $key, mixed $default): mixed { if (array_key_exists($key, $this->config)) { return $this->config[$key]; diff --git a/src/Serializer/ArraySerializer.php b/src/Serializer/ArraySerializer.php index 14efd00..0744999 100644 --- a/src/Serializer/ArraySerializer.php +++ b/src/Serializer/ArraySerializer.php @@ -62,12 +62,8 @@ public function serialize(Accessable $data): ?array /** * Transforms objects to arrays - * - * @param mixed $val - * - * @return mixed */ - private function objectTransform($val) + private function objectTransform(mixed $val): mixed { if (!is_object($val)) { return $val; diff --git a/src/V1/Attributes.php b/src/V1/Attributes.php index b9ae944..f831f03 100644 --- a/src/V1/Attributes.php +++ b/src/V1/Attributes.php @@ -23,11 +23,9 @@ final class Attributes extends AbstractElement /** * Parses the data for this element * - * @param mixed $object The data - * * @throws ValidationException */ - protected function parse($object): void + protected function parse(mixed $object): void { if (!is_object($object)) { throw new ValidationException('Attributes has to be an object, "' . gettype($object) . '" given.'); @@ -52,10 +50,8 @@ protected function parse($object): void * Get a value by the key of this object * * @param int|string|AccessKey $key The key of the value - * - * @return mixed The value */ - public function get($key) + public function get($key): mixed { try { return parent::get($key); diff --git a/src/V1/Document.php b/src/V1/Document.php index 1717509..531b59f 100644 --- a/src/V1/Document.php +++ b/src/V1/Document.php @@ -24,11 +24,9 @@ final class Document extends AbstractElement /** * Parses the data for this element * - * @param mixed $object The data - * * @throws ValidationException */ - protected function parse($object): void + protected function parse(mixed $object): void { if (!is_object($object)) { throw new ValidationException('Document has to be an object, "' . gettype($object) . '" given.'); @@ -75,10 +73,8 @@ protected function parse($object): void * Get a value by the key of this object * * @param int|string|AccessKey $key The key of the value - * - * @return mixed The value */ - public function get($key) + public function get($key): mixed { try { return parent::get($key); diff --git a/src/V1/DocumentLink.php b/src/V1/DocumentLink.php index 569c4e5..0d1daab 100644 --- a/src/V1/DocumentLink.php +++ b/src/V1/DocumentLink.php @@ -28,11 +28,9 @@ final class DocumentLink extends AbstractElement /** * Parses the data for this element * - * @param mixed $object The data - * * @throws ValidationException */ - protected function parse($object): void + protected function parse(mixed $object): void { if (!is_object($object)) { throw new ValidationException( @@ -105,10 +103,8 @@ protected function parse($object): void * Get a value by the key of this object * * @param int|string|AccessKey $key The key of the value - * - * @return mixed The value */ - public function get($key) + public function get($key): mixed { try { return parent::get($key); diff --git a/src/V1/Error.php b/src/V1/Error.php index 250f737..cab0cd0 100644 --- a/src/V1/Error.php +++ b/src/V1/Error.php @@ -23,11 +23,9 @@ final class Error extends AbstractElement /** * Parses the data for this element * - * @param mixed $object The data - * * @throws ValidationException */ - protected function parse($object): void + protected function parse(mixed $object): void { if (!is_object($object)) { throw new ValidationException( @@ -107,10 +105,8 @@ protected function parse($object): void * Get a value by the key of this object * * @param int|string|AccessKey $key The key of the value - * - * @return mixed The value */ - public function get($key) + public function get($key): mixed { try { return parent::get($key); diff --git a/src/V1/ErrorCollection.php b/src/V1/ErrorCollection.php index 39e4766..eccad3f 100644 --- a/src/V1/ErrorCollection.php +++ b/src/V1/ErrorCollection.php @@ -23,11 +23,9 @@ final class ErrorCollection extends AbstractElement /** * Parses the data for this element * - * @param mixed $object The data - * * @throws ValidationException */ - protected function parse($object): void + protected function parse(mixed $object): void { if (!is_array($object)) { throw new ValidationException('Errors for a collection has to be in an array, "' . gettype($object) . '" given.'); @@ -46,10 +44,8 @@ protected function parse($object): void * Get a value by the key of this document * * @param int|string|AccessKey $key The key of the value - * - * @return mixed The value */ - public function get($key) + public function get($key): mixed { try { return parent::get($key); diff --git a/src/V1/ErrorLink.php b/src/V1/ErrorLink.php index b4f8d2f..fb1ae16 100644 --- a/src/V1/ErrorLink.php +++ b/src/V1/ErrorLink.php @@ -27,11 +27,9 @@ final class ErrorLink extends AbstractElement /** * Parses the data for this element * - * @param mixed $object The data - * * @throws ValidationException */ - protected function parse($object): void + protected function parse(mixed $object): void { if (!is_object($object)) { throw new ValidationException('Link has to be an object, "' . gettype($object) . '" given.'); @@ -65,10 +63,8 @@ protected function parse($object): void * Get a value by the key of this object * * @param int|string|AccessKey $key The key of the value - * - * @return mixed The value */ - public function get($key) + public function get($key): mixed { try { return parent::get($key); diff --git a/src/V1/ErrorSource.php b/src/V1/ErrorSource.php index c9730c3..30bb75f 100644 --- a/src/V1/ErrorSource.php +++ b/src/V1/ErrorSource.php @@ -23,11 +23,9 @@ final class ErrorSource extends AbstractElement /** * Parses the data for this element * - * @param mixed $object The data - * * @throws ValidationException */ - protected function parse($object): void + protected function parse(mixed $object): void { if (!is_object($object)) { throw new ValidationException('ErrorSource has to be an object, "' . gettype($object) . '" given.'); @@ -54,10 +52,8 @@ protected function parse($object): void * Get a value by the key of this document * * @param int|string|AccessKey $key The key of the value - * - * @return mixed The value */ - public function get($key) + public function get($key): mixed { try { return parent::get($key); diff --git a/src/V1/Jsonapi.php b/src/V1/Jsonapi.php index 3e0cf53..7c31c96 100644 --- a/src/V1/Jsonapi.php +++ b/src/V1/Jsonapi.php @@ -23,11 +23,9 @@ final class Jsonapi extends AbstractElement /** * Parses the data for this element * - * @param mixed $object The data - * * @throws ValidationException */ - protected function parse($object): void + protected function parse(mixed $object): void { if (!is_object($object)) { throw new ValidationException('Jsonapi has to be an object, "' . gettype($object) . '" given.'); @@ -50,10 +48,8 @@ protected function parse($object): void * Get a value by the key of this object * * @param int|string|AccessKey $key The key of the value - * - * @return mixed The value */ - public function get($key) + public function get($key): mixed { try { return parent::get($key); diff --git a/src/V1/Link.php b/src/V1/Link.php index 6a8088e..41bd8eb 100644 --- a/src/V1/Link.php +++ b/src/V1/Link.php @@ -23,11 +23,9 @@ final class Link extends AbstractElement /** * Parses the data for this element * - * @param mixed $object The data - * * @throws ValidationException */ - protected function parse($object): void + protected function parse(mixed $object): void { if (!is_object($object)) { throw new ValidationException('Link has to be an object or string, "' . gettype($object) . '" given.'); @@ -46,10 +44,8 @@ protected function parse($object): void * Get a value by the key of this object * * @param int|string|AccessKey $key The key of the value - * - * @return mixed The value */ - public function get($key) + public function get($key): mixed { try { return parent::get($key); @@ -60,10 +56,8 @@ public function get($key) /** * Set a link - * - * @param mixed $link The Link */ - private function setAsLink(string $name, $link): void + private function setAsLink(string $name, mixed $link): void { if ($name === 'meta') { $this->set($name, $this->create('Meta', $link)); diff --git a/src/V1/Meta.php b/src/V1/Meta.php index 30bce64..ed68e0a 100644 --- a/src/V1/Meta.php +++ b/src/V1/Meta.php @@ -23,11 +23,9 @@ final class Meta extends AbstractElement /** * Parses the data for this element * - * @param mixed $object The data - * * @throws ValidationException */ - protected function parse($object): void + protected function parse(mixed $object): void { if (!is_object($object)) { throw new ValidationException('Meta has to be an object, "' . gettype($object) . '" given.'); @@ -48,10 +46,8 @@ protected function parse($object): void * Get a value by the key of this object * * @param int|string|AccessKey $key The key of the value - * - * @return mixed The value */ - public function get($key) + public function get($key): mixed { try { return parent::get($key); diff --git a/src/V1/Relationship.php b/src/V1/Relationship.php index b85017d..67444ee 100644 --- a/src/V1/Relationship.php +++ b/src/V1/Relationship.php @@ -23,11 +23,9 @@ final class Relationship extends AbstractElement /** * Parses the data for this element * - * @param mixed $object The data - * * @throws ValidationException */ - protected function parse($object): void + protected function parse(mixed $object): void { if (!is_object($object)) { throw new ValidationException('Relationship has to be an object, "' . gettype($object) . '" given.'); @@ -61,10 +59,8 @@ protected function parse($object): void * Get a value by the key of this object * * @param int|string|AccessKey $key The key of the value - * - * @return mixed The value */ - public function get($key) + public function get($key): mixed { try { return parent::get($key); diff --git a/src/V1/RelationshipCollection.php b/src/V1/RelationshipCollection.php index e14a6de..8e47d44 100644 --- a/src/V1/RelationshipCollection.php +++ b/src/V1/RelationshipCollection.php @@ -23,11 +23,9 @@ final class RelationshipCollection extends AbstractElement /** * Parses the data for this element * - * @param mixed $object The data - * * @throws ValidationException */ - protected function parse($object): void + protected function parse(mixed $object): void { if (!is_object($object)) { throw new ValidationException('Relationships has to be an object, "' . gettype($object) . '" given.'); @@ -56,10 +54,8 @@ protected function parse($object): void * Get a value by the key of this object * * @param int|string|AccessKey $key The key of the value - * - * @return mixed The value */ - public function get($key) + public function get($key): mixed { try { return parent::get($key); diff --git a/src/V1/RelationshipLink.php b/src/V1/RelationshipLink.php index 602b13c..e520267 100644 --- a/src/V1/RelationshipLink.php +++ b/src/V1/RelationshipLink.php @@ -32,11 +32,9 @@ final class RelationshipLink extends AbstractElement /** * Parses the data for this element * - * @param mixed $object The data - * * @throws ValidationException */ - protected function parse($object): void + protected function parse(mixed $object): void { if (!is_object($object)) { throw new ValidationException('RelationshipLink has to be an object, "' . gettype($object) . '" given.'); @@ -107,10 +105,8 @@ protected function parse($object): void * Get a value by the key of this object * * @param int|string|AccessKey $key The key of the value - * - * @return mixed The value */ - public function get($key) + public function get($key): mixed { try { return parent::get($key); diff --git a/src/V1/ResourceCollection.php b/src/V1/ResourceCollection.php index 852ff5d..95a71b5 100644 --- a/src/V1/ResourceCollection.php +++ b/src/V1/ResourceCollection.php @@ -24,11 +24,9 @@ final class ResourceCollection extends AbstractElement /** * Parses the data for this element * - * @param mixed $object The data - * * @throws ValidationException */ - protected function parse($object): void + protected function parse(mixed $object): void { if (!is_array($object)) { throw new ValidationException('Resources for a collection has to be in an array, "' . gettype($object) . '" given.'); @@ -49,10 +47,8 @@ protected function parse($object): void * Get a value by the key of this object * * @param int|string|AccessKey $key The key of the value - * - * @return mixed The value */ - public function get($key) + public function get($key): mixed { try { return parent::get($key); diff --git a/src/V1/ResourceIdentifier.php b/src/V1/ResourceIdentifier.php index 6f6452c..9950667 100644 --- a/src/V1/ResourceIdentifier.php +++ b/src/V1/ResourceIdentifier.php @@ -23,11 +23,9 @@ final class ResourceIdentifier extends AbstractElement /** * Parses the data for this element * - * @param mixed $object The data - * * @throws ValidationException */ - protected function parse($object): void + protected function parse(mixed $object): void { if (!is_object($object)) { throw new ValidationException('Resource has to be an object, "' . gettype($object) . '" given.'); @@ -61,10 +59,8 @@ protected function parse($object): void * Get a value by the key of this object * * @param int|string|AccessKey $key The key of the value - * - * @return mixed The value */ - public function get($key) + public function get($key): mixed { try { return parent::get($key); diff --git a/src/V1/ResourceIdentifierCollection.php b/src/V1/ResourceIdentifierCollection.php index 7c2af51..7b546cd 100644 --- a/src/V1/ResourceIdentifierCollection.php +++ b/src/V1/ResourceIdentifierCollection.php @@ -23,11 +23,9 @@ final class ResourceIdentifierCollection extends AbstractElement /** * Parses the data for this element * - * @param mixed $object The data - * * @throws ValidationException */ - protected function parse($object): void + protected function parse(mixed $object): void { if (!is_array($object)) { throw new ValidationException('Resources for a collection has to be in an array, "' . gettype($object) . '" given.'); @@ -44,10 +42,8 @@ protected function parse($object): void * Get a value by the key of this object * * @param int|string|AccessKey $key The key of the value - * - * @return mixed The value */ - public function get($key) + public function get($key): mixed { try { return parent::get($key); diff --git a/src/V1/ResourceItem.php b/src/V1/ResourceItem.php index 913f701..570a210 100644 --- a/src/V1/ResourceItem.php +++ b/src/V1/ResourceItem.php @@ -23,11 +23,9 @@ final class ResourceItem extends AbstractElement /** * Parses the data for this element * - * @param mixed $object The data - * * @throws ValidationException */ - protected function parse($object): void + protected function parse(mixed $object): void { if (!is_object($object)) { throw new ValidationException('Resource has to be an object, "' . gettype($object) . '" given.'); @@ -79,10 +77,8 @@ protected function parse($object): void * Get a value by the key of this object * * @param int|string|AccessKey $key The key of the value - * - * @return mixed The value */ - public function get($key) + public function get($key): mixed { try { return parent::get($key); diff --git a/src/V1/ResourceItemLink.php b/src/V1/ResourceItemLink.php index 73964d8..c22a8a8 100644 --- a/src/V1/ResourceItemLink.php +++ b/src/V1/ResourceItemLink.php @@ -23,11 +23,9 @@ final class ResourceItemLink extends AbstractElement /** * Parses the data for this element * - * @param mixed $object The data - * * @throws ValidationException */ - protected function parse($object): void + protected function parse(mixed $object): void { if (!is_object($object)) { throw new ValidationException('ItemLink has to be an object, "' . gettype($object) . '" given.'); @@ -42,10 +40,8 @@ protected function parse($object): void * Get a value by the key of this object * * @param int|string|AccessKey $key The key of the value - * - * @return mixed The value */ - public function get($key) + public function get($key): mixed { try { return parent::get($key); diff --git a/src/V1/ResourceNull.php b/src/V1/ResourceNull.php index 93c71ab..a5f97f5 100644 --- a/src/V1/ResourceNull.php +++ b/src/V1/ResourceNull.php @@ -20,13 +20,11 @@ final class ResourceNull implements Accessable, Element { /** - * Constructor + * Sets the manager and parent * - * @param mixed $data The data for this Element - * @param \Art4\JsonApiClient\Manager $manager The manager - * @param \Art4\JsonApiClient\Accessable $parent The parent + * @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) {} /** * Check if a value exists in this resource diff --git a/tests/Fixtures/HelperTrait.php b/tests/Fixtures/HelperTrait.php index aae051e..8da7143 100644 --- a/tests/Fixtures/HelperTrait.php +++ b/tests/Fixtures/HelperTrait.php @@ -176,10 +176,8 @@ public function setUpManagerMock(): void /** * returns a json string from a file - * - * @param mixed $filename */ - protected function getJsonString($filename): string + protected function getJsonString(mixed $filename): string { return strval(file_get_contents(__DIR__ . '/../files/' . $filename)); } diff --git a/tests/Functional/DotNotationTest.php b/tests/Functional/DotNotationTest.php index bb0a1f2..bb7f598 100644 --- a/tests/Functional/DotNotationTest.php +++ b/tests/Functional/DotNotationTest.php @@ -20,9 +20,6 @@ class DotNotationTest extends TestCase { use HelperTrait; - /** - * @test - */ public function testCompleteResourceObjectWithMultipleRelationships(): void { $manager = new ErrorAbortManager(new Factory()); @@ -189,9 +186,6 @@ public function testCompleteResourceObjectWithMultipleRelationships(): void $this->assertSame('http://example.com/comments/12', $document->get('included.2.links.self')); } - /** - * @test - */ public function testGetNotExistentValueThrowsException(): void { $manager = new ErrorAbortManager(new Factory()); diff --git a/tests/Functional/ErrorParsingTest.php b/tests/Functional/ErrorParsingTest.php index ce30a29..08d480d 100644 --- a/tests/Functional/ErrorParsingTest.php +++ b/tests/Functional/ErrorParsingTest.php @@ -16,9 +16,6 @@ class ErrorParsingTest extends TestCase { use HelperTrait; - /** - * @test - */ public function testParseErrors(): void { $string = $this->getJsonString('09_errors.json'); @@ -89,9 +86,6 @@ public function testParseErrors(): void $this->assertFalse($errors->has('3')); } - /** - * @test - */ public function testParseErrorWithLinks(): void { $string = $this->getJsonString('10_error_with_links.json'); diff --git a/tests/Functional/ParsingTest.php b/tests/Functional/ParsingTest.php index 8729849..ac3227f 100644 --- a/tests/Functional/ParsingTest.php +++ b/tests/Functional/ParsingTest.php @@ -14,6 +14,7 @@ use Art4\JsonApiClient\Manager\ErrorAbortManager; use Art4\JsonApiClient\Tests\Fixtures\HelperTrait; use Art4\JsonApiClient\V1\Factory; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; class ParsingTest extends TestCase @@ -38,9 +39,7 @@ public static function createParserProvider(): array ]; } - /** - * @dataProvider createParserProvider - */ + #[DataProvider('createParserProvider')] public function testParseSimpleResourceWithDifferentParser(callable $parser): void { $string = $this->getJsonString('01_simple_resource.json'); @@ -67,9 +66,6 @@ public function testParseSimpleResourceWithDifferentParser(callable $parser): vo $this->assertInstanceOf('Art4\JsonApiClient\V1\RelationshipCollection', $resource->get('relationships')); } - /** - * @test - */ public function testParseSimpleResourceIdentifier(): void { $string = $this->getJsonString('02_simple_resource_identifier.json'); @@ -91,9 +87,6 @@ public function testParseSimpleResourceIdentifier(): void $this->assertSame($resource->get('id'), '1'); } - /** - * @test - */ public function testParseResourceObject(): void { $string = $this->getJsonString('03_resource_object.json'); @@ -159,9 +152,6 @@ public function testParseResourceObject(): void $this->assertSame($data->get('id'), '9'); } - /** - * @test - */ public function testParseCompleteResourceObjectWithMultipleRelationships(): void { $string = $this->getJsonString('04_complete_document_with_multiple_relationships.json'); @@ -355,9 +345,6 @@ public function testParseCompleteResourceObjectWithMultipleRelationships(): void $this->assertSame($links->get('self'), 'http://example.com/comments/12'); } - /** - * @test - */ public function testParsePaginationExample(): void { $string = $this->getJsonString('06_pagination_example.json'); @@ -409,9 +396,6 @@ public function testParsePaginationExample(): void $this->assertSame($links->get('last'), 'http://example.com/articles?page[number]=13&page[size]=1'); } - /** - * @test - */ public function testParseRelationshipExample(): void { $string = $this->getJsonString('07_relationship_example_without_data.json'); @@ -475,9 +459,6 @@ public function testParseRelationshipExample(): void $this->assertSame($document->get('data.0.relationships.comments.links.related.meta.count'), 10); } - /** - * @test - */ public function testParseObjectLinksExample(): void { $string = $this->getJsonString('08_object_links.json'); @@ -518,9 +499,6 @@ public function testParseObjectLinksExample(): void $this->assertSame('bar', $document->get('jsonapi.meta.foo')); } - /** - * @test - */ public function testParseResourceIdentifierWithMeta(): void { $string = $this->getJsonString('11_resource_identifier_with_meta.json'); @@ -544,9 +522,6 @@ public function testParseResourceIdentifierWithMeta(): void $this->assertSame($resource->get('id'), '2'); } - /** - * @test - */ public function testParseNullResource(): void { $string = $this->getJsonString('12_null_resource.json'); @@ -565,9 +540,6 @@ public function testParseNullResource(): void $this->assertInstanceOf('Art4\JsonApiClient\V1\ResourceNull', $resource); } - /** - * @test - */ public function testParseResourceIdentifierCollectionWithMeta(): void { $string = $this->getJsonString('13_collection_with_resource_identifier_with_meta.json'); @@ -602,9 +574,6 @@ public function testParseResourceIdentifierCollectionWithMeta(): void $this->assertSame($resource1->get('id'), '2'); } - /** - * @test - */ public function testParseCreateResourceWithoutId(): void { $string = $this->getJsonString('14_create_resource_without_id.json'); @@ -614,9 +583,6 @@ public function testParseCreateResourceWithoutId(): void $this->assertSame(['data'], $document->getKeys()); } - /** - * @test - */ public function testParseCreateShortResourceWithoutId(): void { $string = $this->getJsonString('15_create_resource_without_id.json'); @@ -626,9 +592,6 @@ public function testParseCreateShortResourceWithoutId(): void $this->assertSame(['data'], $document->getKeys()); } - /** - * @test - */ public function testExceptionIfIdIsNotString(): void { $this->expectException(\Art4\JsonApiClient\Exception\ValidationException::class); @@ -636,9 +599,6 @@ public function testExceptionIfIdIsNotString(): void $document = Parser::parseResponseString($string); } - /** - * @test - */ public function testParseLinksInRelationshipsCorrectly(): void { $string = $this->getJsonString('17_relationship_links.json'); diff --git a/tests/Functional/SerializerTest.php b/tests/Functional/SerializerTest.php index 1838e87..71d9fa7 100644 --- a/tests/Functional/SerializerTest.php +++ b/tests/Functional/SerializerTest.php @@ -15,6 +15,7 @@ use Art4\JsonApiClient\Tests\Fixtures\HelperTrait; use Art4\JsonApiClient\V1\Factory; use Exception; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; class SerializerTest extends TestCase @@ -61,9 +62,7 @@ public static function jsonapiDataProvider(): array return $files; } - /** - * @dataProvider jsonapiDataProvider - */ + #[DataProvider('jsonapiDataProvider')] public function testParseJsonapiDataWithErrorAbortManager(string $filename, bool $isRequest): void { $manager = new ErrorAbortManager(new Factory()); diff --git a/tests/Unit/Helper/AccessableTraitTest.php b/tests/Unit/Helper/AccessableTraitTest.php index f52ef81..eca0494 100644 --- a/tests/Unit/Helper/AccessableTraitTest.php +++ b/tests/Unit/Helper/AccessableTraitTest.php @@ -11,18 +11,15 @@ use Art4\JsonApiClient\Exception\AccessException; use Art4\JsonApiClient\Tests\Fixtures\AccessableTraitMock; use Art4\JsonApiClient\Tests\Fixtures\HelperTrait; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; class AccessableTraitTest extends TestCase { use HelperTrait; - /** - * @dataProvider jsonValuesProviderWithoutStringAndInt - * - * @param mixed $key - */ - public function testHasWithInvalidKeyTypeTriggersDeprecationError($key): void + #[DataProvider('jsonValuesProviderWithoutStringAndInt')] + public function testHasWithInvalidKeyTypeTriggersDeprecationError(mixed $key): void { $resource = new AccessableTraitMock(); @@ -43,12 +40,8 @@ function ($errno, $errstr) use ($key): bool { $resource->has($key); } - /** - * @dataProvider jsonValuesProviderWithoutStringAndInt - * - * @param mixed $key - */ - public function testGetWithInvalidKeyTypeTriggersDeprecationError($key): void + #[DataProvider('jsonValuesProviderWithoutStringAndInt')] + public function testGetWithInvalidKeyTypeTriggersDeprecationError(mixed $key): void { $resource = new AccessableTraitMock(); diff --git a/tests/Unit/Input/RequestStringInputTest.php b/tests/Unit/Input/RequestStringInputTest.php index f9d49e7..bfa259b 100644 --- a/tests/Unit/Input/RequestStringInputTest.php +++ b/tests/Unit/Input/RequestStringInputTest.php @@ -11,6 +11,7 @@ use Art4\JsonApiClient\Exception\InputException; use Art4\JsonApiClient\Input\RequestStringInput; use Art4\JsonApiClient\Tests\Fixtures\HelperTrait; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; class RequestStringInputTest extends TestCase @@ -24,12 +25,8 @@ public function testGetAsObjectFromStringReturnsObject(): void $this->assertInstanceOf(\stdClass::class, $input->getAsObject()); } - /** - * @dataProvider jsonValuesProviderWithoutString - * - * @param mixed $input - */ - public function testCreateWithoutStringThrowsException($input): void + #[DataProvider('jsonValuesProviderWithoutString')] + public function testCreateWithoutStringThrowsException(mixed $input): void { $this->expectException(InputException::class); $this->expectExceptionMessage( @@ -38,9 +35,7 @@ public function testCreateWithoutStringThrowsException($input): void new RequestStringInput($input); } - /** - * @dataProvider jsonValuesAsStringProviderWithoutObject - */ + #[DataProvider('jsonValuesAsStringProviderWithoutObject')] public function testGetAsObjectWithInvalidStringsThrowsException(string $input): void { $input = new RequestStringInput($input); diff --git a/tests/Unit/Input/ResponseStringInputTest.php b/tests/Unit/Input/ResponseStringInputTest.php index 8b6f24c..7d1f6aa 100644 --- a/tests/Unit/Input/ResponseStringInputTest.php +++ b/tests/Unit/Input/ResponseStringInputTest.php @@ -11,6 +11,7 @@ use Art4\JsonApiClient\Exception\InputException; use Art4\JsonApiClient\Input\ResponseStringInput; use Art4\JsonApiClient\Tests\Fixtures\HelperTrait; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; class ResponseStringInputTest extends TestCase @@ -24,12 +25,8 @@ public function testGetAsObjectFromStringReturnsObject(): void $this->assertInstanceOf(\stdClass::class, $input->getAsObject()); } - /** - * @dataProvider jsonValuesProviderWithoutString - * - * @param mixed $input - */ - public function testCreateWithoutStringThrowsException($input): void + #[DataProvider('jsonValuesProviderWithoutString')] + public function testCreateWithoutStringThrowsException(mixed $input): void { $this->expectException(InputException::class); $this->expectExceptionMessage( @@ -38,9 +35,7 @@ public function testCreateWithoutStringThrowsException($input): void new ResponseStringInput($input); } - /** - * @dataProvider jsonValuesAsStringProviderWithoutObject - */ + #[DataProvider('jsonValuesAsStringProviderWithoutObject')] public function testGetAsObjectWithInvalidStringsThrowsException(string $input): void { $input = new ResponseStringInput($input); diff --git a/tests/Unit/Manager/ErrorAbortManagerTest.php b/tests/Unit/Manager/ErrorAbortManagerTest.php index 9cae683..653bfc6 100644 --- a/tests/Unit/Manager/ErrorAbortManagerTest.php +++ b/tests/Unit/Manager/ErrorAbortManagerTest.php @@ -14,9 +14,6 @@ class ErrorAbortManagerTest extends TestCase { - /** - * @test - */ public function testCreateWithConstructorReturnsSelf(): void { $factory = $this->createMock(Factory::class); @@ -25,9 +22,6 @@ public function testCreateWithConstructorReturnsSelf(): void $this->assertSame($factory, $manager->getFactory()); } - /** - * @test - */ public function testGetParamReturnsDefault(): void { $factory = $this->createMock(Factory::class); diff --git a/tests/Unit/V1/AttributesTest.php b/tests/Unit/V1/AttributesTest.php index 865197c..e19a201 100644 --- a/tests/Unit/V1/AttributesTest.php +++ b/tests/Unit/V1/AttributesTest.php @@ -13,6 +13,7 @@ use Art4\JsonApiClient\Exception\ValidationException; use Art4\JsonApiClient\Tests\Fixtures\HelperTrait; use Art4\JsonApiClient\V1\Attributes; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; class AttributesTest extends TestCase @@ -80,12 +81,8 @@ public function testCreateWithObject(): void ], $attributes->getKeys()); } - /** - * @dataProvider jsonValuesProviderWithoutObject - * - * @param mixed $input - */ - public function testCreateWithDataProvider($input): void + #[DataProvider('jsonValuesProviderWithoutObject')] + public function testCreateWithDataProvider(mixed $input): void { $this->expectException(ValidationException::class); $this->expectExceptionMessage( @@ -188,9 +185,6 @@ public function testCreateWithLinksPropertyThrowsException(): void ); } - /** - * @test - */ public function testGetOnANonExistingKeyThrowsException(): void { $object = new \stdClass(); diff --git a/tests/Unit/V1/DocumentLinkTest.php b/tests/Unit/V1/DocumentLinkTest.php index 6227032..da58837 100644 --- a/tests/Unit/V1/DocumentLinkTest.php +++ b/tests/Unit/V1/DocumentLinkTest.php @@ -13,6 +13,7 @@ use Art4\JsonApiClient\Exception\ValidationException; use Art4\JsonApiClient\Tests\Fixtures\HelperTrait; use Art4\JsonApiClient\V1\DocumentLink; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; class DocumentLinkTest extends TestCase @@ -89,13 +90,10 @@ public function testOnlySelfRelatedPaginationPropertiesExists(): void } /** - * @dataProvider jsonValuesProviderWithoutObject - * * links: a links object related to the primary data. - * - * @param mixed $input */ - public function testCreateWithoutObjectThrowsException($input): void + #[DataProvider('jsonValuesProviderWithoutObject')] + public function testCreateWithoutObjectThrowsException(mixed $input): void { $this->expectException(ValidationException::class); $this->expectExceptionMessage( @@ -106,13 +104,10 @@ public function testCreateWithoutObjectThrowsException($input): void } /** - * @dataProvider jsonValuesProviderWithoutObjectAndString - * * test create without object or string attribute throws exception - * - * @param mixed $input */ - public function testCreateWithoutObjectOrStringAttributeThrowsException($input): void + #[DataProvider('jsonValuesProviderWithoutObjectAndString')] + public function testCreateWithoutObjectOrStringAttributeThrowsException(mixed $input): void { $object = new \stdClass(); $object->self = 'http://example.org/self'; @@ -127,13 +122,10 @@ public function testCreateWithoutObjectOrStringAttributeThrowsException($input): } /** - * @dataProvider jsonValuesProviderWithoutObjectAndString - * * self: the link that generated the current response document. - * - * @param mixed $input */ - public function testSelfMustBeAStringOrObject($input): void + #[DataProvider('jsonValuesProviderWithoutObjectAndString')] + public function testSelfMustBeAStringOrObject(mixed $input): void { $object = new \stdClass(); $object->self = $input; @@ -147,8 +139,6 @@ public function testSelfMustBeAStringOrObject($input): void } /** - * @dataProvider jsonValuesProviderWithoutObjectAndString - * * related: a related resource link when the primary data represents a resource relationship. * If present, a related resource link MUST reference a valid URL * @@ -162,10 +152,9 @@ public function testSelfMustBeAStringOrObject($input): void * } * } * } - * - * @param mixed $input */ - public function testRelatedMustBeAStringOrObject($input): void + #[DataProvider('jsonValuesProviderWithoutObjectAndString')] + public function testRelatedMustBeAStringOrObject(mixed $input): void { $object = new \stdClass(); $object->related = $input; @@ -179,13 +168,10 @@ public function testRelatedMustBeAStringOrObject($input): void } /** - * @dataProvider jsonValuesProvider - * * Keys MUST either be omitted or have a null value to indicate that a particular link is unavailable. - * - * @param mixed $input */ - public function testFirstCanBeAnObjectOrStringOrNull($input): void + #[DataProvider('jsonValuesProvider')] + public function testFirstCanBeAnObjectOrStringOrNull(mixed $input): void { $object = new \stdClass(); $object->self = 'https://example.org/self'; @@ -229,13 +215,10 @@ public function testFirstCanBeAnObjectOrStringOrNull($input): void } /** - * @dataProvider jsonValuesProvider - * * Keys MUST either be omitted or have a null value to indicate that a particular link is unavailable. - * - * @param mixed $input */ - public function testLastCanBeAStringOrNull($input): void + #[DataProvider('jsonValuesProvider')] + public function testLastCanBeAStringOrNull(mixed $input): void { $object = new \stdClass(); $object->self = 'https://example.org/self'; @@ -279,13 +262,10 @@ public function testLastCanBeAStringOrNull($input): void } /** - * @dataProvider jsonValuesProvider - * * Keys MUST either be omitted or have a null value to indicate that a particular link is unavailable. - * - * @param mixed $input */ - public function testPrevCanBeAStringOrNull($input): void + #[DataProvider('jsonValuesProvider')] + public function testPrevCanBeAStringOrNull(mixed $input): void { $object = new \stdClass(); $object->self = 'https://example.org/self'; @@ -329,13 +309,10 @@ public function testPrevCanBeAStringOrNull($input): void } /** - * @dataProvider jsonValuesProvider - * * Keys MUST either be omitted or have a null value to indicate that a particular link is unavailable. - * - * @param mixed $input */ - public function testNextCanBeAStringOrNull($input): void + #[DataProvider('jsonValuesProvider')] + public function testNextCanBeAStringOrNull(mixed $input): void { $object = new \stdClass(); $object->self = 'https://example.org/self'; @@ -378,9 +355,6 @@ public function testNextCanBeAStringOrNull($input): void $link = new DocumentLink($object, $this->manager, $this->parent); } - /** - * @test - */ public function testGetOnANonExistingKeyThrowsException(): void { $object = new \stdClass(); diff --git a/tests/Unit/V1/DocumentTest.php b/tests/Unit/V1/DocumentTest.php index 5a8e949..d62ef94 100644 --- a/tests/Unit/V1/DocumentTest.php +++ b/tests/Unit/V1/DocumentTest.php @@ -13,6 +13,7 @@ use Art4\JsonApiClient\Exception\ValidationException; use Art4\JsonApiClient\Tests\Fixtures\HelperTrait; use Art4\JsonApiClient\V1\Document; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; class DocumentTest extends TestCase @@ -85,13 +86,10 @@ public function testCreateWithAllPossibleValues(): void } /** - * @dataProvider jsonValuesProviderWithoutObject - * * A JSON object MUST be at the root of every JSON API request and response containing data. - * - * @param mixed $input */ - public function testCreateWithDataproviderThrowsException($input): void + #[DataProvider('jsonValuesProviderWithoutObject')] + public function testCreateWithDataproviderThrowsException(mixed $input): void { $this->expectException(ValidationException::class); $this->expectExceptionMessage( @@ -229,13 +227,10 @@ public function testCreateDataWithResourceCollectionResources(): void } /** - * @dataProvider jsonValuesProviderWithoutObject - * * Test create with any value in data - * - * @param mixed $input */ - public function testCreateWithDataproviderInValue($input): void + #[DataProvider('jsonValuesProviderWithoutObject')] + public function testCreateWithDataproviderInValue(mixed $input): void { // Test with empty array in data @@ -413,9 +408,6 @@ public function testCreateIncludedWithoutDataThrowsException(): void $document = new Document($object, $this->manager, $this->parent); } - /** - * @test - */ public function testGetOnANonExistingKeyThrowsException(): void { $object = new \stdClass(); diff --git a/tests/Unit/V1/ErrorCollectionTest.php b/tests/Unit/V1/ErrorCollectionTest.php index e6fc4a1..00db6b0 100644 --- a/tests/Unit/V1/ErrorCollectionTest.php +++ b/tests/Unit/V1/ErrorCollectionTest.php @@ -14,6 +14,7 @@ use Art4\JsonApiClient\Helper\AccessKey; use Art4\JsonApiClient\Tests\Fixtures\HelperTrait; use Art4\JsonApiClient\V1\ErrorCollection; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; class ErrorCollectionTest extends TestCase @@ -63,12 +64,8 @@ public function testCreate(): void $this->assertInstanceOf(Accessable::class, $error); } - /** - * @dataProvider jsonValuesProvider - * - * @param mixed $input - */ - public function testCreateWithoutArrayThrowsException($input): void + #[DataProvider('jsonValuesProvider')] + public function testCreateWithoutArrayThrowsException(mixed $input): void { // Input must be an array with at least one object if (gettype($input) === 'array') { diff --git a/tests/Unit/V1/ErrorLinkTest.php b/tests/Unit/V1/ErrorLinkTest.php index 7b66639..3a4dfe0 100644 --- a/tests/Unit/V1/ErrorLinkTest.php +++ b/tests/Unit/V1/ErrorLinkTest.php @@ -13,6 +13,7 @@ use Art4\JsonApiClient\Exception\ValidationException; use Art4\JsonApiClient\Tests\Fixtures\HelperTrait; use Art4\JsonApiClient\V1\ErrorLink; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; class ErrorLinkTest extends TestCase @@ -100,13 +101,10 @@ public function testAboutCanBeAnObject(): void } /** - * @dataProvider jsonValuesProviderWithoutObject - * * The value of each links member MUST be an object (a "links object"). - * - * @param mixed $input */ - public function testCreateWithDataprovider($input): void + #[DataProvider('jsonValuesProviderWithoutObject')] + public function testCreateWithDataprovider(mixed $input): void { $this->expectException(ValidationException::class); $this->expectExceptionMessage( @@ -117,13 +115,10 @@ public function testCreateWithDataprovider($input): void } /** - * @dataProvider jsonValuesProviderWithoutObjectAndString - * * test create without object or string attribute throws exception - * - * @param mixed $input */ - public function testCreateWithoutObjectOrStringAttributeThrowsException($input): void + #[DataProvider('jsonValuesProviderWithoutObjectAndString')] + public function testCreateWithoutObjectOrStringAttributeThrowsException(mixed $input): void { $object = new \stdClass(); $object->about = 'http://example.org/about'; @@ -138,13 +133,10 @@ public function testCreateWithoutObjectOrStringAttributeThrowsException($input): } /** - * @dataProvider jsonValuesProviderWithoutObjectAndString - * * The value of the about member MUST be an object (a "links object") or a string. - * - * @param mixed $input */ - public function testAboutWithDataproviderThrowsException($input): void + #[DataProvider('jsonValuesProviderWithoutObjectAndString')] + public function testAboutWithDataproviderThrowsException(mixed $input): void { $object = new \stdClass(); $object->about = $input; @@ -157,9 +149,6 @@ public function testAboutWithDataproviderThrowsException($input): void $link = new ErrorLink($object, $this->manager, $this->parent); } - /** - * @test - */ public function testGetOnANonExistingKeyThrowsException(): void { $object = new \stdClass(); diff --git a/tests/Unit/V1/ErrorSourceTest.php b/tests/Unit/V1/ErrorSourceTest.php index 553a99e..f6cab45 100644 --- a/tests/Unit/V1/ErrorSourceTest.php +++ b/tests/Unit/V1/ErrorSourceTest.php @@ -13,6 +13,7 @@ use Art4\JsonApiClient\Exception\ValidationException; use Art4\JsonApiClient\Tests\Fixtures\HelperTrait; use Art4\JsonApiClient\V1\ErrorSource; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; class ErrorSourceTest extends TestCase @@ -68,13 +69,10 @@ public function testOnlyPointerParameterPropertiesExists(): void } /** - * @dataProvider jsonValuesProviderWithoutObject - * * source: an object containing references to ... - * - * @param mixed $input */ - public function testCreateWithoutObjectThrowsException($input): void + #[DataProvider('jsonValuesProviderWithoutObject')] + public function testCreateWithoutObjectThrowsException(mixed $input): void { $this->expectException(ValidationException::class); $this->expectExceptionMessage( @@ -85,13 +83,10 @@ public function testCreateWithoutObjectThrowsException($input): void } /** - * @dataProvider jsonValuesProviderWithoutString - * * pointer: a JSON Pointer [RFC6901] to the associated entity in the request document [e.g. "/data" for a primary data object, or "/data/attributes/title" for a specific attribute]. - * - * @param mixed $input */ - public function testPointerMustBeAString($input): void + #[DataProvider('jsonValuesProviderWithoutString')] + public function testPointerMustBeAString(mixed $input): void { $object = new \stdClass(); $object->pointer = $input; @@ -105,13 +100,10 @@ public function testPointerMustBeAString($input): void } /** - * @dataProvider jsonValuesProviderWithoutString - * * parameter: a string indicating which query parameter caused the error. - * - * @param mixed $input */ - public function testParameterMustBeAString($input): void + #[DataProvider('jsonValuesProviderWithoutString')] + public function testParameterMustBeAString(mixed $input): void { $object = new \stdClass(); $object->parameter = $input; diff --git a/tests/Unit/V1/ErrorTest.php b/tests/Unit/V1/ErrorTest.php index a777c85..c3c9b22 100644 --- a/tests/Unit/V1/ErrorTest.php +++ b/tests/Unit/V1/ErrorTest.php @@ -13,6 +13,7 @@ use Art4\JsonApiClient\Exception\ValidationException; use Art4\JsonApiClient\Tests\Fixtures\HelperTrait; use Art4\JsonApiClient\V1\Error; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; class ErrorTest extends TestCase @@ -80,12 +81,8 @@ public function testCreateWithObjectReturnsSelf(): void $error->get('something'); } - /** - * @dataProvider jsonValuesProviderWithoutObject - * - * @param mixed $input - */ - public function testCreateWithoutObjectThrowsException($input): void + #[DataProvider('jsonValuesProviderWithoutObject')] + public function testCreateWithoutObjectThrowsException(mixed $input): void { $this->expectException(ValidationException::class); $this->expectExceptionMessage( @@ -95,12 +92,8 @@ public function testCreateWithoutObjectThrowsException($input): void $error = new Error($input, $this->manager, $this->parent); } - /** - * @dataProvider jsonValuesProviderWithoutString - * - * @param mixed $input - */ - public function testCreateIdWithoutStringThrowsException($input): void + #[DataProvider('jsonValuesProviderWithoutString')] + public function testCreateIdWithoutStringThrowsException(mixed $input): void { $object = new \stdClass(); $object->id = $input; @@ -113,12 +106,8 @@ public function testCreateIdWithoutStringThrowsException($input): void $error = new Error($object, $this->manager, $this->parent); } - /** - * @dataProvider jsonValuesProviderWithoutString - * - * @param mixed $input - */ - public function testCreateStatusWithoutStringThrowsException($input): void + #[DataProvider('jsonValuesProviderWithoutString')] + public function testCreateStatusWithoutStringThrowsException(mixed $input): void { $object = new \stdClass(); $object->status = $input; @@ -131,12 +120,8 @@ public function testCreateStatusWithoutStringThrowsException($input): void $error = new Error($object, $this->manager, $this->parent); } - /** - * @dataProvider jsonValuesProviderWithoutString - * - * @param mixed $input - */ - public function testCreateCodeWithoutStringThrowsException($input): void + #[DataProvider('jsonValuesProviderWithoutString')] + public function testCreateCodeWithoutStringThrowsException(mixed $input): void { $object = new \stdClass(); $object->code = $input; @@ -149,12 +134,8 @@ public function testCreateCodeWithoutStringThrowsException($input): void $error = new Error($object, $this->manager, $this->parent); } - /** - * @dataProvider jsonValuesProviderWithoutString - * - * @param mixed $input - */ - public function testCreateTitleWithoutStringThrowsException($input): void + #[DataProvider('jsonValuesProviderWithoutString')] + public function testCreateTitleWithoutStringThrowsException(mixed $input): void { $object = new \stdClass(); $object->title = $input; @@ -167,12 +148,8 @@ public function testCreateTitleWithoutStringThrowsException($input): void $error = new Error($object, $this->manager, $this->parent); } - /** - * @dataProvider jsonValuesProviderWithoutString - * - * @param mixed $input - */ - public function testCreateDetailWithoutStringThrowsException($input): void + #[DataProvider('jsonValuesProviderWithoutString')] + public function testCreateDetailWithoutStringThrowsException(mixed $input): void { $object = new \stdClass(); $object->detail = $input; diff --git a/tests/Unit/V1/FactoryTest.php b/tests/Unit/V1/FactoryTest.php index ea2b356..1294809 100644 --- a/tests/Unit/V1/FactoryTest.php +++ b/tests/Unit/V1/FactoryTest.php @@ -19,9 +19,6 @@ class FactoryTest extends TestCase { - /** - * @test - */ public function testInjectACustomClass(): void { $factory = new Factory([ diff --git a/tests/Unit/V1/JsonapiTest.php b/tests/Unit/V1/JsonapiTest.php index ccbeb0a..6e26e38 100644 --- a/tests/Unit/V1/JsonapiTest.php +++ b/tests/Unit/V1/JsonapiTest.php @@ -13,6 +13,7 @@ use Art4\JsonApiClient\Exception\ValidationException; use Art4\JsonApiClient\Tests\Fixtures\HelperTrait; use Art4\JsonApiClient\V1\Jsonapi; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; class JsonapiTest extends TestCase @@ -70,13 +71,10 @@ public function testCreateWithObject(): void } /** - * @dataProvider jsonValuesProviderWithoutObject - * * If present, the value of the jsonapi member MUST be an object (a "jsonapi object"). - * - * @param mixed $input */ - public function testCreateWithDataprovider($input): void + #[DataProvider('jsonValuesProviderWithoutObject')] + public function testCreateWithDataprovider(mixed $input): void { $this->expectException(ValidationException::class); $this->expectExceptionMessage( @@ -87,13 +85,10 @@ public function testCreateWithDataprovider($input): void } /** - * @dataProvider jsonValuesProvider - * * The jsonapi object MAY contain a version member whose value is a string - * - * @param mixed $input */ - public function testVersionCannotBeAnObjectOrArray($input): void + #[DataProvider('jsonValuesProvider')] + public function testVersionCannotBeAnObjectOrArray(mixed $input): void { $object = new \stdClass(); $object->version = $input; diff --git a/tests/Unit/V1/LinkTest.php b/tests/Unit/V1/LinkTest.php index e62d237..39442ac 100644 --- a/tests/Unit/V1/LinkTest.php +++ b/tests/Unit/V1/LinkTest.php @@ -13,6 +13,7 @@ use Art4\JsonApiClient\Exception\ValidationException; use Art4\JsonApiClient\Tests\Fixtures\HelperTrait; use Art4\JsonApiClient\V1\Link; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; class LinkTest extends TestCase @@ -63,14 +64,11 @@ public function testCreateWithObject(): void } /** - * @dataProvider jsonValuesProvider - * * - an object ("link object") which can contain the following members: * - href: a string containing the link's URL. - * - * @param mixed $input */ - public function testHrefHasToBeAString($input): void + #[DataProvider('jsonValuesProvider')] + public function testHrefHasToBeAString(mixed $input): void { $object = new \stdClass(); $object->href = $input; @@ -127,13 +125,10 @@ public function testMetaIsParsedAsObject(): void } /** - * @dataProvider jsonValuesProviderWithoutObject - * * The value of each links member MUST be an object (a "links object"). - * - * @param mixed $input */ - public function testCreateWithDataprovider($input): void + #[DataProvider('jsonValuesProviderWithoutObject')] + public function testCreateWithDataprovider(mixed $input): void { $this->expectException(ValidationException::class); $this->expectExceptionMessage( diff --git a/tests/Unit/V1/MetaTest.php b/tests/Unit/V1/MetaTest.php index 218ed5f..defdb04 100644 --- a/tests/Unit/V1/MetaTest.php +++ b/tests/Unit/V1/MetaTest.php @@ -13,6 +13,7 @@ use Art4\JsonApiClient\Exception\ValidationException; use Art4\JsonApiClient\Tests\Fixtures\HelperTrait; use Art4\JsonApiClient\V1\Meta; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; class MetaTest extends TestCase @@ -76,13 +77,10 @@ public function testCreateWithObject(): void } /** - * @dataProvider jsonValuesProviderWithoutObject - * * The value of each meta member MUST be an object (a "meta object"). - * - * @param mixed $input */ - public function testCreateWithoutObjectThrowsException($input): void + #[DataProvider('jsonValuesProviderWithoutObject')] + public function testCreateWithoutObjectThrowsException(mixed $input): void { $this->expectException(ValidationException::class); $this->expectExceptionMessage('Meta has to be an object, "' . gettype($input) . '" given.'); diff --git a/tests/Unit/V1/RelationshipCollectionTest.php b/tests/Unit/V1/RelationshipCollectionTest.php index fa6ef95..9982184 100644 --- a/tests/Unit/V1/RelationshipCollectionTest.php +++ b/tests/Unit/V1/RelationshipCollectionTest.php @@ -13,6 +13,7 @@ use Art4\JsonApiClient\Exception\ValidationException; use Art4\JsonApiClient\Tests\Fixtures\HelperTrait; use Art4\JsonApiClient\V1\RelationshipCollection; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; class RelationshipCollectionTest extends TestCase @@ -158,12 +159,8 @@ public function testCreateWithAuthorInRelationshipsAndAttributesThrowsException( $collection = new RelationshipCollection($object, $this->manager, $item); } - /** - * @dataProvider jsonValuesProviderWithoutObject - * - * @param mixed $input - */ - public function testCreateWithoutObjectThrowsException($input): void + #[DataProvider('jsonValuesProviderWithoutObject')] + public function testCreateWithoutObjectThrowsException(mixed $input): void { $this->expectException(ValidationException::class); $this->expectExceptionMessage( diff --git a/tests/Unit/V1/RelationshipLinkTest.php b/tests/Unit/V1/RelationshipLinkTest.php index 475e080..2962623 100644 --- a/tests/Unit/V1/RelationshipLinkTest.php +++ b/tests/Unit/V1/RelationshipLinkTest.php @@ -14,6 +14,7 @@ use Art4\JsonApiClient\Tests\Fixtures\HelperTrait; use Art4\JsonApiClient\V1\ResourceIdentifierCollection; use Art4\JsonApiClient\V1\RelationshipLink; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; class RelationshipLinkTest extends TestCase @@ -200,13 +201,10 @@ public function testPaginationNotParsedIfRelationshipIdentifierCollectionNotExis } /** - * @dataProvider jsonValuesProviderWithoutObject - * * links: a links object containing at least one of the following: - * - * @param mixed $input */ - public function testCreateWithoutObjectThrowsException($input): void + #[DataProvider('jsonValuesProviderWithoutObject')] + public function testCreateWithoutObjectThrowsException(mixed $input): void { $this->expectException(ValidationException::class); $this->expectExceptionMessage( @@ -217,13 +215,10 @@ public function testCreateWithoutObjectThrowsException($input): void } /** - * @dataProvider jsonValuesProviderWithoutObjectAndString - * * test create without object or string attribute throws exception - * - * @param mixed $input */ - public function testCreateWithoutObjectOrStringAttributeThrowsException($input): void + #[DataProvider('jsonValuesProviderWithoutObjectAndString')] + public function testCreateWithoutObjectOrStringAttributeThrowsException(mixed $input): void { $object = new \stdClass(); $object->self = 'http://example.org/self'; @@ -255,13 +250,10 @@ public function testCreateWithoutSelfAndRelatedPropertiesThrowsException(): void } /** - * @dataProvider jsonValuesProviderWithoutObjectAndString - * * self: a link for the relationship itself (a "relationship link"). - * - * @param mixed $input */ - public function testSelfMustBeAStringOrObject($input): void + #[DataProvider('jsonValuesProviderWithoutObjectAndString')] + public function testSelfMustBeAStringOrObject(mixed $input): void { $object = new \stdClass(); $object->self = $input; @@ -275,14 +267,11 @@ public function testSelfMustBeAStringOrObject($input): void } /** - * @dataProvider jsonValuesProviderWithoutObjectAndString - * * related: a related resource link when the primary data represents a resource relationship. * If present, a related resource link MUST reference a valid URL - * - * @param mixed $input */ - public function testRelatedMustBeAStringOrObject($input): void + #[DataProvider('jsonValuesProviderWithoutObjectAndString')] + public function testRelatedMustBeAStringOrObject(mixed $input): void { $object = new \stdClass(); $object->related = $input; @@ -296,13 +285,10 @@ public function testRelatedMustBeAStringOrObject($input): void } /** - * @dataProvider jsonValuesProvider - * * Keys MUST either be omitted or have a null value to indicate that a particular link is unavailable. - * - * @param mixed $input */ - public function testFirstCanBeAStringOrNull($input): void + #[DataProvider('jsonValuesProvider')] + public function testFirstCanBeAStringOrNull(mixed $input): void { $object = new \stdClass(); $object->self = 'https://example.org/self'; @@ -337,13 +323,10 @@ public function testFirstCanBeAStringOrNull($input): void } /** - * @dataProvider jsonValuesProvider - * * Keys MUST either be omitted or have a null value to indicate that a particular link is unavailable. - * - * @param mixed $input */ - public function testLastCanBeAStringOrNull($input): void + #[DataProvider('jsonValuesProvider')] + public function testLastCanBeAStringOrNull(mixed $input): void { $object = new \stdClass(); $object->self = 'https://example.org/self'; @@ -378,13 +361,10 @@ public function testLastCanBeAStringOrNull($input): void } /** - * @dataProvider jsonValuesProvider - * * Keys MUST either be omitted or have a null value to indicate that a particular link is unavailable. - * - * @param mixed $input */ - public function testPrevCanBeAStringOrNull($input): void + #[DataProvider('jsonValuesProvider')] + public function testPrevCanBeAStringOrNull(mixed $input): void { $object = new \stdClass(); $object->self = 'https://example.org/self'; @@ -419,13 +399,10 @@ public function testPrevCanBeAStringOrNull($input): void } /** - * @dataProvider jsonValuesProvider - * * Keys MUST either be omitted or have a null value to indicate that a particular link is unavailable. - * - * @param mixed $input */ - public function testNextCanBeAStringOrNull($input): void + #[DataProvider('jsonValuesProvider')] + public function testNextCanBeAStringOrNull(mixed $input): void { $object = new \stdClass(); $object->self = 'https://example.org/self'; @@ -459,9 +436,6 @@ public function testNextCanBeAStringOrNull($input): void $link = new RelationshipLink($object, $this->manager, $this->relationship); } - /** - * @test - */ public function testGetOnANonExistingKeyThrowsException(): void { $object = new \stdClass(); diff --git a/tests/Unit/V1/RelationshipTest.php b/tests/Unit/V1/RelationshipTest.php index 7574890..3a28544 100644 --- a/tests/Unit/V1/RelationshipTest.php +++ b/tests/Unit/V1/RelationshipTest.php @@ -13,6 +13,7 @@ use Art4\JsonApiClient\Exception\ValidationException; use Art4\JsonApiClient\Tests\Fixtures\HelperTrait; use Art4\JsonApiClient\V1\Relationship; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; class RelationshipTest extends TestCase @@ -59,13 +60,10 @@ public function testCreateWithObjectReturnsSelf(): void } /** - * @dataProvider jsonValuesProviderWithoutObject - * * The value of the relationships key MUST be an object (a "relationships object"). - * - * @param mixed $input */ - public function testCreateWithoutObjectThrowsException($input): void + #[DataProvider('jsonValuesProviderWithoutObject')] + public function testCreateWithoutObjectThrowsException(mixed $input): void { $this->expectException(ValidationException::class); $this->expectExceptionMessage( diff --git a/tests/Unit/V1/ResourceCollectionTest.php b/tests/Unit/V1/ResourceCollectionTest.php index 9955a9d..30cd6f8 100644 --- a/tests/Unit/V1/ResourceCollectionTest.php +++ b/tests/Unit/V1/ResourceCollectionTest.php @@ -14,6 +14,7 @@ use Art4\JsonApiClient\Helper\AccessKey; use Art4\JsonApiClient\Tests\Fixtures\HelperTrait; use Art4\JsonApiClient\V1\ResourceCollection; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; class ResourceCollectionTest extends TestCase @@ -133,12 +134,8 @@ public function testCreateWithItem(): void $this->assertInstanceOf(Accessable::class, $resource); } - /** - * @dataProvider jsonValuesProviderWithoutArray - * - * @param mixed $input - */ - public function testCreateWithoutArrayThrowsException($input): void + #[DataProvider('jsonValuesProviderWithoutArray')] + public function testCreateWithoutArrayThrowsException(mixed $input): void { $this->expectException(ValidationException::class); $this->expectExceptionMessage( @@ -148,12 +145,8 @@ public function testCreateWithoutArrayThrowsException($input): void $collection = new ResourceCollection($input, $this->manager, $this->parent); } - /** - * @dataProvider jsonValuesProviderWithoutObject - * - * @param mixed $input - */ - public function testCreateWithoutObjectInArrayThrowsException($input): void + #[DataProvider('jsonValuesProviderWithoutObject')] + public function testCreateWithoutObjectInArrayThrowsException(mixed $input): void { $this->expectException(ValidationException::class); $this->expectExceptionMessage( diff --git a/tests/Unit/V1/ResourceIdentifierCollectionTest.php b/tests/Unit/V1/ResourceIdentifierCollectionTest.php index 3ab6f02..805537a 100644 --- a/tests/Unit/V1/ResourceIdentifierCollectionTest.php +++ b/tests/Unit/V1/ResourceIdentifierCollectionTest.php @@ -13,6 +13,7 @@ use Art4\JsonApiClient\Exception\ValidationException; use Art4\JsonApiClient\Tests\Fixtures\HelperTrait; use Art4\JsonApiClient\V1\ResourceIdentifierCollection; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; class ResourceIdentifierCollectionTest extends TestCase @@ -95,12 +96,8 @@ public function testCreateWithItem(): void $this->assertInstanceOf(Accessable::class, $resource); } - /** - * @dataProvider jsonValuesProviderWithoutArray - * - * @param mixed $input - */ - public function testCreateWithoutArrayThrowsException($input): void + #[DataProvider('jsonValuesProviderWithoutArray')] + public function testCreateWithoutArrayThrowsException(mixed $input): void { $this->expectException(ValidationException::class); $this->expectExceptionMessage( diff --git a/tests/Unit/V1/ResourceIdentifierTest.php b/tests/Unit/V1/ResourceIdentifierTest.php index 65e4ff5..c0867f7 100644 --- a/tests/Unit/V1/ResourceIdentifierTest.php +++ b/tests/Unit/V1/ResourceIdentifierTest.php @@ -13,6 +13,7 @@ use Art4\JsonApiClient\Exception\ValidationException; use Art4\JsonApiClient\Tests\Fixtures\HelperTrait; use Art4\JsonApiClient\V1\ResourceIdentifier; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; class ResourceIdentifierTest extends TestCase @@ -72,13 +73,10 @@ public function testCreateWithObjectAndMeta(): void } /** - * @dataProvider jsonValuesProviderWithoutString - * * The values of the id and type members MUST be strings. - * - * @param mixed $input */ - public function testTypeMustBeAString($input): void + #[DataProvider('jsonValuesProviderWithoutString')] + public function testTypeMustBeAString(mixed $input): void { $object = new \stdClass(); $object->type = $input; @@ -95,13 +93,10 @@ public function testTypeMustBeAString($input): void } /** - * @dataProvider jsonValuesProviderWithoutString - * * The values of the id and type members MUST be strings. - * - * @param mixed $input */ - public function testIdMustBeAString($input): void + #[DataProvider('jsonValuesProviderWithoutString')] + public function testIdMustBeAString(mixed $input): void { $object = new \stdClass(); $object->type = 'posts'; @@ -116,14 +111,11 @@ public function testIdMustBeAString($input): void } /** - * @dataProvider jsonValuesProviderWithoutObject - * * A "resource identifier object" is an object that identifies an individual resource. * A "resource identifier object" MUST contain type and id members. - * - * @param mixed $input */ - public function testCreateWithDataproviderThrowsException($input): void + #[DataProvider('jsonValuesProviderWithoutObject')] + public function testCreateWithDataproviderThrowsException(mixed $input): void { $this->expectException(ValidationException::class); $this->expectExceptionMessage( diff --git a/tests/Unit/V1/ResourceItemLinkTest.php b/tests/Unit/V1/ResourceItemLinkTest.php index 1d98f6f..c45b83c 100644 --- a/tests/Unit/V1/ResourceItemLinkTest.php +++ b/tests/Unit/V1/ResourceItemLinkTest.php @@ -13,6 +13,7 @@ use Art4\JsonApiClient\Exception\ValidationException; use Art4\JsonApiClient\Tests\Fixtures\HelperTrait; use Art4\JsonApiClient\V1\ResourceItemLink; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; class ResourceItemLinkTest extends TestCase @@ -55,13 +56,10 @@ public function testParsingPropertiesExists(): void } /** - * @dataProvider jsonValuesProviderWithoutObject - * * links: a links object related to the primary data. - * - * @param mixed $input */ - public function testCreateWithoutObjectThrowsException($input): void + #[DataProvider('jsonValuesProviderWithoutObject')] + public function testCreateWithoutObjectThrowsException(mixed $input): void { $this->expectException(ValidationException::class); $this->expectExceptionMessage( @@ -72,13 +70,10 @@ public function testCreateWithoutObjectThrowsException($input): void } /** - * @dataProvider jsonValuesProviderWithoutObjectAndString - * * test create without object or string attribute throws exception - * - * @param mixed $input */ - public function testCreateWithoutObjectOrStringAttributeThrowsException($input): void + #[DataProvider('jsonValuesProviderWithoutObjectAndString')] + public function testCreateWithoutObjectOrStringAttributeThrowsException(mixed $input): void { $object = new \stdClass(); $object->input = $input; @@ -91,9 +86,6 @@ public function testCreateWithoutObjectOrStringAttributeThrowsException($input): $link = new ResourceItemLink($object, $this->manager, $this->parent); } - /** - * @test - */ public function testGetOnANonExistingKeyThrowsException(): void { $object = new \stdClass(); diff --git a/tests/Unit/V1/ResourceItemTest.php b/tests/Unit/V1/ResourceItemTest.php index 8641760..44030be 100644 --- a/tests/Unit/V1/ResourceItemTest.php +++ b/tests/Unit/V1/ResourceItemTest.php @@ -13,6 +13,7 @@ use Art4\JsonApiClient\Exception\ValidationException; use Art4\JsonApiClient\Tests\Fixtures\HelperTrait; use Art4\JsonApiClient\V1\ResourceItem; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; class ResourceItemTest extends TestCase @@ -96,13 +97,10 @@ public function testCreateWithFullObject(): void } /** - * @dataProvider jsonValuesProviderWithoutString - * * The values of the id and type members MUST be strings. - * - * @param mixed $input */ - public function testTypeMustBeAString($input): void + #[DataProvider('jsonValuesProviderWithoutString')] + public function testTypeMustBeAString(mixed $input): void { $object = new \stdClass(); $object->type = $input; @@ -117,13 +115,10 @@ public function testTypeMustBeAString($input): void } /** - * @dataProvider jsonValuesProviderWithoutString - * * The values of the id and type members MUST be strings. - * - * @param mixed $input */ - public function testIdMustBeAString($input): void + #[DataProvider('jsonValuesProviderWithoutString')] + public function testIdMustBeAString(mixed $input): void { $object = new \stdClass(); $object->type = 'posts'; @@ -138,14 +133,11 @@ public function testIdMustBeAString($input): void } /** - * @dataProvider jsonValuesProviderWithoutObject - * * A "resource object" is an object that identifies an individual resource. * A "resource object" MUST contain type and id members. - * - * @param mixed $input */ - public function testCreateWithDataproviderThrowsException($input): void + #[DataProvider('jsonValuesProviderWithoutObject')] + public function testCreateWithDataproviderThrowsException(mixed $input): void { $this->expectException(ValidationException::class); $this->expectExceptionMessage( diff --git a/tests/Unit/V1/ResourceNullTest.php b/tests/Unit/V1/ResourceNullTest.php index b476e3d..e350356 100644 --- a/tests/Unit/V1/ResourceNullTest.php +++ b/tests/Unit/V1/ResourceNullTest.php @@ -12,6 +12,7 @@ use Art4\JsonApiClient\Exception\AccessException; use Art4\JsonApiClient\Tests\Fixtures\HelperTrait; use Art4\JsonApiClient\V1\ResourceNull; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; class ResourceNullTest extends TestCase @@ -29,12 +30,8 @@ public function setUp(): void $this->parent = $this->createMock(Accessable::class); } - /** - * @dataProvider jsonValuesProvider - * - * @param mixed $input - */ - public function testCreateWithDataProvider($input): void + #[DataProvider('jsonValuesProvider')] + public function testCreateWithDataProvider(mixed $input): void { $resource = new ResourceNull( $input,