Skip to content

Commit 61d36db

Browse files
committed
chore: remove deprecations
1 parent ffd3b21 commit 61d36db

File tree

74 files changed

+461
-2602
lines changed

Some content is hidden

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

74 files changed

+461
-2602
lines changed

Diff for: Action/NotExposedAction.php

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the API Platform project.
5+
*
6+
* (c) Kévin Dunglas <[email protected]>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
declare(strict_types=1);
13+
14+
namespace ApiPlatform\Symfony\Action;
15+
16+
use ApiPlatform\Metadata\Exception\NotExposedHttpException;
17+
use Symfony\Component\HttpFoundation\Request;
18+
19+
/**
20+
* An action which always returns HTTP 404 Not Found with an explanation for why the operation is not exposed.
21+
*/
22+
final class NotExposedAction
23+
{
24+
public function __invoke(Request $request): never
25+
{
26+
$message = 'This route does not aim to be called.';
27+
if ('api_genid' === $request->attributes->get('_route')) {
28+
$message = 'This route is not exposed on purpose. It generates an IRI for a collection resource without identifier nor item operation.';
29+
}
30+
31+
throw new NotExposedHttpException($message);
32+
}
33+
}

Diff for: Action/NotFoundAction.php

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the API Platform project.
5+
*
6+
* (c) Kévin Dunglas <[email protected]>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
declare(strict_types=1);
13+
14+
namespace ApiPlatform\Symfony\Action;
15+
16+
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
17+
18+
/**
19+
* An action which always returns HTTP 404 Not Found. Useful for disabling an operation.
20+
*/
21+
final class NotFoundAction
22+
{
23+
public function __invoke(): void
24+
{
25+
throw new NotFoundHttpException();
26+
}
27+
}

Diff for: Action/PlaceholderAction.php

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the API Platform project.
5+
*
6+
* (c) Kévin Dunglas <[email protected]>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
declare(strict_types=1);
13+
14+
namespace ApiPlatform\Symfony\Action;
15+
16+
/**
17+
* Placeholder returning the data passed in parameter.
18+
*
19+
* @author Kévin Dunglas <[email protected]>
20+
*/
21+
final class PlaceholderAction
22+
{
23+
/**
24+
* @param object $data
25+
*
26+
* @return object
27+
*/
28+
public function __invoke($data)
29+
{
30+
return $data;
31+
}
32+
}

Diff for: Bundle/ArgumentResolver/PayloadArgumentResolver.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
use ApiPlatform\Metadata\Resource\Factory\ResourceMetadataCollectionFactoryInterface;
1717
use ApiPlatform\State\SerializerContextBuilderInterface;
1818
use ApiPlatform\State\Util\OperationRequestInitiatorTrait;
19-
use ApiPlatform\Symfony\Util\RequestAttributesExtractor;
19+
use ApiPlatform\State\Util\RequestAttributesExtractor;
2020
use Symfony\Component\HttpFoundation\Request;
2121
use Symfony\Component\HttpKernel\Controller\ValueResolverInterface;
2222
use Symfony\Component\HttpKernel\ControllerMetadata\ArgumentMetadata;

Diff for: Bundle/DataCollector/RequestDataCollector.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
use ApiPlatform\Metadata\ApiResource;
1717
use ApiPlatform\Metadata\Resource\Factory\ResourceMetadataCollectionFactoryInterface;
18-
use ApiPlatform\Util\RequestAttributesExtractor;
18+
use ApiPlatform\State\Util\RequestAttributesExtractor;
1919
use PackageVersions\Versions;
2020
use Psr\Container\ContainerInterface;
2121
use Symfony\Component\HttpFoundation\Request;

0 commit comments

Comments
 (0)