Skip to content

Commit 456da73

Browse files
committed
chore: remove 3.4 deprecation
1 parent b213164 commit 456da73

39 files changed

+54
-1656
lines changed

features/openapi/docs.feature

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,11 @@ Feature: Documentation support
55

66
@createSchema
77
Scenario: Retrieve the OpenAPI documentation
8-
Given I send a "GET" request to "/docs.json"
8+
Given I add "Accept" header equal to "application/vnd.openapi+json"
9+
And I send a "GET" request to "/docs"
910
Then the response status code should be 200
1011
And the response should be in JSON
11-
And the header "Content-Type" should be equal to "application/json; charset=utf-8"
12+
And the header "Content-Type" should be equal to "application/vnd.openapi+json; charset=utf-8"
1213
# Context
1314
And the JSON node "openapi" should be equal to "3.1.0"
1415
# Root properties
@@ -288,10 +289,11 @@ Feature: Documentation support
288289
And I should see text matching "openapi"
289290

290291
Scenario: OpenAPI extension properties is enabled in JSON docs
291-
Given I send a "GET" request to "/docs.json"
292+
Given I add "Accept" header equal to "application/vnd.openapi+json"
293+
And I send a "GET" request to "/docs.json"
292294
Then the response status code should be 200
293295
And the response should be in JSON
294-
And the header "Content-Type" should be equal to "application/json; charset=utf-8"
296+
And the header "Content-Type" should be equal to "application/vnd.openapi+json; charset=utf-8"
295297
And the JSON node "paths./dummy_addresses.get.x-visibility" should be equal to "hide"
296298

297299
Scenario: OpenAPI UI is enabled for an arbitrary endpoint
@@ -302,21 +304,23 @@ Feature: Documentation support
302304

303305
@!mongodb
304306
Scenario: Retrieve the OpenAPI documentation with API Gateway compatibility
305-
Given I send a "GET" request to "/docs.json?api_gateway=true"
307+
Given I add "Accept" header equal to "application/vnd.openapi+json"
308+
And I send a "GET" request to "/docs.json?api_gateway=true"
306309
Then the response status code should be 200
307310
And the response should be in JSON
308-
And the header "Content-Type" should be equal to "application/json; charset=utf-8"
311+
And the header "Content-Type" should be equal to "application/vnd.openapi+json; charset=utf-8"
309312
And the JSON node "basePath" should be equal to "/"
310313
And the JSON node "components.schemas.RamseyUuidDummy.properties.id.description" should be equal to "The dummy id."
311314
And the JSON node "components.schemas.RelatedDummy-barcelona" should not exist
312315
And the JSON node "components.schemas.RelatedDummybarcelona" should exist
313316

314317
@!mongodb
315318
Scenario: Retrieve the OpenAPI documentation to see if shortName property is used
316-
Given I send a "GET" request to "/docs.json"
319+
Given I add "Accept" header equal to "application/vnd.openapi+json"
320+
And I send a "GET" request to "/docs.json"
317321
Then the response status code should be 200
318322
And the response should be in JSON
319-
And the header "Content-Type" should be equal to "application/json; charset=utf-8"
323+
And the header "Content-Type" should be equal to "application/vnd.openapi+json; charset=utf-8"
320324
And the OpenAPI class "Resource" exists
321325
And the OpenAPI class "ResourceRelated" exists
322326
And the "resourceRelated" property for the OpenAPI class "Resource" should be equal to:
@@ -348,7 +352,7 @@ Feature: Documentation support
348352
And the JSON node "info.description" should contain "Made with love"
349353
# Security Schemes
350354
And the JSON node "components.securitySchemes" should be equal to:
351-
"""
355+
"""
352356
{
353357
"oauth": {
354358
"type": "oauth2",
@@ -383,10 +387,11 @@ Feature: Documentation support
383387

384388
@!mongodb
385389
Scenario: Retrieve the OpenAPI documentation for Entity Dto Wrappers
386-
Given I send a "GET" request to "/docs.json"
390+
Given I add "Accept" header equal to "application/vnd.openapi+json"
391+
And I send a "GET" request to "/docs.json"
387392
Then the response status code should be 200
388393
And the response should be in JSON
389-
And the header "Content-Type" should be equal to "application/json; charset=utf-8"
394+
And the header "Content-Type" should be equal to "application/vnd.openapi+json; charset=utf-8"
390395
And the OpenAPI class "WrappedResponseEntity-read" exists
391396
And the "id" property exists for the OpenAPI class "WrappedResponseEntity-read"
392397
And the "id" property for the OpenAPI class "WrappedResponseEntity-read" should be equal to:

src/Doctrine/Odm/State/LinksHandlerTrait.php

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,8 @@ private function handleLinks(Builder $aggregationBuilder, array $identifiers, ar
5959
/**
6060
* @throws RuntimeException
6161
*/
62-
private function buildAggregation(string $toClass, array $links, array $identifiers, array $context, array $executeOptions, string $previousAggregationClass, Builder $previousAggregationBuilder, ?Operation $operation = null): Builder
62+
private function buildAggregation(string $toClass, array $links, array $identifiers, array $context, array $executeOptions, string $previousAggregationClass, Builder $previousAggregationBuilder, Operation $operation): Builder
6363
{
64-
if (!$operation) {
65-
trigger_deprecation('api-platform/core', '3.2', 'In API Platform 4 the last argument "operation" will be required and this trait will be internal. Use the "handleLinks" feature instead.');
66-
}
67-
6864
if (\count($links) <= 0) {
6965
return $previousAggregationBuilder;
7066
}
@@ -88,10 +84,8 @@ private function buildAggregation(string $toClass, array $links, array $identifi
8884

8985
$manager = $this->managerRegistry->getManagerForClass($aggregationClass);
9086
if (!$manager instanceof DocumentManager) {
91-
if ($operation) {
92-
$aggregationClass = $this->getLinkFromClass($link, $operation);
93-
$manager = $this->managerRegistry->getManagerForClass($aggregationClass);
94-
}
87+
$aggregationClass = $this->getLinkFromClass($link, $operation);
88+
$manager = $this->managerRegistry->getManagerForClass($aggregationClass);
9589

9690
if (!$manager instanceof DocumentManager) {
9791
throw new RuntimeException(\sprintf('The manager for "%s" must be an instance of "%s".', $aggregationClass, DocumentManager::class));

src/GraphQl/Action/EntrypointAction.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,10 @@ public function __construct(
4141
private readonly SchemaBuilderInterface $schemaBuilder,
4242
private readonly ExecutorInterface $executor,
4343
private readonly ?GraphiQlAction $graphiQlAction,
44-
private readonly ?GraphQlPlaygroundAction $graphQlPlaygroundAction,
4544
private readonly NormalizerInterface $normalizer,
4645
private readonly ErrorHandlerInterface $errorHandler,
4746
bool $debug = false,
4847
private readonly bool $graphiqlEnabled = false,
49-
private readonly bool $graphQlPlaygroundEnabled = false,
5048
private readonly ?string $defaultIde = null,
5149
?Negotiator $negotiator = null,
5250
) {
@@ -64,10 +62,6 @@ public function __invoke(Request $request): Response
6462
if ('graphiql' === $this->defaultIde && $this->graphiqlEnabled && $this->graphiQlAction) {
6563
return ($this->graphiQlAction)($request);
6664
}
67-
68-
if ('graphql-playground' === $this->defaultIde && $this->graphQlPlaygroundEnabled && $this->graphQlPlaygroundAction) {
69-
return ($this->graphQlPlaygroundAction)($request);
70-
}
7165
}
7266

7367
[$query, $operationName, $variables] = $this->parseRequest($request);

src/GraphQl/Action/GraphQlPlaygroundAction.php

Lines changed: 0 additions & 45 deletions
This file was deleted.

src/GraphQl/Tests/Action/EntrypointActionTest.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515

1616
use ApiPlatform\GraphQl\Action\EntrypointAction;
1717
use ApiPlatform\GraphQl\Action\GraphiQlAction;
18-
use ApiPlatform\GraphQl\Action\GraphQlPlaygroundAction;
1918
use ApiPlatform\GraphQl\Error\ErrorHandler;
2019
use ApiPlatform\GraphQl\ExecutorInterface;
2120
use ApiPlatform\GraphQl\Serializer\Exception\ErrorNormalizer;
@@ -270,8 +269,7 @@ private function getEntrypointAction(array $variables = ['graphqlVariable']): En
270269
$routerProphecy->generate('api_graphql_entrypoint')->willReturn('/graphiql');
271270

272271
$graphiQlAction = new GraphiQlAction($twigProphecy->reveal(), $routerProphecy->reveal(), true);
273-
$graphQlPlaygroundAction = new GraphQlPlaygroundAction($twigProphecy->reveal(), $routerProphecy->reveal(), true);
274272

275-
return new EntrypointAction($schemaBuilderProphecy->reveal(), $executorProphecy->reveal(), $graphiQlAction, $graphQlPlaygroundAction, $normalizer, $errorHandler, false, true, true, 'graphiql');
273+
return new EntrypointAction($schemaBuilderProphecy->reveal(), $executorProphecy->reveal(), $graphiQlAction, $normalizer, $errorHandler, false, true, 'graphiql');
276274
}
277275
}

src/GraphQl/Tests/Action/GraphQlPlaygroundActionTest.php

Lines changed: 0 additions & 60 deletions
This file was deleted.

src/Laravel/ApiPlatformProvider.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -158,10 +158,10 @@
158158
use Illuminate\Routing\Router;
159159
use Illuminate\Support\ServiceProvider;
160160
use Negotiation\Negotiator;
161-
use phpDocumentor\Reflection\DocBlockFactory;
161+
use PHPStan\PhpDocParser\Parser\PhpDocParser;
162162
use Psr\Log\LoggerInterface;
163163
use Symfony\Component\PropertyAccess\PropertyAccessorInterface;
164-
use Symfony\Component\PropertyInfo\Extractor\PhpDocExtractor;
164+
use Symfony\Component\PropertyInfo\Extractor\PhpStanExtractor;
165165
use Symfony\Component\PropertyInfo\Extractor\ReflectionExtractor;
166166
use Symfony\Component\PropertyInfo\PropertyInfoExtractor;
167167
use Symfony\Component\PropertyInfo\PropertyInfoExtractorInterface;
@@ -196,13 +196,13 @@ public function register(): void
196196
$this->mergeConfigFrom(__DIR__.'/config/api-platform.php', 'api-platform');
197197

198198
$this->app->singleton(PropertyInfoExtractorInterface::class, function () {
199-
$phpDocExtractor = class_exists(DocBlockFactory::class) ? new PhpDocExtractor() : null;
199+
$phpstanExtractor = class_exists(PhpDocParser::class) ? new PhpStanExtractor() : null;
200200
$reflectionExtractor = new ReflectionExtractor();
201201

202202
return new PropertyInfoExtractor(
203203
[$reflectionExtractor],
204-
$phpDocExtractor ? [$phpDocExtractor, $reflectionExtractor] : [$reflectionExtractor],
205-
$phpDocExtractor ? [$phpDocExtractor] : [],
204+
$phpstanExtractor ? [$phpstanExtractor, $reflectionExtractor] : [$reflectionExtractor],
205+
[],
206206
[$reflectionExtractor],
207207
[$reflectionExtractor]
208208
);

src/Laravel/Controller/DocumentationController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public function __construct(
5151
private readonly ?ProviderInterface $provider = null,
5252
private readonly ?ProcessorInterface $processor = null,
5353
?Negotiator $negotiator = null,
54-
private readonly array $documentationFormats = [OpenApiNormalizer::JSON_FORMAT => ['application/vnd.openapi+json'], OpenApiNormalizer::FORMAT => ['application/json']],
54+
private readonly array $documentationFormats = [OpenApiNormalizer::JSON_FORMAT => ['application/vnd.openapi+json']],
5555
private readonly bool $swaggerUiEnabled = true,
5656
) {
5757
$this->negotiator = $negotiator ?? new Negotiator();
@@ -69,7 +69,7 @@ public function __invoke(Request $request): Response
6969
$this->addRequestFormats($request, $this->documentationFormats);
7070
$format = $this->getRequestFormat($request, $this->documentationFormats);
7171

72-
if ('html' === $format || OpenApiNormalizer::FORMAT === $format || OpenApiNormalizer::JSON_FORMAT === $format || OpenApiNormalizer::YAML_FORMAT === $format) {
72+
if ('html' === $format || OpenApiNormalizer::JSON_FORMAT === $format || OpenApiNormalizer::YAML_FORMAT === $format) {
7373
return $this->getOpenApiDocumentation($context, $format, $request);
7474
}
7575

src/Laravel/composer.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,17 +48,17 @@
4848
"illuminate/support": "^11.0 || ^12.0",
4949
"illuminate/container": "^11.0 || ^12.0",
5050
"symfony/web-link": "^6.4 || ^7.1",
51-
"willdurand/negotiation": "^3.1",
52-
"phpstan/phpdoc-parser": "^1.29 || ^2.0",
53-
"phpdocumentor/reflection-docblock": "^5.1"
51+
"willdurand/negotiation": "^3.1"
5452
},
5553
"require-dev": {
54+
"api-platform/graphql": "^4.1",
5655
"doctrine/dbal": "^4.0",
5756
"larastan/larastan": "^2.0 || ^3.0",
57+
"laravel/sanctum": "^4.0",
5858
"orchestra/testbench": "^9.1",
59-
"phpunit/phpunit": "11.5.x-dev",
60-
"api-platform/graphql": "^4.1",
61-
"laravel/sanctum": "^4.0"
59+
"phpdocumentor/type-resolver": "^1.7",
60+
"phpstan/phpdoc-parser": "^1.29 || ^2.0",
61+
"phpunit/phpunit": "11.5.x-dev"
6262
},
6363
"autoload": {
6464
"psr-4": {
@@ -74,7 +74,7 @@
7474
},
7575
"suggest": {
7676
"api-platform/graphql": "Enable GraphQl support.",
77-
"phpdocumentor/reflection-docblock": ""
77+
"phpstan/phpdoc-parser": "To support extracting metadata from PHPDoc."
7878
},
7979
"extra": {
8080
"laravel": {

0 commit comments

Comments
 (0)