Skip to content

Commit 4165e68

Browse files
author
Matej Grgić
committed
fix: deprecated warnings
1 parent 8b87cc1 commit 4165e68

File tree

4 files changed

+31
-82
lines changed

4 files changed

+31
-82
lines changed

phpunit.xml.dist

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<!-- https://phpunit.de/manual/current/en/appendixes.configuration.html -->
3-
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/11.1/phpunit.xsd" backupGlobals="false" colors="true" bootstrap="vendor/autoload.php" cacheDirectory=".phpunit.cache">
3+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/11.1/phpunit.xsd" backupGlobals="false" colors="true" bootstrap="vendor/autoload.php" cacheDirectory=".phpunit.cache"
4+
displayDetailsOnTestsThatTriggerDeprecations="true"
5+
displayDetailsOnTestsThatTriggerWarnings="true"
6+
>
47
<coverage>
58
<report>
69
<clover outputFile="tests/_reports/logs/clover.xml"/>

tests/Bridge/OpenAPI/Model/Article.php

+26-75
Original file line numberDiff line numberDiff line change
@@ -6,93 +6,44 @@
66

77
use Symfony\Component\Validator\Constraints as Assert;
88
use Undabot\SymfonyJsonApi\Model\ApiModel;
9-
use Undabot\SymfonyJsonApi\Model\Resource\Annotation\Attribute;
10-
use Undabot\SymfonyJsonApi\Model\Resource\Annotation\ToMany;
11-
use Undabot\SymfonyJsonApi\Model\Resource\Annotation\ToOne;
9+
use Undabot\SymfonyJsonApi\Model\Resource\Attribute\Attribute;
10+
use Undabot\SymfonyJsonApi\Model\Resource\Attribute\ToMany;
11+
use Undabot\SymfonyJsonApi\Model\Resource\Attribute\ToOne;
1212
use Undabot\SymfonyJsonApi\Service\Resource\Validation\Constraint\ResourceType;
1313

14-
/** @ResourceType(type="article") */
14+
#[ResourceType('article')]
1515
class Article implements ApiModel
1616
{
17-
/**
18-
* @var string
19-
*/
20-
private $id;
17+
private string $id;
2118

22-
/**
23-
* @var string
24-
*
25-
* @Attribute(nullable=false)
26-
*/
27-
private $slug;
19+
#[Attribute('slug')]
20+
private string $slug;
2821

29-
/**
30-
* @var string
31-
*
32-
* @Attribute
33-
*/
34-
private $title;
22+
#[Attribute('titlw')]
23+
private string $title;
3524

36-
/**
37-
* @var string
38-
*
39-
* @Attribute(name="eventAddress")
40-
*/
41-
private $address;
25+
#[Attribute('eventAddress')]
26+
private string $address;
4227

43-
/**
44-
* @var string
45-
*
46-
* @Attribute(name="eventDate")
47-
*/
48-
#[\Undabot\SymfonyJsonApi\Model\Resource\Attribute\Attribute('ovoJeIme')]
49-
private $date;
28+
#[Attribute('eventDate')]
29+
private string $date;
5030

51-
/**
52-
* @var bool
53-
*
54-
* @Attribute
55-
*/
56-
private $enabled;
31+
#[Attribute('enabled')]
32+
private bool $enabled;
5733

58-
/**
59-
* @var null|string
60-
*
61-
* @Attribute
62-
*/
63-
private $description;
34+
#[Attribute('description', null, null, null, true)]
35+
private ?string $description;
6436

65-
/**
66-
* @var string
67-
*
68-
* @ToOne(name="category", type="category", nullable=true)
69-
*
70-
* @Assert\Type(type="string")
71-
*/
72-
private $categoryId;
37+
#[ToOne('category', 'category', null, true)]
38+
private string $categoryId;
7339

74-
/**
75-
* @var string[]
76-
*
77-
* @ToMany(name="tags", type="tag", nullable=false)
78-
*
79-
* @Assert\Type(type="array")
80-
*/
81-
private $tagIds;
40+
#[ToMany('tags', 'tag')]
41+
#[Assert\Type('array')]
42+
private array $tagIds;
8243

83-
/**
84-
* @var string
85-
*
86-
* @Attribute(format="datetime", example="2001")
87-
*
88-
* @Assert\NotBlank
89-
*/
90-
private $createdAt;
44+
#[Attribute('createdAt', null, null, 'datetime')]
45+
private string $createdAt;
9146

92-
/**
93-
* @var null|string
94-
*
95-
* @Attribute
96-
*/
97-
private $updatedAt;
47+
#[Attribute('updatedAt')]
48+
private ?string $updatedAt;
9849
}

tests/Unit/Http/Service/Factory/RequestFactoryTest.php

-5
Original file line numberDiff line numberDiff line change
@@ -282,11 +282,6 @@ public static function invalidRequestPrimaryDataProvider(): iterable
282282
'Request data must be valid JSON',
283283
];
284284

285-
yield 'Null data given' => [
286-
null,
287-
'Request data must be valid JSON',
288-
];
289-
290285
yield 'Not array given' => [
291286
'2',
292287
'Request data must be parsable to a valid array',

tests/Unit/Http/Service/Factory/ResourceCollectionResponseTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ public static function provideFromArrayWillThrowExceptionGivenInvalidArgumentsPr
180180

181181
yield 'Resource array not valid type' => [
182182
[$objectCollection, ResourceInterface::class],
183-
null,
183+
[],
184184
null,
185185
null,
186186
'Class "' . \get_class($objectCollection) . '" was expected to be instanceof of "Undabot\JsonApi\Definition\Model\Resource\ResourceInterface" but is not.',

0 commit comments

Comments
 (0)