Skip to content

Commit

Permalink
chore(serializer): api-platform/serializer
Browse files Browse the repository at this point in the history
  • Loading branch information
soyuka committed Aug 11, 2023
1 parent 16f8ef5 commit 81a6697
Show file tree
Hide file tree
Showing 74 changed files with 2,135 additions and 367 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ jobs:
- HttpCache
- RamseyUuid
- GraphQl
- Serializer
fail-fast: false
steps:
- name: Checkout
Expand Down
4 changes: 2 additions & 2 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ parameters:
-
message: '#expects ApiPlatform\\Metadata\\GraphQl\\Operation\|null, ApiPlatform\\Metadata\\Operation given#'
paths:
- tests/GraphQl/Resolver/Factory/
- src/GraphQl/Tests/Resolver/Factory/
- '#Access to an undefined property Prophecy\\Prophecy\\ObjectProphecy<(\\?[a-zA-Z0-9_]+)+>::\$[a-zA-Z0-9_]+#'
# https://github.com/willdurand/Negotiation/issues/89#issuecomment-513283286
-
Expand All @@ -65,7 +65,7 @@ parameters:
# https://github.com/phpstan/phpstan-symfony/issues/76
-
message: '#Service "test" is not registered in the container\.#'
path: tests/GraphQl/Type/TypesContainerTest.php
path: src/GraphQl/Tests/Type/TypesContainerTest.php

# Expected, due to optional interfaces
- '#Method Symfony\\Component\\Serializer\\NameConverter\\NameConverterInterface::denormalize\(\) invoked with (2|3|4) parameters, 1 required\.#'
Expand Down
1 change: 1 addition & 0 deletions src/Api/CompositeIdentifierParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
* Normalizes a composite identifier.
*
* @author Antoine Bluchet <[email protected]>
* @deprecated
*/
final class CompositeIdentifierParser
{
Expand Down
4 changes: 3 additions & 1 deletion src/Api/IdentifiersExtractor.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

namespace ApiPlatform\Api;

use ApiPlatform\Exception\RuntimeException;
use ApiPlatform\Metadata\Exception\RuntimeException;
use ApiPlatform\Metadata\GraphQl\Operation as GraphQlOperation;
use ApiPlatform\Metadata\HttpOperation;
use ApiPlatform\Metadata\Operation;
Expand All @@ -28,6 +28,8 @@
/**
* {@inheritdoc}
*
* @deprecated use ApiPlatform\Metadata\IdentifiersExtractor instead
*
* @author Antoine Bluchet <[email protected]>
*/
final class IdentifiersExtractor implements IdentifiersExtractorInterface
Expand Down
20 changes: 5 additions & 15 deletions src/Api/IdentifiersExtractorInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,10 @@

namespace ApiPlatform\Api;

use ApiPlatform\Exception\RuntimeException;
use ApiPlatform\Metadata\Operation;
class_exists(\ApiPlatform\Metadata\IdentifiersExtractorInterface::class);

/**
* Extracts identifiers for a given Resource according to the retrieved Metadata.
*
* @author Antoine Bluchet <[email protected]>
*/
interface IdentifiersExtractorInterface
{
/**
* Finds identifiers from an Item (object).
*
* @throws RuntimeException
*/
public function getIdentifiersFromItem(object $item, Operation $operation = null, array $context = []): array;
if (!class_exists(IdentifiersExtractorInterface::class)) {
interface IdentifiersExtractorInterface extends \ApiPlatform\Metadata\IdentifiersExtractorInterface
{
}
}
8 changes: 6 additions & 2 deletions src/Api/IriConverterInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@

namespace ApiPlatform\Api;

interface IriConverterInterface extends \ApiPlatform\Metadata\IriConverterInterface
{
class_exists(\ApiPlatform\Metadata\IriConverterInterface::class);

if (!class_exists(IriConverterInterface::class)) {
interface IriConverterInterface extends \ApiPlatform\Metadata\IriConverterInterface
{
}
}
8 changes: 6 additions & 2 deletions src/Api/ResourceClassResolverInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@

namespace ApiPlatform\Api;

interface ResourceClassResolverInterface extends \ApiPlatform\Metadata\ResourceClassResolverInterface
{
class_exists(\ApiPlatform\Metadata\ResourceClassResolverInterface::class);

if (false) { // @phpstan-ignore-line
interface ResourceClassResolverInterface extends \ApiPlatform\Metadata\ResourceClassResolverInterface
{
}
}
24 changes: 5 additions & 19 deletions src/Api/UriVariablesConverterInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,10 @@

namespace ApiPlatform\Api;

use ApiPlatform\Exception\InvalidIdentifierException;
class_exists(\ApiPlatform\Metadata\UriVariablesConverterInterface::class);

/**
* Identifier converter.
*
* @author Antoine Bluchet <[email protected]>
*/
interface UriVariablesConverterInterface
{
/**
* Takes an array of strings representing URI variables (identifiers) and transform their values to the expected type.
*
* @param array $data URI variables to convert to PHP values
* @param string $class The class to which the URI variables belong to
*
* @throws InvalidIdentifierException
*
* @return array Array indexed by identifiers properties with their values denormalized
*/
public function convert(array $data, string $class, array $context = []): array;
if (!class_exists(UriVariablesConverterInterface::class)) {
interface UriVariablesConverterInterface extends \ApiPlatform\Metadata\UriVariablesConverterInterface
{
}
}
145 changes: 75 additions & 70 deletions src/Elasticsearch/composer.json
Original file line number Diff line number Diff line change
@@ -1,77 +1,82 @@
{
"name": "api-platform/elasticseach",
"description": "Elasticsearch support",
"type": "library",
"keywords": [
"Filter",
"Elasticsearch"
],
"homepage": "https://api-platform.com",
"license": "MIT",
"authors": [
{
"name": "Kévin Dunglas",
"email": "[email protected]",
"homepage": "https://dunglas.fr"
"name": "api-platform/elasticseach",
"description": "Elasticsearch support",
"type": "library",
"keywords": [
"Filter",
"Elasticsearch"
],
"homepage": "https://api-platform.com",
"license": "MIT",
"authors": [
{
"name": "Kévin Dunglas",
"email": "[email protected]",
"homepage": "https://dunglas.fr"
},
{
"name": "API Platform Community",
"homepage": "https://api-platform.com/community/contributors"
}
],
"require": {
"php": ">=8.1",
"api-platform/metadata": "*@dev || ^3.1",
"api-platform/state": "*@dev || ^3.1",
"api-platform/serializer": "*@dev || ^3.1",
"elasticsearch/elasticsearch": "^7.11.0",
"symfony/cache": "^6.1",
"symfony/console": "^6.2",
"symfony/property-info": "^6.1",
"symfony/serializer": "^6.1",
"symfony/uid": "^6.1",
"symfony/property-access": "^6.1"
},
{
"name": "API Platform Community",
"homepage": "https://api-platform.com/community/contributors"
}
],
"require": {
"php": ">=8.1",
"api-platform/metadata": "*@dev || ^3.1",
"api-platform/state": "*@dev || ^3.1",
"elasticsearch/elasticsearch": "^7.11.0",
"symfony/cache": "^6.1",
"symfony/console": "^6.2",
"symfony/property-info": "^6.1",
"symfony/serializer": "^6.1",
"symfony/uid": "^6.1",
"symfony/property-access": "^6.1"
},
"conflict": {
"elasticsearch/elasticsearch": ">=8.0"
},
"require-dev": {
"phpspec/prophecy-phpunit": "^2.0",
"symfony/phpunit-bridge": "^6.1"
},
"autoload": {
"psr-4": {
"ApiPlatform\\Elasticsearch\\": ""
"conflict": {
"elasticsearch/elasticsearch": ">=8.0"
},
"exclude-from-classmap": [
"/Tests/"
]
},
"config": {
"preferred-install": {
"*": "dist"
"require-dev": {
"phpspec/prophecy-phpunit": "^2.0",
"symfony/phpunit-bridge": "^6.1"
},
"autoload": {
"psr-4": {
"ApiPlatform\\Elasticsearch\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"sort-packages": true,
"allow-plugins": {
"composer/package-versions-deprecated": true,
"phpstan/extension-installer": true
}
},
"extra": {
"branch-alias": {
"dev-main": "3.2.x-dev"
"config": {
"preferred-install": {
"*": "dist"
},
"sort-packages": true,
"allow-plugins": {
"composer/package-versions-deprecated": true,
"phpstan/extension-installer": true
}
},
"symfony": {
"require": "^6.1"
}
},
"repositories": [
{
"type": "path",
"url": "../Metadata"
"extra": {
"branch-alias": {
"dev-main": "3.2.x-dev"
},
"symfony": {
"require": "^6.1"
}
},
{
"type": "path",
"url": "../State"
}
]
"repositories": [
{
"type": "path",
"url": "../Metadata"
},
{
"type": "path",
"url": "../State"
},
{
"type": "path",
"url": "../Serializer"
}
]
}
2 changes: 1 addition & 1 deletion src/Exception/InvalidIdentifierException.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@
*
* @author Antoine Bluchet <[email protected]>
*/
final class InvalidIdentifierException extends \Exception implements ExceptionInterface
class InvalidIdentifierException extends \Exception implements ExceptionInterface
{
}
2 changes: 0 additions & 2 deletions src/Exception/InvalidUriVariableException.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
* Identifier is not valid exception.
*
* @author Antoine Bluchet <[email protected]>
*
* @final
*/
class InvalidUriVariableException extends \Exception implements ExceptionInterface
{
Expand Down
Loading

0 comments on commit 81a6697

Please sign in to comment.