Skip to content

Commit a5d6003

Browse files
committed
Merge 3.2
2 parents 802546f + 1c1023a commit a5d6003

12 files changed

+90
-17
lines changed

CHANGELOG.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
# Changelog
22

3+
## v3.2.11
4+
5+
### Bug fixes
6+
7+
* [5de077e7d](https://github.com/api-platform/core/commit/5de077e7de94f2e07ca615efc5ecf1b32b37a10e) fix(symfony): use Type constraint violation code instead of exception code (#6064)
8+
* [804da1be7](https://github.com/api-platform/core/commit/804da1be73991e7c5efffb495345499943802102) fix(openapi): compatibility with OpenAPI 3.0 (#6065)
9+
* [cd01e043a](https://github.com/api-platform/core/commit/cd01e043a17f4092bf302a415bba777fab3a9cfc) fix(symfony): handle empty content-type as set by Symfony (#6078)
10+
* [d3484b0f1](https://github.com/api-platform/core/commit/d3484b0f1bf06e518c83cd15e67ed10e9a75fe03) fix(serializer): integrate root_resource_class to cache key (#6073)
11+
12+
For OpenAPI 3.0, the `spec_version=3.0.0` query parameter will force OpenAPI to the 3.0 version. This option is also available through the command line.
13+
314
## v3.2.10
415

516
### Bug fixes
@@ -256,6 +267,13 @@ Notes:
256267
* [92a81f024](https://github.com/api-platform/core/commit/92a81f024541054b9322e7457b75c721261e14e0) feat(graphql): allow to disable the introspection query (#5711)
257268
* [d793ffb92](https://github.com/api-platform/core/commit/d793ffb9228a21655ee35f0b90a959f93281a4cf) feat: union/intersect types (#5470)
258269

270+
## v3.1.25
271+
272+
### Bug fixes
273+
274+
* [5de077e7d](https://github.com/api-platform/core/commit/5de077e7de94f2e07ca615efc5ecf1b32b37a10e) fix(symfony): use Type constraint violation code instead of exception code (#6064)
275+
* [d3484b0f1](https://github.com/api-platform/core/commit/d3484b0f1bf06e518c83cd15e67ed10e9a75fe03) fix(serializer): integrate root_resource_class to cache key (#6073)
276+
259277
## v3.1.24
260278

261279
### Bug fixes
@@ -1989,4 +2007,4 @@ Please read #2825 if you have issues with the behavior of Readable/Writable Link
19892007
## 1.0.0 beta 2
19902008

19912009
* Preserve indexes when normalizing and denormalizing associative arrays
1992-
* Allow setting default order for property when registering a `Doctrine\Orm\Filter\OrderFilter` instance
2010+
* Allow setting default order for property when registering a `Doctrine\Orm\Filter\OrderFilter` instance

src/HttpCache/State/AddHeadersProcessor.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,16 @@
1818
use ApiPlatform\State\ProcessorInterface;
1919
use Symfony\Component\HttpFoundation\Response;
2020

21+
/**
22+
* @template T1
23+
* @template T2
24+
*
25+
* @implements ProcessorInterface<T1, T2>
26+
*/
2127
final class AddHeadersProcessor implements ProcessorInterface
2228
{
2329
/**
24-
* @param ProcessorInterface<Response>|ProcessorInterface<mixed> $decorated
30+
* @param ProcessorInterface<T1, T2> $decorated
2531
*/
2632
public function __construct(private readonly ProcessorInterface $decorated, private readonly bool $etag = false, private readonly ?int $maxAge = null, private readonly ?int $sharedMaxAge = null, private readonly ?array $vary = null, private readonly ?bool $public = null, private readonly ?int $staleWhileRevalidate = null, private readonly ?int $staleIfError = null)
2733
{

src/Hydra/State/HydraLinkProcessor.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,18 @@
2222
use Symfony\Component\WebLink\GenericLinkProvider;
2323
use Symfony\Component\WebLink\Link;
2424

25+
/**
26+
* @template T1
27+
* @template T2
28+
*
29+
* @implements ProcessorInterface<T1, T2>
30+
*/
2531
final class HydraLinkProcessor implements ProcessorInterface
2632
{
2733
use CorsTrait;
2834

2935
/**
30-
* @param ProcessorInterface<mixed> $decorated
36+
* @param ProcessorInterface<T1, T2> $decorated
3137
*/
3238
public function __construct(private readonly ProcessorInterface $decorated, private readonly UrlGeneratorInterface $urlGenerator)
3339
{

src/State/CallableProcessor.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@
1717
use ApiPlatform\Metadata\Operation;
1818
use Psr\Container\ContainerInterface;
1919

20+
/**
21+
* @template T1
22+
* @template T2
23+
*
24+
* @implements ProcessorInterface<T1, T2>
25+
*/
2026
final class CallableProcessor implements ProcessorInterface
2127
{
2228
public function __construct(private readonly ?ContainerInterface $locator = null)
@@ -40,7 +46,7 @@ public function process(mixed $data, Operation $operation, array $uriVariables =
4046
throw new RuntimeException(sprintf('Processor "%s" not found on operation "%s"', $processor, $operation->getName()));
4147
}
4248

43-
/** @var ProcessorInterface $processorInstance */
49+
/** @var ProcessorInterface<T1, T2> $processorInstance */
4450
$processorInstance = $this->locator->get($processor);
4551

4652
return $processorInstance->process($data, $operation, $uriVariables, $context);

src/State/Processor/AddLinkHeaderProcessor.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,17 @@
1818
use Symfony\Component\HttpFoundation\Response;
1919
use Symfony\Component\WebLink\HttpHeaderSerializer;
2020

21+
/**
22+
* @template T1
23+
* @template T2
24+
*
25+
* @implements ProcessorInterface<T1, T2>
26+
*/
2127
final class AddLinkHeaderProcessor implements ProcessorInterface
2228
{
29+
/**
30+
* @param ProcessorInterface<T1, T2> $decorated
31+
*/
2332
public function __construct(private readonly ProcessorInterface $decorated, private readonly ?HttpHeaderSerializer $serializer = new HttpHeaderSerializer())
2433
{
2534
}

src/State/Processor/RespondProcessor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public function process(mixed $data, Operation $operation, array $uriVariables =
7474
$status = $operation->getStatus();
7575

7676
if ($sunset = $operation->getSunset()) {
77-
$headers['Sunset'] = (new \DateTimeImmutable($sunset))->format(\DateTime::RFC1123);
77+
$headers['Sunset'] = (new \DateTimeImmutable($sunset))->format(\DateTimeInterface::RFC1123);
7878
}
7979

8080
if ($acceptPatch = $operation->getAcceptPatch()) {

src/State/Processor/SerializeProcessor.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,18 @@
2626
/**
2727
* Serializes data.
2828
*
29+
* @template T1
30+
* @template T2
31+
*
32+
* @implements ProcessorInterface<T1, T2>
33+
*
2934
* @author Kévin Dunglas <[email protected]>
3035
*/
3136
final class SerializeProcessor implements ProcessorInterface
3237
{
38+
/**
39+
* @param ProcessorInterface<T1, T2> $processor
40+
*/
3341
public function __construct(private readonly ProcessorInterface $processor, private readonly SerializerInterface $serializer, private readonly SerializerContextBuilderInterface $serializerContextBuilder)
3442
{
3543
}

src/State/Processor/WriteProcessor.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,22 @@
2121
/**
2222
* Bridges persistence and the API system.
2323
*
24+
* @template T1
25+
* @template T2
26+
*
27+
* @implements ProcessorInterface<T1, T2>
28+
*
2429
* @author Kévin Dunglas <[email protected]>
2530
* @author Baptiste Meyer <[email protected]>
2631
*/
2732
final class WriteProcessor implements ProcessorInterface
2833
{
2934
use ClassInfoTrait;
3035

36+
/**
37+
* @param ProcessorInterface<T1, T2> $processor
38+
* @param ProcessorInterface<T1, T2> $callableProcessor
39+
*/
3140
public function __construct(private readonly ProcessorInterface $processor, private readonly ProcessorInterface $callableProcessor)
3241
{
3342
}

src/State/ProcessorInterface.php

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,23 +14,26 @@
1414
namespace ApiPlatform\State;
1515

1616
use ApiPlatform\Metadata\Operation;
17+
use Symfony\Component\HttpFoundation\Request;
1718

1819
/**
19-
* Process data: send an email, persist to storage, add to queue etc.
20+
* Processes data: sends an email, persists to storage, adds to queue etc.
2021
*
21-
* @template T
22+
* @template T1
23+
* @template T2
2224
*
2325
* @author Antoine Bluchet <[email protected]>
2426
*/
2527
interface ProcessorInterface
2628
{
2729
/**
28-
* Handle the state.
30+
* Handles the state.
2931
*
30-
* @param array<string, mixed> $uriVariables
31-
* @param array<string, mixed>&array{request?: \Symfony\Component\HttpFoundation\Request, previous_data?: mixed, resource_class?: string, original_data?: mixed} $context
32+
* @param T1 $data
33+
* @param array<string, mixed> $uriVariables
34+
* @param array<string, mixed>&array{request?: Request, previous_data?: mixed, resource_class?: string, original_data?: mixed} $context
3235
*
33-
* @return T
36+
* @return T2
3437
*/
3538
public function process(mixed $data, Operation $operation, array $uriVariables = [], array $context = []);
3639
}

src/State/ProviderInterface.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
namespace ApiPlatform\State;
1515

1616
use ApiPlatform\Metadata\Operation;
17+
use ApiPlatform\State\Pagination\PartialPaginatorInterface;
18+
use Symfony\Component\HttpFoundation\Request;
1719

1820
/**
1921
* Retrieves data from a persistence layer.
@@ -27,10 +29,10 @@ interface ProviderInterface
2729
/**
2830
* Provides data.
2931
*
30-
* @param array<string, mixed> $uriVariables
31-
* @param array<string, mixed>|array{request?: \Symfony\Component\HttpFoundation\Request, resource_class?: string} $context
32+
* @param array<string, mixed> $uriVariables
33+
* @param array<string, mixed>|array{request?: Request, resource_class?: string} $context
3234
*
33-
* @return T|Pagination\PartialPaginatorInterface<T>|iterable<T>|null
35+
* @return T|PartialPaginatorInterface<T>|iterable<T>|null
3436
*/
3537
public function provide(Operation $operation, array $uriVariables = [], array $context = []): object|array|null;
3638
}

src/Symfony/State/MercureLinkProcessor.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,16 @@
1717
use ApiPlatform\State\ProcessorInterface;
1818
use Symfony\Component\Mercure\Discovery;
1919

20+
/**
21+
* @template T1
22+
* @template T2
23+
*
24+
* @implements ProcessorInterface<T1, T2>
25+
*/
2026
final class MercureLinkProcessor implements ProcessorInterface
2127
{
2228
/**
23-
* @param ProcessorInterface<mixed> $decorated
29+
* @param ProcessorInterface<T1, T2> $decorated
2430
*/
2531
public function __construct(private readonly ProcessorInterface $decorated, private readonly Discovery $discovery)
2632
{

tests/State/RespondProcessorTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public function testRedirectToOperation(): void
7171
return ($args[2] ?? null)?->getUriTemplate() ?? '/default';
7272
});
7373

74-
/** @var ProcessorInterface<Response> $respondProcessor */
74+
/** @var ProcessorInterface<string, Response> $respondProcessor */
7575
$respondProcessor = new RespondProcessor($iriConverter->reveal(), $resourceClassResolver->reveal(), $operationMetadataFactory->reveal());
7676

7777
$response = $respondProcessor->process('content', $canonicalUriTemplateRedirectingOperation, context: [
@@ -103,7 +103,7 @@ public function testAddsExceptionHeaders(): void
103103
{
104104
$operation = new Get();
105105

106-
/** @var ProcessorInterface<Response> $respondProcessor */
106+
/** @var ProcessorInterface<string, Response> $respondProcessor */
107107
$respondProcessor = new RespondProcessor();
108108
$req = new Request();
109109
$req->attributes->set('exception', new TooManyRequestsHttpException(32));

0 commit comments

Comments
 (0)