Skip to content

Commit f34dff8

Browse files
committed
chore(serializer): api-platform/serializer
1 parent e96d7a8 commit f34dff8

File tree

74 files changed

+2135
-367
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

+2135
-367
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,7 @@ jobs:
196196
- HttpCache
197197
- RamseyUuid
198198
- GraphQl
199+
- Serializer
199200
fail-fast: false
200201
steps:
201202
- name: Checkout

phpstan.neon.dist

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ parameters:
5656
-
5757
message: '#expects ApiPlatform\\Metadata\\GraphQl\\Operation\|null, ApiPlatform\\Metadata\\Operation given#'
5858
paths:
59-
- tests/GraphQl/Resolver/Factory/
59+
- src/GraphQl/Tests/Resolver/Factory/
6060
- '#Access to an undefined property Prophecy\\Prophecy\\ObjectProphecy<(\\?[a-zA-Z0-9_]+)+>::\$[a-zA-Z0-9_]+#'
6161
# https://github.com/willdurand/Negotiation/issues/89#issuecomment-513283286
6262
-
@@ -65,7 +65,7 @@ parameters:
6565
# https://github.com/phpstan/phpstan-symfony/issues/76
6666
-
6767
message: '#Service "test" is not registered in the container\.#'
68-
path: tests/GraphQl/Type/TypesContainerTest.php
68+
path: src/GraphQl/Tests/Type/TypesContainerTest.php
6969

7070
# Expected, due to optional interfaces
7171
- '#Method Symfony\\Component\\Serializer\\NameConverter\\NameConverterInterface::denormalize\(\) invoked with (2|3|4) parameters, 1 required\.#'

src/Api/CompositeIdentifierParser.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
* Normalizes a composite identifier.
1818
*
1919
* @author Antoine Bluchet <soyuka@gmail.com>
20+
* @deprecated
2021
*/
2122
final class CompositeIdentifierParser
2223
{

src/Api/IdentifiersExtractor.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
namespace ApiPlatform\Api;
1515

16-
use ApiPlatform\Exception\RuntimeException;
16+
use ApiPlatform\Metadata\Exception\RuntimeException;
1717
use ApiPlatform\Metadata\GraphQl\Operation as GraphQlOperation;
1818
use ApiPlatform\Metadata\HttpOperation;
1919
use ApiPlatform\Metadata\Operation;
@@ -28,6 +28,8 @@
2828
/**
2929
* {@inheritdoc}
3030
*
31+
* @deprecated use ApiPlatform\Metadata\IdentifiersExtractor instead
32+
*
3133
* @author Antoine Bluchet <soyuka@gmail.com>
3234
*/
3335
final class IdentifiersExtractor implements IdentifiersExtractorInterface

src/Api/IdentifiersExtractorInterface.php

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,10 @@
1313

1414
namespace ApiPlatform\Api;
1515

16-
use ApiPlatform\Exception\RuntimeException;
17-
use ApiPlatform\Metadata\Operation;
16+
class_exists(\ApiPlatform\Metadata\IdentifiersExtractorInterface::class);
1817

19-
/**
20-
* Extracts identifiers for a given Resource according to the retrieved Metadata.
21-
*
22-
* @author Antoine Bluchet <soyuka@gmail.com>
23-
*/
24-
interface IdentifiersExtractorInterface
25-
{
26-
/**
27-
* Finds identifiers from an Item (object).
28-
*
29-
* @throws RuntimeException
30-
*/
31-
public function getIdentifiersFromItem(object $item, Operation $operation = null, array $context = []): array;
18+
if (!class_exists(IdentifiersExtractorInterface::class)) {
19+
interface IdentifiersExtractorInterface extends \ApiPlatform\Metadata\IdentifiersExtractorInterface
20+
{
21+
}
3222
}

src/Api/IriConverterInterface.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@
1313

1414
namespace ApiPlatform\Api;
1515

16-
interface IriConverterInterface extends \ApiPlatform\Metadata\IriConverterInterface
17-
{
16+
class_exists(\ApiPlatform\Metadata\IriConverterInterface::class);
17+
18+
if (!class_exists(IriConverterInterface::class)) {
19+
interface IriConverterInterface extends \ApiPlatform\Metadata\IriConverterInterface
20+
{
21+
}
1822
}

src/Api/ResourceClassResolverInterface.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@
1313

1414
namespace ApiPlatform\Api;
1515

16-
interface ResourceClassResolverInterface extends \ApiPlatform\Metadata\ResourceClassResolverInterface
17-
{
16+
class_exists(\ApiPlatform\Metadata\ResourceClassResolverInterface::class);
17+
18+
if (false) { // @phpstan-ignore-line
19+
interface ResourceClassResolverInterface extends \ApiPlatform\Metadata\ResourceClassResolverInterface
20+
{
21+
}
1822
}

src/Api/UriVariablesConverterInterface.php

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -13,24 +13,10 @@
1313

1414
namespace ApiPlatform\Api;
1515

16-
use ApiPlatform\Exception\InvalidIdentifierException;
16+
class_exists(\ApiPlatform\Metadata\UriVariablesConverterInterface::class);
1717

18-
/**
19-
* Identifier converter.
20-
*
21-
* @author Antoine Bluchet <soyuka@gmail.com>
22-
*/
23-
interface UriVariablesConverterInterface
24-
{
25-
/**
26-
* Takes an array of strings representing URI variables (identifiers) and transform their values to the expected type.
27-
*
28-
* @param array $data URI variables to convert to PHP values
29-
* @param string $class The class to which the URI variables belong to
30-
*
31-
* @throws InvalidIdentifierException
32-
*
33-
* @return array Array indexed by identifiers properties with their values denormalized
34-
*/
35-
public function convert(array $data, string $class, array $context = []): array;
18+
if (!class_exists(UriVariablesConverterInterface::class)) {
19+
interface UriVariablesConverterInterface extends \ApiPlatform\Metadata\UriVariablesConverterInterface
20+
{
21+
}
3622
}

src/Elasticsearch/composer.json

Lines changed: 75 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -1,77 +1,82 @@
11
{
2-
"name": "api-platform/elasticseach",
3-
"description": "Elasticsearch support",
4-
"type": "library",
5-
"keywords": [
6-
"Filter",
7-
"Elasticsearch"
8-
],
9-
"homepage": "https://api-platform.com",
10-
"license": "MIT",
11-
"authors": [
12-
{
13-
"name": "Kévin Dunglas",
14-
"email": "kevin@dunglas.fr",
15-
"homepage": "https://dunglas.fr"
2+
"name": "api-platform/elasticseach",
3+
"description": "Elasticsearch support",
4+
"type": "library",
5+
"keywords": [
6+
"Filter",
7+
"Elasticsearch"
8+
],
9+
"homepage": "https://api-platform.com",
10+
"license": "MIT",
11+
"authors": [
12+
{
13+
"name": "Kévin Dunglas",
14+
"email": "kevin@dunglas.fr",
15+
"homepage": "https://dunglas.fr"
16+
},
17+
{
18+
"name": "API Platform Community",
19+
"homepage": "https://api-platform.com/community/contributors"
20+
}
21+
],
22+
"require": {
23+
"php": ">=8.1",
24+
"api-platform/metadata": "*@dev || ^3.1",
25+
"api-platform/state": "*@dev || ^3.1",
26+
"api-platform/serializer": "*@dev || ^3.1",
27+
"elasticsearch/elasticsearch": "^7.11.0",
28+
"symfony/cache": "^6.1",
29+
"symfony/console": "^6.2",
30+
"symfony/property-info": "^6.1",
31+
"symfony/serializer": "^6.1",
32+
"symfony/uid": "^6.1",
33+
"symfony/property-access": "^6.1"
1634
},
17-
{
18-
"name": "API Platform Community",
19-
"homepage": "https://api-platform.com/community/contributors"
20-
}
21-
],
22-
"require": {
23-
"php": ">=8.1",
24-
"api-platform/metadata": "*@dev || ^3.1",
25-
"api-platform/state": "*@dev || ^3.1",
26-
"elasticsearch/elasticsearch": "^7.11.0",
27-
"symfony/cache": "^6.1",
28-
"symfony/console": "^6.2",
29-
"symfony/property-info": "^6.1",
30-
"symfony/serializer": "^6.1",
31-
"symfony/uid": "^6.1",
32-
"symfony/property-access": "^6.1"
33-
},
34-
"conflict": {
35-
"elasticsearch/elasticsearch": ">=8.0"
36-
},
37-
"require-dev": {
38-
"phpspec/prophecy-phpunit": "^2.0",
39-
"symfony/phpunit-bridge": "^6.1"
40-
},
41-
"autoload": {
42-
"psr-4": {
43-
"ApiPlatform\\Elasticsearch\\": ""
35+
"conflict": {
36+
"elasticsearch/elasticsearch": ">=8.0"
4437
},
45-
"exclude-from-classmap": [
46-
"/Tests/"
47-
]
48-
},
49-
"config": {
50-
"preferred-install": {
51-
"*": "dist"
38+
"require-dev": {
39+
"phpspec/prophecy-phpunit": "^2.0",
40+
"symfony/phpunit-bridge": "^6.1"
41+
},
42+
"autoload": {
43+
"psr-4": {
44+
"ApiPlatform\\Elasticsearch\\": ""
45+
},
46+
"exclude-from-classmap": [
47+
"/Tests/"
48+
]
5249
},
53-
"sort-packages": true,
54-
"allow-plugins": {
55-
"composer/package-versions-deprecated": true,
56-
"phpstan/extension-installer": true
57-
}
58-
},
59-
"extra": {
60-
"branch-alias": {
61-
"dev-main": "3.2.x-dev"
50+
"config": {
51+
"preferred-install": {
52+
"*": "dist"
53+
},
54+
"sort-packages": true,
55+
"allow-plugins": {
56+
"composer/package-versions-deprecated": true,
57+
"phpstan/extension-installer": true
58+
}
6259
},
63-
"symfony": {
64-
"require": "^6.1"
65-
}
66-
},
67-
"repositories": [
68-
{
69-
"type": "path",
70-
"url": "../Metadata"
60+
"extra": {
61+
"branch-alias": {
62+
"dev-main": "3.2.x-dev"
63+
},
64+
"symfony": {
65+
"require": "^6.1"
66+
}
7167
},
72-
{
73-
"type": "path",
74-
"url": "../State"
75-
}
76-
]
68+
"repositories": [
69+
{
70+
"type": "path",
71+
"url": "../Metadata"
72+
},
73+
{
74+
"type": "path",
75+
"url": "../State"
76+
},
77+
{
78+
"type": "path",
79+
"url": "../Serializer"
80+
}
81+
]
7782
}

src/Exception/InvalidIdentifierException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@
1818
*
1919
* @author Antoine Bluchet <soyuka@gmail.com>
2020
*/
21-
final class InvalidIdentifierException extends \Exception implements ExceptionInterface
21+
class InvalidIdentifierException extends \Exception implements ExceptionInterface
2222
{
2323
}

src/Exception/InvalidUriVariableException.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@
1717
* Identifier is not valid exception.
1818
*
1919
* @author Antoine Bluchet <soyuka@gmail.com>
20-
*
21-
* @final
2220
*/
2321
class InvalidUriVariableException extends \Exception implements ExceptionInterface
2422
{

0 commit comments

Comments
 (0)