Skip to content

Commit be932e9

Browse files
authored
Merge pull request #2689 from soyuka/master
Merge 2.4 onto master
2 parents ea73061 + 102d6cf commit be932e9

File tree

80 files changed

+1554
-526
lines changed

Some content is hidden

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

80 files changed

+1554
-526
lines changed

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ jobs:
108108
- *update-composer
109109
- run:
110110
name: Install PHP-CS-Fixer
111-
command: composer global require friendsofphp/php-cs-fixer:^2.13
111+
command: composer global require friendsofphp/php-cs-fixer:^2.14
112112
- *save-composer-cache-by-revision
113113
- *save-composer-cache-by-branch
114114
- run:

.php_cs.dist

Lines changed: 29 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@ HEADER;
1313

1414
$finder = PhpCsFixer\Finder::create()
1515
->in(__DIR__)
16-
->exclude('tests/Fixtures/app/var')
17-
;
16+
->exclude('tests/Fixtures/app/var');
1817

1918
return PhpCsFixer\Config::create()
2019
->setRiskyAllowed(true)
@@ -26,15 +25,13 @@ return PhpCsFixer\Config::create()
2625
'@Symfony' => true,
2726
'@Symfony:risky' => true,
2827
'align_multiline_comment' => [
29-
'comment_type' => 'phpdocs_only',
28+
'comment_type' => 'phpdocs_like',
3029
],
3130
'array_indentation' => true,
3231
'array_syntax' => [
3332
'syntax' => 'short',
3433
],
35-
'braces' => [
36-
'allow_single_line_closure' => true,
37-
],
34+
'comment_to_phpdoc' => true,
3835
'compact_nullable_typehint' => true,
3936
'doctrine_annotation_array_assignment' => [
4037
'operator' => '=',
@@ -43,10 +40,18 @@ return PhpCsFixer\Config::create()
4340
'after_array_assignments_equals' => false,
4441
'before_array_assignments_equals' => false,
4542
],
43+
'explicit_indirect_variable' => true,
44+
'fully_qualified_strict_types' => true,
4645
'header_comment' => [
4746
'header' => $header,
4847
'location' => 'after_open',
4948
],
49+
'logical_operators' => true,
50+
'multiline_comment_opening_closing' => true,
51+
'multiline_whitespace_before_semicolons' => [
52+
'strategy' => 'no_multi_line',
53+
],
54+
'no_alternative_syntax' => true,
5055
'no_extra_blank_lines' => [
5156
'tokens' => [
5257
'break',
@@ -60,22 +65,36 @@ return PhpCsFixer\Config::create()
6065
'use',
6166
],
6267
],
63-
'no_superfluous_phpdoc_tags' => true,
68+
'no_superfluous_elseif' => true,
69+
'no_superfluous_phpdoc_tags' => [
70+
'allow_mixed' => false,
71+
],
72+
'no_unset_cast' => true,
73+
'no_unset_on_property' => true,
6474
'no_useless_else' => true,
6575
'no_useless_return' => true,
6676
'ordered_imports' => [
67-
'importsOrder' => [
77+
'imports_order' => [
6878
'class',
6979
'function',
7080
'const',
7181
],
72-
'sortAlgorithm' => 'alpha',
82+
'sort_algorithm' => 'alpha',
7383
],
7484
'php_unit_method_casing' => [
7585
'case' => 'camel_case',
7686
],
87+
'php_unit_set_up_tear_down_visibility' => true,
88+
'php_unit_test_annotation' => [
89+
'style' => 'prefix',
90+
],
91+
'phpdoc_add_missing_param_annotation' => [
92+
'only_untyped' => true,
93+
],
7794
'phpdoc_order' => true,
7895
'phpdoc_trim_consecutive_blank_line_separation' => true,
96+
'phpdoc_var_annotation_correct_order' => true,
97+
'return_assignment' => true,
7998
'strict_comparison' => true,
8099
'strict_param' => true,
81100
'visibility_required' => [
@@ -87,5 +106,4 @@ return PhpCsFixer\Config::create()
87106
],
88107
'void_return' => false, // BC breaks; to be done in API Platform 3.0
89108
])
90-
->setFinder($finder)
91-
;
109+
->setFinder($finder);

CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,19 @@
44

55
* GraphQL: Add support for custom types
66

7+
## 2.4.2
8+
9+
* Fix a dependency injection injection problem in `FilterEagerLoadingExtension`
10+
* Improve performance by adding a `NoOpScalarNormalizer` handling scalar values
11+
12+
## 2.4.1
13+
14+
* Improve performance of the dev environment and deprecate the `api_platform.metadata_cache` parameter
15+
* Fix a BC break in `SearchFilter`
16+
* Don't send HTTP cache headers for unsuccessful responses
17+
* GraphQL: parse input and messenger metadata on the GraphQl operation
18+
* GraphQL: do not enable graphql when `webonyx/graphql-php` is not installed
19+
720
## 2.4.0
821

922
* Listeners are now opt-in when not handling API Platform operations

composer.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"symfony/http-kernel": "^3.4 || ^4.0",
2222
"symfony/property-access": "^3.4 || ^4.0",
2323
"symfony/property-info": "^3.4 || ^4.0",
24-
"symfony/serializer": "^4.1",
24+
"symfony/serializer": "^4.2",
2525
"symfony/web-link": "^4.1",
2626
"willdurand/negotiation": "^2.0.3"
2727
},
@@ -44,7 +44,6 @@
4444
"jangregor/phpstan-prophecy": "^0.3",
4545
"justinrainbow/json-schema": "^5.0",
4646
"nelmio/api-doc-bundle": "^2.13.3",
47-
"php-mock/php-mock-phpunit": "^2.0",
4847
"phpdocumentor/reflection-docblock": "^3.0 || ^4.0",
4948
"phpdocumentor/type-resolver": "^0.3 || ^0.4",
5049
"phpspec/prophecy": "^1.8",

features/bootstrap/DoctrineContext.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ public function thereAreDummyGroupObjects(int $nb)
230230
$dummyGroup = $this->buildDummyGroup();
231231

232232
foreach (['foo', 'bar', 'baz', 'qux'] as $property) {
233-
$dummyGroup->$property = ucfirst($property).' #'.$i;
233+
$dummyGroup->{$property} = ucfirst($property).' #'.$i;
234234
}
235235

236236
$this->manager->persist($dummyGroup);
@@ -249,7 +249,7 @@ public function thereAreDummyPropertyObjects(int $nb)
249249
$dummyGroup = $this->buildDummyGroup();
250250

251251
foreach (['foo', 'bar', 'baz'] as $property) {
252-
$dummyProperty->$property = $dummyGroup->$property = ucfirst($property).' #'.$i;
252+
$dummyProperty->{$property} = $dummyGroup->{$property} = ucfirst($property).' #'.$i;
253253
}
254254

255255
$dummyProperty->group = $dummyGroup;
@@ -268,15 +268,15 @@ public function thereAreDummyPropertyObjectsWithASharedGroup(int $nb)
268268
{
269269
$dummyGroup = $this->buildDummyGroup();
270270
foreach (['foo', 'bar', 'baz'] as $property) {
271-
$dummyGroup->$property = ucfirst($property).' #shared';
271+
$dummyGroup->{$property} = ucfirst($property).' #shared';
272272
}
273273
$this->manager->persist($dummyGroup);
274274

275275
for ($i = 1; $i <= $nb; ++$i) {
276276
$dummyProperty = $this->buildDummyProperty();
277277

278278
foreach (['foo', 'bar', 'baz'] as $property) {
279-
$dummyProperty->$property = ucfirst($property).' #'.$i;
279+
$dummyProperty->{$property} = ucfirst($property).' #'.$i;
280280
}
281281

282282
$dummyProperty->group = $dummyGroup;
@@ -296,7 +296,7 @@ public function thereAreDummyPropertyObjectsWithADifferentNumberRelatedGroups(in
296296
$dummyProperty = $this->buildDummyProperty();
297297

298298
foreach (['foo', 'bar', 'baz'] as $property) {
299-
$dummyProperty->$property = $dummyGroup->$property = ucfirst($property).' #'.$i;
299+
$dummyProperty->{$property} = $dummyGroup->{$property} = ucfirst($property).' #'.$i;
300300
}
301301

302302
$this->manager->persist($dummyGroup);
@@ -322,7 +322,7 @@ public function thereAreDummyPropertyObjectsWithGroups(int $nb, int $nb2)
322322
$dummyGroup = $this->buildDummyGroup();
323323

324324
foreach (['foo', 'bar', 'baz'] as $property) {
325-
$dummyProperty->$property = $dummyGroup->$property = ucfirst($property).' #'.$i;
325+
$dummyProperty->{$property} = $dummyGroup->{$property} = ucfirst($property).' #'.$i;
326326
}
327327

328328
$dummyProperty->group = $dummyGroup;
@@ -332,7 +332,7 @@ public function thereAreDummyPropertyObjectsWithGroups(int $nb, int $nb2)
332332
$dummyGroup = $this->buildDummyGroup();
333333

334334
foreach (['foo', 'bar', 'baz'] as $property) {
335-
$dummyGroup->$property = ucfirst($property).' #'.$i.$j;
335+
$dummyGroup->{$property} = ucfirst($property).' #'.$i.$j;
336336
}
337337

338338
$dummyProperty->groups[] = $dummyGroup;

features/bootstrap/HydraContext.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ public function assertPropertyIsNotRequired(string $propertyName, string $classN
222222
*
223223
* @throws \InvalidArgumentException
224224
*/
225-
private function getPropertyInfo(string $propertyName, string $className): \stdClass
225+
private function getPropertyInfo(string $propertyName, string $className): stdClass
226226
{
227227
foreach ($this->getProperties($className) as $property) {
228228
if ($property->{'hydra:title'} === $propertyName) {
@@ -238,7 +238,7 @@ private function getPropertyInfo(string $propertyName, string $className): \stdC
238238
*
239239
* @throws \InvalidArgumentException
240240
*/
241-
private function getOperation(string $method, string $className): \stdClass
241+
private function getOperation(string $method, string $className): stdClass
242242
{
243243
foreach ($this->getOperations($className) as $operation) {
244244
if ($operation->{'hydra:method'} === $method) {
@@ -270,7 +270,7 @@ private function getProperties(string $className): array
270270
*
271271
* @throws \InvalidArgumentException
272272
*/
273-
private function getClassInfo(string $className): \stdClass
273+
private function getClassInfo(string $className): stdClass
274274
{
275275
$json = $this->getLastJsonResponse();
276276

@@ -290,7 +290,7 @@ private function getClassInfo(string $className): \stdClass
290290
*
291291
* @throws \RuntimeException
292292
*/
293-
private function getLastJsonResponse(): \stdClass
293+
private function getLastJsonResponse(): stdClass
294294
{
295295
if (null === $decoded = json_decode($this->restContext->getMink()->getSession()->getDriver()->getContent())) {
296296
throw new \RuntimeException('JSON response seems to be invalid');

features/bootstrap/SwaggerContext.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ public function assertPropertyIsRequiredForOpenAPi(string $propertyName, string
149149
*
150150
* @throws \InvalidArgumentException
151151
*/
152-
private function getPropertyInfo(string $propertyName, string $className, int $specVersion = 2): \stdClass
152+
private function getPropertyInfo(string $propertyName, string $className, int $specVersion = 2): stdClass
153153
{
154154
foreach ($this->getProperties($className, $specVersion) as $classPropertyName => $property) {
155155
if ($classPropertyName === $propertyName) {
@@ -163,7 +163,7 @@ private function getPropertyInfo(string $propertyName, string $className, int $s
163163
/**
164164
* Gets all operations of a given class.
165165
*/
166-
private function getProperties(string $className, int $specVersion = 2): \stdClass
166+
private function getProperties(string $className, int $specVersion = 2): stdClass
167167
{
168168
return $this->getClassInfo($className, $specVersion)->{'properties'} ?? new \stdClass();
169169
}
@@ -173,7 +173,7 @@ private function getProperties(string $className, int $specVersion = 2): \stdCla
173173
*
174174
* @throws \InvalidArgumentException
175175
*/
176-
private function getClassInfo(string $className, int $specVersion = 2): \stdClass
176+
private function getClassInfo(string $className, int $specVersion = 2): stdClass
177177
{
178178
$nodes = 2 === $specVersion ? $this->getLastJsonResponse()->{'definitions'} : $this->getLastJsonResponse()->{'components'}->{'schemas'};
179179
foreach ($nodes as $classTitle => $classData) {
@@ -190,7 +190,7 @@ private function getClassInfo(string $className, int $specVersion = 2): \stdClas
190190
*
191191
* @throws \RuntimeException
192192
*/
193-
private function getLastJsonResponse(): \stdClass
193+
private function getLastJsonResponse(): stdClass
194194
{
195195
if (null === ($decoded = json_decode($this->restContext->getMink()->getSession()->getDriver()->getContent()))) {
196196
throw new \RuntimeException('JSON response seems to be invalid');

features/main/input_output.feature

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,3 +287,29 @@ Feature: DTO input and output
287287
"data": 123
288288
}
289289
"""
290+
291+
@!mongodb
292+
Scenario: Use messenger with graphql and an input where the handler gives a synchronous result
293+
When I send the following GraphQL request:
294+
"""
295+
mutation {
296+
createMessengerWithInput(input: {var: "test"}) {
297+
messengerWithInput { id, name }
298+
}
299+
}
300+
"""
301+
Then the response status code should be 200
302+
And the response should be in JSON
303+
And the JSON should be equal to:
304+
"""
305+
{
306+
"data": {
307+
"createMessengerWithInput": {
308+
"messengerWithInput": {
309+
"id": "/messenger_with_inputs/1",
310+
"name": "test"
311+
}
312+
}
313+
}
314+
}
315+
"""

phpstan.neon.dist

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,10 @@ parameters:
6464
path: %currentWorkingDirectory%/src/Test/DoctrineMongoDbOdmFilterTestCase.php
6565
- '#Method ApiPlatform\\Core\\(Serializer\\Abstract|JsonApi\\Serializer\\)ItemNormalizer::normalizeRelation\(\) should return array\|string but returns array\|bool\|float\|int\|string\.#'
6666
- '#Method ApiPlatform\\Core\\Util\\RequestParser::parseRequestParams\(\) should return array but returns array\|false\.#'
67-
- "#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\\.#"
68-
# https://github.com/symfony/symfony/pull/30535
6967
-
70-
message: '#Call to method PHPUnit\\Framework\\Assert::assertNull\(\) with string will always evaluate to false\.#'
71-
path: %currentWorkingDirectory%/tests/EventListener/AddFormatListenerTest.php
68+
message: '#Method ApiPlatform\\Core\\Bridge\\Doctrine\\Orm\\Util\\QueryBuilderHelper::mapJoinAliases() should return array<string, array<string>\|string> but returns array<int|string, mixed>\.#'
69+
path: %currentWorkingDirectory%/src/Bridge/Doctrine/Orm/Util/QueryBuilderHelper.php
70+
- "#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\\.#"
7271
# https://github.com/doctrine/doctrine2/pull/7298/files
7372
- '#Strict comparison using === between null and int will always evaluate to false\.#'
7473
-

src/Annotation/ApiFilter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public function __construct($options = [])
6969
throw new InvalidArgumentException(sprintf('Property "%s" does not exist on the ApiFilter annotation.', $key));
7070
}
7171

72-
$this->$key = $value;
72+
$this->{$key} = $value;
7373
}
7474
}
7575
}

0 commit comments

Comments
 (0)