Skip to content

Commit 10827bb

Browse files
laryjulienKevin VerschaeveGrimpEreauFlorian Vaneste
authored
Move the non-legacy code to src (#4556)
* create depreacted interfaces file and move DataTransformer interfaces * move validator * fix interfaces and action alias * Move ApiPlatform\Core\Bridge\Doctrine\Common\Filter traits * move Action directory * Util classes * Validator, cs-fixer, WIP phpstan * fix references & test * revert code style & improve ApiPlatformExtensionTest * Bridge/Doctrine * Elasticsearch * RamseyUuid * DataProvider & DataTransformer * Documentation * EventListener * Hal * HttpCache * Hydra * Bridge\Symfony\Bundle * Symfony/Messenger * Symfony/Metadata * Symfony/Routing * Symfony/Validator * Problem * Serializer * Test * OpenApi + Swagger * JsonApi * JsonLd * JsonSchema * Security * Mercure * PathResolver Co-authored-by: Kevin Verschaeve <[email protected]> Co-authored-by: Jade Bellereau <[email protected]> Co-authored-by: Florian Vaneste <[email protected]>
1 parent bb2180f commit 10827bb

File tree

780 files changed

+2609
-2168
lines changed

Some content is hidden

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

780 files changed

+2609
-2168
lines changed

.php-cs-fixer.dist.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
'src/Core/Bridge/Symfony/Maker/Resources/skeleton',
1818
'tests/Fixtures/app/var',
1919
])
20-
->notPath('src/Bridge/Symfony/Bundle/DependencyInjection/Configuration.php')
20+
->notPath('src/Symfony/Bundle/DependencyInjection/Configuration.php')
2121
->notPath('src/Annotation/ApiFilter.php') // temporary
2222
->notPath('src/Annotation/ApiProperty.php') // temporary
2323
->notPath('src/Annotation/ApiResource.php') // temporary

phpstan.neon.dist

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ parameters:
1111
bootstrapFiles:
1212
- vendor/bin/.phpunit/phpunit/vendor/autoload.php
1313
# We're aliasing classes for phpunit in this file, it needs to be added here see phpstan/#2194
14-
- src/Core/Bridge/Symfony/Bundle/Test/Constraint/ArraySubset.php
14+
- src/Symfony/Bundle/Test/Constraint/ArraySubset.php
1515
- tests/Fixtures/app/AppKernel.php
1616
excludes_analyse:
1717
# Symfony cache
@@ -21,18 +21,18 @@ parameters:
2121
- tests/Core/Bridge/NelmioApiDoc/*
2222
- src/Core/Bridge/FosUser/*
2323
# BC layer
24-
- tests/Core/Bridge/Symfony/Bundle/DependencyInjection/Compiler/AnnotationFilterPassTest.php
24+
- tests/Symfony/Bundle/DependencyInjection/Compiler/AnnotationFilterPassTest.php
2525
- tests/Core/Annotation/ApiResourceTest.php
2626
- tests/Core/Annotation/ApiPropertyTest.php
2727
- tests/Core/Metadata/Resource/Factory/AnnotationResourceMetadataFactoryTest.php
2828
- tests/Fixtures/TestBundle/BrowserKit/Client.php
2929
# The Symfony Configuration API isn't good enough to be analysed
30-
- src/Core/Bridge/Symfony/Bundle/DependencyInjection/Configuration.php
30+
- src/Symfony/Bundle/DependencyInjection/Configuration.php
3131
# Phpstan runs on phpunit > 9, a signature changed in this file
32-
- src/Core/Bridge/Symfony/Bundle/Test/Constraint/ArraySubsetLegacy.php
32+
- src/Symfony/Bundle/Test/Constraint/ArraySubsetLegacy.php
3333
# Imported code (temporary)
34-
- src/Core/Bridge/Symfony/Bundle/Test/BrowserKitAssertionsTrait.php
35-
- tests/Core/Bridge/Symfony/Bundle/Test/WebTestCaseTest.php
34+
- src/Symfony/Bundle/Test/BrowserKitAssertionsTrait.php
35+
- tests/Symfony/Bundle/Test/WebTestCaseTest.php
3636
- tests/Core/ProphecyTrait.php
3737
- tests/Core/Behat/CoverageContext.php
3838
- tests/Fixtures/TestBundle/Security/AbstractSecurityUser.php
@@ -57,46 +57,46 @@ parameters:
5757
-
5858
message: "#Parameter \\#2 \\$dqlPart of method Doctrine\\\\ORM\\\\QueryBuilder::add\\(\\) expects array<'join'\\|int, array<int\\|string, object>\\|string>\\|object\\|string, array\\('o' => Doctrine\\\\ORM\\\\Query\\\\Expr\\\\Join\\) given\\.#"
5959
paths:
60-
- tests/Core/Bridge/Doctrine/Orm/Extension/FilterEagerLoadingExtensionTest.php
60+
- tests/Doctrine/Orm/Extension/FilterEagerLoadingExtensionTest.php
6161
-
6262
message: '#Strict comparison using !== between .+ and .+ will always evaluate to false\.#'
6363
paths:
64-
- src/Core/Bridge/Doctrine/Common/PropertyHelperTrait.php
64+
- src/Doctrine/Common/PropertyHelperTrait.php
6565
- '#Access to an undefined property Prophecy\\Prophecy\\ObjectProphecy<(\\?[a-zA-Z0-9_]+)+>::\$[a-zA-Z0-9_]+#'
6666
-
6767
message: '#Call to an undefined method Doctrine\\Persistence\\ObjectManager::getConnection\(\)#'
6868
path: src/Core/Bridge/Doctrine/Common/Util/IdentifierManagerTrait.php
6969
# https://github.com/willdurand/Negotiation/issues/89#issuecomment-513283286
7070
-
7171
message: '#Call to an undefined method Negotiation\\AcceptHeader::getType\(\)\.#'
72-
path: src/Core/EventListener/AddFormatListener.php
72+
path: src/Symfony/EventListener/AddFormatListener.php
7373
- '#Parameter \#1 \$vars of class GraphQL\\Language\\AST\\(IntValue|ObjectField|ObjectValue|BooleanValue|ListValue|StringValue)Node constructor expects array<bool\|float\|GraphQL\\Language\\AST\\Location\|GraphQL\\Language\\AST\\NameNode\|GraphQL\\Language\\AST\\NodeList\|GraphQL\\Language\\AST\\SelectionSetNode\|int\|string\|null>, array<string, .+> given\.#'
7474
- '#Parameter \#1 \$defaultContext of class Symfony\\Component\\Serializer\\Encoder\\Json(De|En)code constructor expects array, (int|true) given\.#'
75-
- '#Parameter \#(2|3) \$(resourceMetadataFactory|pagination) of class ApiPlatform\\Core\\Bridge\\Doctrine\\Orm\\Extension\\PaginationExtension constructor expects (ApiPlatform\\Core\\Metadata\\Resource\\Factory\\ResourceMetadataFactoryInterface\|Symfony\\Component\\HttpFoundation\\RequestStack|ApiPlatform\\Core\\DataProvider\\Pagination\|ApiPlatform\\Core\\Metadata\\Resource\\Factory\\ResourceMetadataFactoryInterface), stdClass given\.#'
75+
- '#Parameter \#(2|3) \$(resourceMetadataFactory|pagination) of class ApiPlatform\\Doctrine\\Orm\\Extension\\PaginationExtension constructor expects (ApiPlatform\\Core\\Metadata\\Resource\\Factory\\ResourceMetadataFactoryInterface\|Symfony\\Component\\HttpFoundation\\RequestStack|ApiPlatform\\Core\\Metadata\\Resource\\Factory\\ResourceMetadataFactoryInterface\|ApiPlatform\\State\\Pagination\\Pagination), stdClass given\.#'
7676
-
7777
message: '#Parameter \#[0-9] \$filterLocator of class .+ constructor expects ApiPlatform\\Core\\Api\\FilterCollection|Psr\\Container\\ContainerInterface, ArrayObject<mixed, mixed> given\.#'
7878
paths:
79-
- tests/Core/Bridge/Doctrine/Orm/Extension/FilterExtensionTest.php
80-
- tests/Core/Hydra/Serializer/CollectionFiltersNormalizerTest.php
79+
- tests/Doctrine/Orm/Extension/FilterExtensionTest.php
80+
- tests/Hydra/Serializer/CollectionFiltersNormalizerTest.php
8181
- tests/Core/Swagger/Serializer/DocumentationNormalizerV2Test.php
8282
- tests/Core/Swagger/Serializer/DocumentationNormalizerV3Test.php
8383
-
8484
message: '#Parameter \#1 \$objectValue of method GraphQL\\Type\\Definition\\InterfaceType::resolveType\(\) expects object, array(<string, string>)? given.#'
8585
path: tests/GraphQl/Type/TypeBuilderTest.php
8686
# https://github.com/phpstan/phpstan-doctrine/issues/115
8787
-
88-
message: '#Property ApiPlatform\\Core\\Test\\DoctrineMongoDbOdmFilterTestCase::\$repository \(Doctrine\\ODM\\MongoDB\\Repository\\DocumentRepository\) does not accept Doctrine\\ORM\\EntityRepository<ApiPlatform\\Tests\\Fixtures\\TestBundle\\Document\\Dummy>\.#'
89-
path: src/Core/Test/DoctrineMongoDbOdmFilterTestCase.php
88+
message: '#Property ApiPlatform\\Test\\DoctrineMongoDbOdmFilterTestCase::\$repository \(Doctrine\\ODM\\MongoDB\\Repository\\DocumentRepository\) does not accept Doctrine\\ORM\\EntityRepository<ApiPlatform\\Tests\\Fixtures\\TestBundle\\Document\\Dummy>\.#'
89+
path: src/Test/DoctrineMongoDbOdmFilterTestCase.php
9090
-
9191
message: "#Call to method PHPUnit\\\\Framework\\\\Assert::assertSame\\(\\) with array\\('(collection_context|item_context|subresource_context)'\\) and array<Symfony\\\\Component\\\\VarDumper\\\\Cloner\\\\Data>\\|bool\\|float\\|int\\|string\\|null will always evaluate to false\\.#"
92-
path: tests/Core/Bridge/Symfony/Bundle/DataCollector/RequestDataCollectorTest.php
92+
path: tests/Symfony/Bundle/DataCollector/RequestDataCollectorTest.php
9393
# https://github.com/phpstan/phpstan-phpunit/issues/62
9494
-
9595
message: '#Call to method PHPUnit\\Framework\\Assert::assertSame\(\) with 2 and int will always evaluate to false\.#'
9696
path: tests/Core/Identifier/Normalizer/IntegerDenormalizerTest.php
9797
-
9898
message: '#Call to method PHPUnit\\Framework\\Assert::assertSame\(\) with array\(.+\) and array\(.+\) will always evaluate to false\.#'
99-
path: tests/Core/Util/SortTraitTest.php
99+
path: tests/Util/SortTraitTest.php
100100
# https://github.com/phpstan/phpstan-symfony/issues/76
101101
-
102102
message: '#Service "test" is not registered in the container\.#'
@@ -107,9 +107,9 @@ parameters:
107107
- '#Constructor of class ApiPlatform\\Core\\Annotation\\ApiProperty has an unused parameter#'
108108

109109
# Expected, due to optional interfaces
110-
- '#Method ApiPlatform\\Core\\Bridge\\Doctrine\\Orm\\Extension\\QueryCollectionExtensionInterface::applyToCollection\(\) invoked with 5 parameters, 3-4 required\.#'
111-
- '#Method ApiPlatform\\Core\\Bridge\\Doctrine\\Orm\\Extension\\QueryResult(Item|Collection)ExtensionInterface::getResult\(\) invoked with 4 parameters, 1 required\.#'
112-
- '#Method ApiPlatform\\Core\\Bridge\\Doctrine\\Orm\\Extension\\QueryResult(Item|Collection)ExtensionInterface::supportsResult\(\) invoked with 3 parameters, 1-2 required\.#'
110+
- '#Method ApiPlatform\\Doctrine\\Orm\\Extension\\QueryCollectionExtensionInterface::applyToCollection\(\) invoked with 5 parameters, 3-4 required\.#'
111+
- '#Method ApiPlatform\\\Doctrine\\Orm\\Extension\\QueryResult(Item|Collection)ExtensionInterface::getResult\(\) invoked with 4 parameters, 1 required\.#'
112+
- '#Method ApiPlatform\\Doctrine\\Orm\\Extension\\QueryResult(Item|Collection)ExtensionInterface::supportsResult\(\) invoked with 3 parameters, 1-2 required\.#'
113113
- '#Method ApiPlatform\\Core\\Bridge\\Symfony\\Routing\\RouteNameResolverInterface::getRouteName\(\) invoked with 3 parameters, 2 required\.#'
114114
- '#Method ApiPlatform\\Core\\DataPersister\\DataPersisterInterface::persist\(\) invoked with 2 parameters, 1 required\.#'
115115
- '#Method ApiPlatform\\Core\\DataPersister\\DataPersisterInterface::remove\(\) invoked with 2 parameters, 1 required\.#'
@@ -120,11 +120,11 @@ parameters:
120120
- '#Method Symfony\\Component\\Serializer\\Normalizer\\NormalizerInterface::supportsNormalization\(\) invoked with 3 parameters, 1-2 required\.#'
121121

122122
# Expected, due to deprecations
123-
- '#Method ApiPlatform\\Core\\Bridge\\Doctrine\\Orm\\Filter\\(Abstract|Exists|Order)Filter::filterProperty\(\) invoked with 7 parameters, 5-6 required\.#'
124-
- '#Method ApiPlatform\\Core\\Bridge\\Doctrine\\Orm\\Filter\\(AbstractFilter|FilterInterface)::apply\(\) invoked with 5 parameters, 3-4 required\.#'
125-
- '#Method ApiPlatform\\Core\\PathResolver\\OperationPathResolverInterface::resolveOperationPath\(\) invoked with 4 parameters, 3 required\.#'
123+
- '#Method ApiPlatform\\Doctrine\\Orm\\Filter\\(Abstract|Exists|Order)Filter::filterProperty\(\) invoked with 7 parameters, 5-6 required\.#'
124+
- '#Method ApiPlatform\\Doctrine\\Orm\\Filter\\(AbstractFilter|FilterInterface)::apply\(\) invoked with 5 parameters, 3-4 required\.#'
125+
- '#Method ApiPlatform\\PathResolver\\OperationPathResolverInterface::resolveOperationPath\(\) invoked with 4 parameters, 3 required\.#'
126126

127127
# Expected, due to backward compatibility
128128
-
129-
message: "#Call to function method_exists\\(\\) with ApiPlatform\\\\Core\\\\JsonApi\\\\Serializer\\\\ItemNormalizer and 'setCircularReferenc…' will always evaluate to false\\.#"
130-
path: tests/Core/JsonApi/Serializer/ItemNormalizerTest.php
129+
message: "#Call to function method_exists\\(\\) with ApiPlatform\\\\JsonApi\\\\Serializer\\\\ItemNormalizer and 'setCircularReferenc…' will always evaluate to false\\.#"
130+
path: tests/JsonApi/Serializer/ItemNormalizerTest.php

phpunit.xml.dist

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@
3434
<directory>src/Bridge/Symfony/Maker/Resources/skeleton</directory>
3535
<directory>src/Core/Bridge/Rector</directory>
3636
<file>.php-cs-fixer.dist.php</file>
37-
<file>src/Bridge/Symfony/Bundle/DependencyInjection/ApiPlatformExtension.php</file>
38-
<file>src/Bridge/Symfony/Bundle/Test/Constraint/ArraySubsetLegacy.php</file>
37+
<file>src/Symfony/Bundle/DependencyInjection/ApiPlatformExtension.php</file>
38+
<file>src/Symfony/Bundle/Test/Constraint/ArraySubsetLegacy.php</file>
3939
</exclude>
4040
</coverage>
4141

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
declare(strict_types=1);
1313

14-
namespace ApiPlatform\Core\Action;
14+
namespace ApiPlatform\Action;
1515

1616
use ApiPlatform\Core\Api\Entrypoint;
1717
use ApiPlatform\Core\Metadata\Resource\Factory\ResourceNameCollectionFactoryInterface;
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@
1111

1212
declare(strict_types=1);
1313

14-
namespace ApiPlatform\Core\Action;
14+
namespace ApiPlatform\Action;
1515

1616
use ApiPlatform\Core\Metadata\Resource\Factory\ResourceMetadataFactoryInterface;
17-
use ApiPlatform\Core\Util\ErrorFormatGuesser;
18-
use ApiPlatform\Core\Util\RequestAttributesExtractor;
1917
use ApiPlatform\Metadata\Resource\Factory\ResourceMetadataCollectionFactoryInterface;
18+
use ApiPlatform\Util\ErrorFormatGuesser;
2019
use ApiPlatform\Util\OperationRequestInitiatorTrait;
20+
use ApiPlatform\Util\RequestAttributesExtractor;
2121
use Symfony\Component\Debug\Exception\FlattenException as LegacyFlattenException;
2222
use Symfony\Component\ErrorHandler\Exception\FlattenException;
2323
use Symfony\Component\HttpFoundation\Request;
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
declare(strict_types=1);
1313

14-
namespace ApiPlatform\Core\Action;
14+
namespace ApiPlatform\Action;
1515

1616
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
1717

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
declare(strict_types=1);
1313

14-
namespace ApiPlatform\Core\Action;
14+
namespace ApiPlatform\Action;
1515

1616
/**
1717
* Placeholder returning the data passed in parameter.

src/Api/IdentifiersExtractor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@
1515

1616
use ApiPlatform\Core\Api\ResourceClassResolverInterface;
1717
use ApiPlatform\Core\Identifier\CompositeIdentifierParser;
18-
use ApiPlatform\Core\Util\ResourceClassInfoTrait;
1918
use ApiPlatform\Exception\RuntimeException;
2019
use ApiPlatform\Metadata\Property\Factory\PropertyMetadataFactoryInterface;
2120
use ApiPlatform\Metadata\Property\Factory\PropertyNameCollectionFactoryInterface;
2221
use ApiPlatform\Metadata\Resource\Factory\ResourceMetadataCollectionFactoryInterface;
22+
use ApiPlatform\Util\ResourceClassInfoTrait;
2323
use Symfony\Component\PropertyAccess\PropertyAccess;
2424
use Symfony\Component\PropertyAccess\PropertyAccessorInterface;
2525

src/Core/Annotation/AttributesHydratorTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313

1414
namespace ApiPlatform\Core\Annotation;
1515

16-
use ApiPlatform\Core\Util\Inflector;
1716
use ApiPlatform\Exception\InvalidArgumentException;
17+
use ApiPlatform\Util\Inflector;
1818

1919
/**
2020
* Hydrates attributes from annotation's parameters.

src/Core/Api/CachedIdentifiersExtractor.php

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

1414
namespace ApiPlatform\Core\Api;
1515

16-
use ApiPlatform\Core\Util\ResourceClassInfoTrait;
16+
use ApiPlatform\Util\ResourceClassInfoTrait;
1717
use Psr\Cache\CacheException;
1818
use Psr\Cache\CacheItemPoolInterface;
1919
use Symfony\Component\PropertyAccess\PropertyAccess;

0 commit comments

Comments
 (0)