Skip to content

Commit 2f9d4ff

Browse files
authored
ci: fix tests (api-platform#5421)
* ci: fix tests * ci: cs fixes * ci: fix cs & phpstan
1 parent 5723d68 commit 2f9d4ff

File tree

275 files changed

+892
-21
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

275 files changed

+892
-21
lines changed

features/authorization/deny.feature

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,4 +202,3 @@ Feature: Authorization checking
202202
And I send a "GET" request to "/secured_dummies"
203203
Then the response status code should be 200
204204
And the response should contain "ownerOnlyProperty"
205-

src/Core/Annotation/ApiFilter.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ final class ApiFilter
5454
public $arguments = [];
5555

5656
/**
57-
* @param string $filterClass
57+
* @param mixed $filterClass
5858
* @param string $id
5959
* @param string $strategy
6060
*/
@@ -65,9 +65,9 @@ public function __construct(
6565
array $properties = [],
6666
array $arguments = []
6767
) {
68-
if (\is_array($filterClass)) { /** @phpstan-ignore-line Doctrine annotations */
68+
if (\is_array($filterClass)) {
6969
$options = $filterClass;
70-
$this->filterClass = $options['value'] ?? null; /* @phpstan-ignore-line Doctrine annotations */
70+
$this->filterClass = $options['value'] ?? null;
7171
unset($options['value']);
7272

7373
foreach ($options as $key => $value) {

src/Core/Annotation/ApiProperty.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@
2323
* @Annotation
2424
*
2525
* @Target({"METHOD", "PROPERTY"})
26+
*
2627
* @Attributes(
28+
*
2729
* @Attribute("deprecationReason", type="string"),
2830
* @Attribute("fetchable", type="bool"),
2931
* @Attribute("fetchEager", type="bool"),

src/Core/Annotation/ApiResource.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@
2323
* @Annotation
2424
*
2525
* @Target({"CLASS"})
26+
*
2627
* @Attributes(
28+
*
2729
* @Attribute("accessControl", type="string"),
2830
* @Attribute("accessControlMessage", type="string"),
2931
* @Attribute("attributes", type="array"),

src/Core/Annotation/ApiSubresource.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@
2121
* @Annotation
2222
*
2323
* @Target({"METHOD", "PROPERTY"})
24+
*
2425
* @Attributes(
26+
*
2527
* @Attribute("maxDepth", type="int"),
2628
* )
2729
*/

src/Core/Identifier/IdentifierConverter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public function convert($data, string $class, array $context = []): array
7171
try {
7272
$identifiers[$parameter] = $identifierTransformer->denormalize($value, $type);
7373
break;
74-
} catch (InvalidIdentifierException $e) {
74+
} catch (InvalidIdentifierException $e) { // @phpstan-ignore-line wrong choice of interface, was fixed in 3.0
7575
throw new InvalidIdentifierException(sprintf('Identifier "%s" could not be denormalized.', $parameter), $e->getCode(), $e);
7676
}
7777
}

src/JsonApi/Serializer/ItemNormalizer.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,6 @@ protected function normalizeRelation($propertyMetadata, $relatedObject, string $
237237
}
238238

239239
$normalizedRelatedObject = $this->serializer->normalize($relatedObject, $format, $context);
240-
// @phpstan-ignore-next-line throwing an explicit exception helps debugging
241240
if (!\is_string($normalizedRelatedObject) && !\is_array($normalizedRelatedObject) && !$normalizedRelatedObject instanceof \ArrayObject && null !== $normalizedRelatedObject) {
242241
throw new UnexpectedValueException('Expected normalized relation to be an IRI, array, \ArrayObject or null');
243242
}

src/Metadata/ApiFilter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public function __construct(
8282
$this->arguments = $arguments;
8383
}
8484

85-
if (!\is_string($this->filterClass)) {
85+
if (!\is_string($this->filterClass)) { /* @phpstan-ignore-line Doctrine annotations */
8686
throw new InvalidArgumentException('This annotation needs a value representing the filter class.');
8787
}
8888

src/Serializer/AbstractItemNormalizer.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -887,7 +887,6 @@ protected function normalizeRelation($propertyMetadata, $relatedObject, string $
887887
}
888888

889889
$normalizedRelatedObject = $this->serializer->normalize($relatedObject, $format, $context);
890-
// @phpstan-ignore-next-line throwing an explicit exception helps debugging
891890
if (!\is_string($normalizedRelatedObject) && !\is_array($normalizedRelatedObject) && !$normalizedRelatedObject instanceof \ArrayObject && null !== $normalizedRelatedObject) {
892891
throw new UnexpectedValueException('Expected normalized relation to be an IRI, array, \ArrayObject or null');
893892
}

src/Serializer/CacheKeyTrait.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,11 @@ private function getCacheKey(?string $format, array $context)
3434
unset($context['cache_key']); // avoid artificially different keys
3535

3636
try {
37-
return hash('xxh128', $format.serialize([
37+
return hash('md5', $format.serialize([
3838
'context' => $context,
3939
'ignored' => $context[self::IGNORED_ATTRIBUTES] ?? $this->defaultContext[self::IGNORED_ATTRIBUTES],
4040
]));
41-
} catch (\Exception) {
41+
} catch (\Exception $e) {
4242
// The context cannot be serialized, skip the cache
4343
return false;
4444
}

0 commit comments

Comments
 (0)