Skip to content

Commit 7952567

Browse files
committed
Merge branch '2.3' into merge-2.3
2 parents b6898f3 + b53bb0b commit 7952567

File tree

65 files changed

+113
-161
lines changed

Some content is hidden

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

65 files changed

+113
-161
lines changed

.circleci/config.yml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ jobs:
8686
- *update-composer
8787
- run:
8888
name: Install PHP-CS-Fixer
89-
command: composer global require friendsofphp/php-cs-fixer:^2.12
89+
command: composer global require friendsofphp/php-cs-fixer:^2.13
9090
- *save-composer-cache-by-revision
9191
- *save-composer-cache-by-branch
9292
- run:
@@ -124,7 +124,6 @@ jobs:
124124
- image: circleci/php:7.2-node-browsers
125125
environment:
126126
SYMFONY_DEPRECATIONS_HELPER: weak_vendors
127-
APP_ENV: test
128127
parallelism: 2
129128
working_directory: ~/api-platform/core
130129
steps:
@@ -141,8 +140,11 @@ jobs:
141140
- run:
142141
name: Run PHPUnit tests
143142
command: |-
144-
mkdir -p build/logs/tmp build/cov
145-
phpdbg -qrr vendor/bin/phpunit --coverage-php build/cov/coverage.cov --log-junit build/logs/tmp/coverage.xml --colors=always
143+
mkdir -p build/logs/parallel build/logs/tmp build/cov
144+
split_tests=$(find tests -name '*Test.php' -not -path 'tests/Bridge/Symfony/Bundle/DependencyInjection/ApiPlatformExtensionTest.php' | circleci tests split --split-by=timings)
145+
export PARALLEL='-j10% --joblog build/logs/parallel/jobs.log --rpl {_}\ s/\\//_/g;'
146+
phpunit_cmd='phpdbg -qrr vendor/bin/phpunit --coverage-php build/cov/coverage-{_}.cov --log-junit build/logs/tmp/{_}.xml --colors=always {}'
147+
echo "$split_tests" | parallel "$phpunit_cmd" || echo "$split_tests" | parallel --retry-failed "$phpunit_cmd"
146148
- run:
147149
name: Merge PHPUnit test reports
148150
command: |-
@@ -154,6 +156,9 @@ jobs:
154156
- store_artifacts:
155157
path: build/logs/phpunit/junit.xml
156158
destination: build/logs/phpunit/junit.xml
159+
- store_artifacts:
160+
path: build/logs/parallel/jobs.log
161+
destination: build/logs/parallel/jobs.log
157162
- persist_to_workspace:
158163
root: build
159164
paths:

.php_cs.dist

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ return PhpCsFixer\Config::create()
2020
->setRiskyAllowed(true)
2121
->setRules([
2222
'@DoctrineAnnotation' => true,
23+
'@PHP71Migration' => true,
24+
'@PHP71Migration:risky' => true,
2325
'@PHPUnit60Migration:risky' => true,
2426
'@Symfony' => true,
2527
'@Symfony:risky' => true,
@@ -33,7 +35,7 @@ return PhpCsFixer\Config::create()
3335
'braces' => [
3436
'allow_single_line_closure' => true,
3537
],
36-
'declare_strict_types' => true,
38+
'compact_nullable_typehint' => true,
3739
'doctrine_annotation_array_assignment' => [
3840
'operator' => '=',
3941
],
@@ -45,11 +47,6 @@ return PhpCsFixer\Config::create()
4547
'header' => $header,
4648
'location' => 'after_open',
4749
],
48-
'native_function_invocation' => [
49-
'include' => [
50-
'@compiler_optimized',
51-
],
52-
],
5350
'no_extra_blank_lines' => [
5451
'tokens' => [
5552
'break',
@@ -74,11 +71,14 @@ return PhpCsFixer\Config::create()
7471
],
7572
'sortAlgorithm' => 'alpha',
7673
],
74+
'php_unit_method_casing' => [
75+
'case' => 'camel_case',
76+
],
7777
'phpdoc_order' => true,
78-
// 'simplified_null_return' => true,
78+
'phpdoc_trim_consecutive_blank_line_separation' => true,
7979
'strict_comparison' => true,
8080
'strict_param' => true,
81-
'ternary_to_null_coalescing' => true,
81+
'void_return' => false, // BC breaks; to be done in API Platform 3.0
8282
])
8383
->setFinder($finder)
8484
;

appveyor.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ install:
99
- ps: Set-Service wuauserv -StartupType Manual
1010
- cinst -y php composer
1111
- refreshenv
12-
- cd c:\tools\php72
12+
- cd c:\tools\php73
1313
- copy php.ini-production php.ini /Y
1414
- echo date.timezone="UTC" >> php.ini
1515
- echo extension_dir=ext >> php.ini

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@
7272
"webonyx/graphql-php": ">=0.13 <1.0"
7373
},
7474
"conflict": {
75+
"doctrine/common": "<2.7",
7576
"symfony/dependency-injection": "<3.4"
7677
},
7778
"suggest": {

src/Api/FilterLocatorTrait.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ private function setFilterLocator($filterLocator = null, bool $allowNull = false
4848
/**
4949
* Gets a filter with a backward compatibility.
5050
*
51-
*
5251
* @return FilterInterface|null
5352
*/
5453
private function getFilter(string $filterId)

src/Api/IriConverterInterface.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ interface IriConverterInterface
2727
/**
2828
* Retrieves an item from its IRI.
2929
*
30-
*
3130
* @throws InvalidArgumentException
3231
* @throws ItemNotFoundException
3332
*
@@ -48,23 +47,20 @@ public function getIriFromItem($item, int $referenceType = UrlGeneratorInterface
4847
/**
4948
* Gets the IRI associated with the given resource collection.
5049
*
51-
*
5250
* @throws InvalidArgumentException
5351
*/
5452
public function getIriFromResourceClass(string $resourceClass, int $referenceType = UrlGeneratorInterface::ABS_PATH): string;
5553

5654
/**
5755
* Gets the item IRI associated with the given resource.
5856
*
59-
*
6057
* @throws InvalidArgumentException
6158
*/
6259
public function getItemIriFromResourceClass(string $resourceClass, array $identifiers, int $referenceType = UrlGeneratorInterface::ABS_PATH): string;
6360

6461
/**
6562
* Gets the IRI associated with the given resource subresource.
6663
*
67-
*
6864
* @throws InvalidArgumentException
6965
*/
7066
public function getSubresourceIriFromResourceClass(string $resourceClass, array $identifiers, int $referenceType = UrlGeneratorInterface::ABS_PATH): string;

src/Api/OperationMethodResolverInterface.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,13 @@ interface OperationMethodResolverInterface
2525
/**
2626
* Resolves the uppercased HTTP method associated with a collection operation.
2727
*
28-
*
2928
* @throws RuntimeException
3029
*/
3130
public function getCollectionOperationMethod(string $resourceClass, string $operationName): string;
3231

3332
/**
3433
* Resolves the uppercased HTTP method associated with an item operation.
3534
*
36-
*
3735
* @throws RuntimeException
3836
*/
3937
public function getItemOperationMethod(string $resourceClass, string $operationName): string;

src/Api/ResourceClassResolverInterface.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ interface ResourceClassResolverInterface
2525
/**
2626
* Guesses the associated resource.
2727
*
28-
*
2928
* @throws InvalidArgumentException
3029
*/
3130
public function getResourceClass($value, string $resourceClass = null, bool $strict = false): string;

src/Bridge/Doctrine/Common/DataPersister.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ public function remove($data)
7878
/**
7979
* Gets the Doctrine object manager associated with given data.
8080
*
81-
*
8281
* @return DoctrineObjectManager|null
8382
*/
8483
private function getManager($data)

src/Bridge/Doctrine/EventListener/PurgeHttpCacheListener.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ private function addTagsFor($value)
133133
return;
134134
}
135135

136-
if (!\is_array($value) && !$value instanceof \Traversable) {
136+
if (!is_iterable($value)) {
137137
$this->addTagForItem($value);
138138

139139
return;

src/Bridge/Doctrine/EventListener/WriteListener.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ public function onKernelView(GetResponseForControllerResultEvent $event)
7272
/**
7373
* Gets the manager if applicable.
7474
*
75-
*
7675
* @return ObjectManager|null
7776
*/
7877
private function getManager(string $resourceClass, $data)

src/Bridge/Doctrine/Orm/Extension/ContextAwareQueryCollectionExtensionInterface.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,8 @@
2323
*/
2424
interface ContextAwareQueryCollectionExtensionInterface extends QueryCollectionExtensionInterface
2525
{
26+
/**
27+
* {@inheritdoc}
28+
*/
2629
public function applyToCollection(QueryBuilder $queryBuilder, QueryNameGeneratorInterface $queryNameGenerator, string $resourceClass, string $operationName = null, array $context = []);
2730
}

src/Bridge/Doctrine/Orm/Extension/ContextAwareQueryItemExtensionInterface.php

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

src/Bridge/Doctrine/Orm/Extension/ContextAwareQueryResultCollectionExtensionInterface.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,13 @@
2222
*/
2323
interface ContextAwareQueryResultCollectionExtensionInterface extends QueryResultCollectionExtensionInterface
2424
{
25+
/**
26+
* {@inheritdoc}
27+
*/
2528
public function supportsResult(string $resourceClass, string $operationName = null, array $context = []): bool;
2629

30+
/**
31+
* {@inheritdoc}
32+
*/
2733
public function getResult(QueryBuilder $queryBuilder, string $resourceClass = null, string $operationName = null, array $context = []);
2834
}

src/Bridge/Doctrine/Orm/Extension/ContextAwareQueryResultItemExtensionInterface.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,13 @@
2222
*/
2323
interface ContextAwareQueryResultItemExtensionInterface extends QueryResultItemExtensionInterface
2424
{
25+
/**
26+
* {@inheritdoc}
27+
*/
2528
public function supportsResult(string $resourceClass, string $operationName = null, array $context = []): bool;
2629

30+
/**
31+
* {@inheritdoc}
32+
*/
2733
public function getResult(QueryBuilder $queryBuilder, string $resourceClass = null, string $operationName = null, array $context = []);
2834
}

src/Bridge/Doctrine/Orm/Extension/QueryResultCollectionExtensionInterface.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,8 @@ interface QueryResultCollectionExtensionInterface extends QueryCollectionExtensi
2626
{
2727
public function supportsResult(string $resourceClass, string $operationName = null): bool;
2828

29+
/**
30+
* @return array|\Traversable
31+
*/
2932
public function getResult(QueryBuilder $queryBuilder);
3033
}

src/Bridge/Doctrine/Orm/Extension/QueryResultItemExtensionInterface.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,8 @@ interface QueryResultItemExtensionInterface extends QueryItemExtensionInterface
2525
{
2626
public function supportsResult(string $resourceClass, string $operationName = null): bool;
2727

28+
/**
29+
* @return object|null
30+
*/
2831
public function getResult(QueryBuilder $queryBuilder);
2932
}

src/Bridge/Doctrine/Orm/Filter/AbstractFilter.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,6 @@ protected function extractProperties(Request $request/*, string $resourceClass*/
262262
/**
263263
* Adds the necessary joins for a nested property.
264264
*
265-
*
266265
* @throws InvalidArgumentException If property is not nested
267266
*
268267
* @return array An array where the first element is the join $alias of the leaf entity,

src/Bridge/Doctrine/Orm/Filter/ContextAwareFilterInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
interface ContextAwareFilterInterface extends FilterInterface
2525
{
2626
/**
27-
* Applies the filter.
27+
* {@inheritdoc}
2828
*/
2929
public function apply(QueryBuilder $queryBuilder, QueryNameGeneratorInterface $queryNameGenerator, string $resourceClass, string $operationName = null, array $context = []);
3030
}

src/Bridge/Doctrine/Orm/Filter/ExistsFilter.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,6 @@ protected function isNullableField(string $property, string $resourceClass): boo
167167
/**
168168
* Determines whether an association is nullable.
169169
*
170-
*
171-
*
172170
* @see https://github.com/doctrine/doctrine2/blob/v2.5.4/lib/Doctrine/ORM/Tools/EntityGenerator.php#L1221-L1246
173171
*/
174172
private function isAssociationNullable(array $associationMapping): bool

src/Bridge/Doctrine/Orm/Filter/SearchFilter.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,6 @@ protected function filterProperty(string $property, $value, QueryBuilder $queryB
290290
/**
291291
* Adds where clause according to the strategy.
292292
*
293-
*
294293
* @throws InvalidArgumentException If strategy does not exist
295294
*/
296295
protected function addWhereByStrategy(string $strategy, QueryBuilder $queryBuilder, QueryNameGeneratorInterface $queryNameGenerator, string $alias, string $field, $value, bool $caseSensitive)

src/Bridge/NelmioApiDoc/Extractor/AnnotationsProvider/ApiPlatformProvider.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,6 @@ private function getApiDoc(bool $collection, string $resourceClass, ResourceMeta
152152
/**
153153
* Gets Hydra documentation for the given resource.
154154
*
155-
*
156155
* @return array|null
157156
*/
158157
private function getResourceHydraDoc(array $hydraApiDoc, string $prefixedShortName)

src/Bridge/Symfony/Bundle/DependencyInjection/Configuration.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,6 @@ public function getConfigTreeBuilder()
252252
/**
253253
* Adds an exception to status section.
254254
*
255-
*
256255
* @throws InvalidConfigurationException
257256
*/
258257
private function addExceptionToStatusSection(ArrayNodeDefinition $rootNode)

src/Bridge/Symfony/Routing/OperationMethodResolver.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@ private function getOperationMethod(string $resourceClass, string $operationName
9696
/**
9797
* Gets the route related to the given operation.
9898
*
99-
*
10099
* @throws RuntimeException
101100
*/
102101
private function getOperationRoute(string $resourceClass, string $operationName, string $operationType): Route
@@ -123,7 +122,6 @@ private function getOperationRoute(string $resourceClass, string $operationName,
123122
/**
124123
* Gets the route name or null if not defined.
125124
*
126-
*
127125
* @return string|null
128126
*/
129127
private function getRouteName(ResourceMetadata $resourceMetadata, string $operationName, string $operationType)
@@ -138,7 +136,6 @@ private function getRouteName(ResourceMetadata $resourceMetadata, string $operat
138136
/**
139137
* Gets the route with the given name.
140138
*
141-
*
142139
* @throws RuntimeException
143140
*/
144141
private function getRoute(string $routeName): Route

src/Bridge/Symfony/Validator/EventListener/ValidateListener.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ public function __construct(ValidatorInterface $validator, ResourceMetadataFacto
4646
/**
4747
* Validates data returned by the controller if applicable.
4848
*
49-
*
5049
* @throws ValidationException
5150
*/
5251
public function onKernelView(GetResponseForControllerResultEvent $event)

src/DataPersister/ChainDataPersister.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,9 @@ public function remove($data)
6464
{
6565
foreach ($this->persisters as $persister) {
6666
if ($persister->supports($data)) {
67-
return $persister->remove($data);
67+
$persister->remove($data);
68+
69+
return;
6870
}
6971
}
7072
}

src/DataPersister/DataPersisterInterface.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ public function supports($data): bool;
2828
/**
2929
* Persists the data.
3030
*
31-
*
3231
* @return object|void Void will not be supported in API Platform 3, an object should always be returned
3332
*/
3433
public function persist($data);

0 commit comments

Comments
 (0)