Skip to content

Commit 25c3cb4

Browse files
authored
Merge pull request #950 from ruudk/deprecation-helper
Fix all deprecations
2 parents c21922b + 97a3080 commit 25c3cb4

31 files changed

+66
-420
lines changed

UPGRADE.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,13 @@ UPGRADE FROM 0.14 to 1.0
33

44
* Removed `use_experimental_executor` configuraton option.
55
* Signature of TypeInterface changed from `string $name = null, string $resolveType` to `string $resolveType, ?string $name = null`
6+
* Removed deprecated `targetType` from `Query`
7+
* Removed deprecated `fieldBuilder` from `Field`
8+
* Removed deprecated `argsBuilder` from `Field`
9+
* Removed deprecated `args` from `Field`
10+
* Removed deprecated `builders` from `Type`
11+
* Removed deprecated `values` from `Enum`
12+
* Removed deprecated `resolver_maps` configuration option
613

714
UPGRADE FROM 0.13 to 0.14
815
=========================

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
"phpstan/phpstan": "^1.0",
5656
"phpstan/phpstan-phpunit": "^1.0",
5757
"phpstan/phpstan-symfony": "^1.0",
58-
"phpunit/phpunit": "^9.5",
58+
"phpunit/phpunit": "^9.5.10",
5959
"react/promise": "^2.5",
6060
"symfony/asset": "^5.3",
6161
"symfony/browser-kit": "^5.3",

phpstan-baseline.neon

Lines changed: 9 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
11
parameters:
22
ignoreErrors:
3-
-
4-
message: "#^Call to an undefined method ReflectionClass\\|ReflectionClassConstant\\|ReflectionMethod\\|ReflectionProperty\\:\\:getAttributes\\(\\)\\.$#"
5-
count: 1
6-
path: src/Config/Parser/AttributeParser.php
7-
83
-
94
message: "#^Abstract class Overblog\\\\GraphQLBundle\\\\Annotation\\\\Builder cannot be an Attribute class\\.$#"
105
count: 1
@@ -90,16 +85,6 @@ parameters:
9085
count: 1
9186
path: src/Config/Processor/BuilderProcessor.php
9287

93-
-
94-
message: "#^Attribute class Overblog\\\\GraphQLBundle\\\\Definition\\\\ReturnTypeWillChange does not exist\\.$#"
95-
count: 1
96-
path: src/Definition/Argument.php
97-
98-
-
99-
message: "#^Used constant ReturnTypeWillChange not found\\.$#"
100-
count: 1
101-
path: src/Definition/Argument.php
102-
10388
-
10489
message: "#^Method Overblog\\\\GraphQLBundle\\\\Definition\\\\Builder\\\\TypeFactory\\:\\:create\\(\\) should return GraphQL\\\\Type\\\\Definition\\\\Type but returns object\\.$#"
10590
count: 1
@@ -121,9 +106,14 @@ parameters:
121106
path: src/DependencyInjection/Compiler/ConfigParserPass.php
122107

123108
-
124-
message: "#^Parameter \\#2 \\$nodes of class GraphQL\\\\Error\\\\Error constructor expects GraphQL\\\\Language\\\\AST\\\\Node\\|\\(iterable\\<GraphQL\\\\Language\\\\AST\\\\Node\\>&Traversable\\)\\|null, array\\<GraphQL\\\\Language\\\\AST\\\\Node\\>\\|null given\\.$#"
109+
message: "#^Parameter \\#1 \\$id of class Symfony\\\\Component\\\\DependencyInjection\\\\Reference constructor expects string, string\\|Symfony\\\\Component\\\\DependencyInjection\\\\Reference given\\.$#"
110+
count: 1
111+
path: src/DependencyInjection/Compiler/ResolverMapTaggedServiceMappingPass.php
112+
113+
-
114+
message: "#^Parameter \\#1 \\$keys of function array_fill_keys expects array, array\\|bool\\|float\\|int\\|string\\|null given\\.$#"
125115
count: 1
126-
path: src/Error/ErrorHandler.php
116+
path: src/DependencyInjection/Compiler/ResolverMapTaggedServiceMappingPass.php
127117

128118
-
129119
message: "#^Method Overblog\\\\GraphQLBundle\\\\Error\\\\ExceptionConverter\\:\\:convertException\\(\\) should return Throwable but returns object\\.$#"
@@ -235,11 +225,6 @@ parameters:
235225
count: 1
236226
path: tests/Config/Parser/fixtures/annotations/Type/Animal.php
237227

238-
-
239-
message: "#^Missing parameter \\$name \\(string\\|null\\) in call to Overblog\\\\GraphQLBundle\\\\Annotation\\\\TypeInterface constructor\\.$#"
240-
count: 1
241-
path: tests/Config/Parser/fixtures/annotations/Type/Character.php
242-
243228
-
244229
message: "#^Parameter \\#1 \\$exceptionMap of class Overblog\\\\GraphQLBundle\\\\Error\\\\ExceptionConverter constructor expects array\\<string, string\\>, array\\<string, array\\<string\\>\\> given\\.$#"
245230
count: 1
@@ -266,7 +251,7 @@ parameters:
266251
path: tests/ExpressionLanguage/TestCase.php
267252

268253
-
269-
message: "#^Parameter \\#1 \\$.* of function call_user_func_array expects callable\\(\\)\\: mixed, array\\{mixed, 'with'\\} given\\.$#"
254+
message: "#^Parameter \\#1 \\$callback of function call_user_func_array expects callable\\(\\)\\: mixed, array\\{mixed, 'with'\\} given\\.$#"
270255
count: 1
271256
path: tests/ExpressionLanguage/TestCase.php
272257

@@ -361,7 +346,7 @@ parameters:
361346
path: tests/Relay/Connection/AbstractConnectionBuilderTest.php
362347

363348
-
364-
message: "#^Parameter \\#1 \\$.* of function count expects array\\|Countable, iterable\\<Overblog\\\\GraphQLBundle\\\\Relay\\\\Connection\\\\EdgeInterface\\> given\\.$#"
349+
message: "#^Parameter \\#1 \\$value of function count expects array\\|Countable, iterable\\<Overblog\\\\GraphQLBundle\\\\Relay\\\\Connection\\\\EdgeInterface\\> given\\.$#"
365350
count: 1
366351
path: tests/Relay/Connection/AbstractConnectionBuilderTest.php
367352

phpunit.xml.dist

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

2626
<php>
2727
<ini name="error_reporting" value="-1" />
28-
<env name="SYMFONY_DEPRECATIONS_HELPER" value="999999" />
28+
<env name="SYMFONY_DEPRECATIONS_HELPER" value="max[direct]=0" />
2929
</php>
3030
<listeners>
3131
<listener class="Symfony\Bridge\PhpUnit\SymfonyTestsListener" />

src/Annotation/Enum.php

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,23 +22,11 @@ final class Enum extends Annotation
2222
*/
2323
public ?string $name;
2424

25-
/**
26-
* @var array<\Overblog\GraphQLBundle\Annotation\EnumValue>
27-
*
28-
* @deprecated
29-
*/
30-
public array $values;
31-
3225
/**
3326
* @param string|null $name The GraphQL name of the enum
34-
* @param array<EnumValue> $values An array of @GQL\EnumValue @deprecated
3527
*/
36-
public function __construct(?string $name = null, array $values = [])
28+
public function __construct(?string $name = null)
3729
{
3830
$this->name = $name;
39-
$this->values = $values;
40-
if (!empty($values)) {
41-
@trigger_error('The attributes "values" on annotation @GQL\Enum is deprecated as of 0.14 and will be removed in 1.0. Use the @GQL\EnumValue annotation on the class itself instead.', E_USER_DEPRECATED);
42-
}
4331
}
4432
}

src/Annotation/Field.php

Lines changed: 4 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -27,38 +27,11 @@ class Field extends Annotation
2727
*/
2828
public ?string $type;
2929

30-
/**
31-
* Field arguments.
32-
*
33-
* @var array<\Overblog\GraphQLBundle\Annotation\Arg>
34-
*
35-
* @deprecated
36-
*/
37-
public array $args = [];
38-
3930
/**
4031
* Resolver for this property.
4132
*/
4233
public ?string $resolve;
4334

44-
/**
45-
* Args builder.
46-
*
47-
* @var mixed
48-
*
49-
* @deprecated
50-
*/
51-
public $argsBuilder;
52-
53-
/**
54-
* Field builder.
55-
*
56-
* @var mixed
57-
*
58-
* @deprecated
59-
*/
60-
public $fieldBuilder;
61-
6235
/**
6336
* Complexity expression.
6437
*
@@ -69,39 +42,18 @@ class Field extends Annotation
6942
/**
7043
* @param string|null $name The GraphQL name of the field
7144
* @param string|null $type The GraphQL type of the field
72-
* @param array $args An array of @GQL\Arg to describe arguments @deprecated
7345
* @param string|null $resolve A expression resolver to resolve the field value
74-
* @param mixed|null $argsBuilder A @GQL\ArgsBuilder to generate arguments @deprecated
75-
* @param mixed|null $fieldBuilder A @GQL\FieldBuilder to generate the field @deprecated
7646
* @param string|null $complexity A complexity expression
7747
*/
7848
public function __construct(
79-
string $name = null,
80-
string $type = null,
81-
array $args = [],
82-
string $resolve = null,
83-
$argsBuilder = null,
84-
$fieldBuilder = null,
85-
string $complexity = null
49+
?string $name = null,
50+
?string $type = null,
51+
?string $resolve = null,
52+
?string $complexity = null
8653
) {
8754
$this->name = $name;
8855
$this->type = $type;
89-
$this->args = $args;
9056
$this->resolve = $resolve;
91-
$this->argsBuilder = $argsBuilder;
92-
$this->fieldBuilder = $fieldBuilder;
9357
$this->complexity = $complexity;
94-
95-
if (null !== $argsBuilder) {
96-
@trigger_error('The attributes "argsBuilder" on annotation @GQL\Field is deprecated as of 0.14 and will be removed in 1.0. Use a @ArgsBuilder annotation on the property or method instead.', E_USER_DEPRECATED);
97-
}
98-
99-
if (null !== $fieldBuilder) {
100-
@trigger_error('The attributes "fieldBuilder" on annotation @GQL\Field is deprecated as of 0.14 and will be removed in 1.0. Use a @FieldBuilder annotation on the property or method instead.', E_USER_DEPRECATED);
101-
}
102-
103-
if (!empty($args)) {
104-
@trigger_error('The attributes "args" on annotation @GQL\Field is deprecated as of 0.14 and will be removed in 1.0. Use the @Arg annotation on the property or method instead.', E_USER_DEPRECATED);
105-
}
10658
}
10759
}

src/Annotation/Mutation.php

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,25 +28,17 @@ final class Mutation extends Field
2828
* {@inheritdoc}
2929
*
3030
* @param string|string[]|null $targetTypes
31-
* @param string|string[]|null $targetType @deprecated
3231
*/
3332
public function __construct(
3433
?string $name = null,
3534
?string $type = null,
36-
array $args = [],
3735
?string $resolve = null,
38-
$argsBuilder = null,
39-
$fieldBuilder = null,
4036
?string $complexity = null,
41-
$targetTypes = null,
42-
$targetType = null
37+
array|string|null $targetTypes = null
4338
) {
44-
parent::__construct($name, $type, $args, $resolve, $argsBuilder, $fieldBuilder, $complexity);
39+
parent::__construct($name, $type, $resolve, $complexity);
4540
if ($targetTypes) {
4641
$this->targetTypes = is_string($targetTypes) ? [$targetTypes] : $targetTypes;
47-
} elseif ($targetType) {
48-
$this->targetTypes = is_string($targetType) ? [$targetType] : $targetType;
49-
@trigger_error('The attributes "targetType" on annotation @GQL\Mutation is deprecated as of 0.14 and will be removed in 1.0. Use the "targetTypes" attributes instead.', E_USER_DEPRECATED);
5042
}
5143
}
5244
}

src/Annotation/Query.php

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -28,25 +28,17 @@ final class Query extends Field
2828
* {@inheritdoc}
2929
*
3030
* @param string|string[]|null $targetTypes
31-
* @param string|string[]|null $targetType
3231
*/
3332
public function __construct(
34-
string $name = null,
35-
string $type = null,
36-
array $args = [],
37-
string $resolve = null,
38-
$argsBuilder = null,
39-
$fieldBuilder = null,
40-
string $complexity = null,
41-
$targetTypes = null,
42-
$targetType = null
33+
?string $name = null,
34+
?string $type = null,
35+
?string $resolve = null,
36+
?string $complexity = null,
37+
array|string|null $targetTypes = null
4338
) {
44-
parent::__construct($name, $type, $args, $resolve, $argsBuilder, $fieldBuilder, $complexity);
39+
parent::__construct($name, $type, $resolve, $complexity);
4540
if ($targetTypes) {
4641
$this->targetTypes = is_string($targetTypes) ? [$targetTypes] : $targetTypes;
47-
} elseif ($targetType) {
48-
$this->targetTypes = is_string($targetType) ? [$targetType] : $targetType;
49-
@trigger_error('The attributes "targetType" on annotation @GQL\Query is deprecated as of 0.14 and will be removed in 1.0. Use the "targetTypes" attributes instead.', E_USER_DEPRECATED);
5042
}
5143
}
5244
}

src/Annotation/Type.php

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,6 @@ class Type extends Annotation
3939
*/
4040
public ?string $resolveField;
4141

42-
/**
43-
* List of fields builder.
44-
*
45-
* @var array<\Overblog\GraphQLBundle\Annotation\FieldsBuilder>
46-
*
47-
* @deprecated
48-
*/
49-
public array $builders = [];
50-
5142
/**
5243
* Expression to resolve type for interfaces.
5344
*/
@@ -58,26 +49,19 @@ class Type extends Annotation
5849
* @param string[] $interfaces List of GraphQL interfaces implemented by the type
5950
* @param bool $isRelay Set to true to make the type compatible with relay
6051
* @param string|null $resolveField An expression to resolve the field value
61-
* @param array<FieldsBuilder> $builders A list of fields builder to use @deprecated
6252
* @param string|null $isTypeOf An expression to resolve if the field is of given type
6353
*/
6454
public function __construct(
6555
string $name = null,
6656
array $interfaces = [],
6757
bool $isRelay = false,
6858
string $resolveField = null,
69-
string $isTypeOf = null,
70-
array $builders = []
59+
string $isTypeOf = null
7160
) {
7261
$this->name = $name;
7362
$this->interfaces = $interfaces;
7463
$this->isRelay = $isRelay;
7564
$this->resolveField = $resolveField;
7665
$this->isTypeOf = $isTypeOf;
77-
$this->builders = $builders;
78-
79-
if (!empty($builders)) {
80-
@trigger_error('The attributes "builders" on annotation @GQL\Type is deprecated as of 0.14 and will be removed in 1.0. Use the @FieldsBuilder directly on the class itself.', E_USER_DEPRECATED);
81-
}
8266
}
8367
}

0 commit comments

Comments
 (0)