Skip to content

Commit e3866e8

Browse files
committed
Add ReturnTypeWillChange to suppress PHP 8.1 deprecation
Reported by Symfony PHPUnit Bridge.
1 parent 8d5a5aa commit e3866e8

File tree

5 files changed

+14
-1
lines changed

5 files changed

+14
-1
lines changed

src/Definition/Argument.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
namespace Overblog\GraphQLBundle\Definition;
66

7+
use ReturnTypeWillChange;
78
use function array_key_exists;
89
use function count;
910

@@ -42,7 +43,7 @@ public function offsetExists($offset): bool
4243
*
4344
* @return mixed|null
4445
*/
45-
#[\ReturnTypeWillChange]
46+
#[ReturnTypeWillChange]
4647
public function offsetGet($offset)
4748
{
4849
// TODO 1.0: Drop PHP 7.4 support and add mixed return type.

src/Definition/Type/CustomScalarType.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use GraphQL\Type\Definition\CustomScalarType as BaseCustomScalarType;
88
use GraphQL\Type\Definition\ScalarType;
99
use GraphQL\Utils\Utils;
10+
use ReturnTypeWillChange;
1011
use function call_user_func;
1112
use function is_callable;
1213
use function sprintf;
@@ -25,6 +26,7 @@ public function __construct(array $config = [])
2526
/**
2627
* {@inheritdoc}
2728
*/
29+
#[ReturnTypeWillChange]
2830
public function serialize($value)
2931
{
3032
return $this->call('serialize', $value);
@@ -33,6 +35,7 @@ public function serialize($value)
3335
/**
3436
* {@inheritdoc}
3537
*/
38+
#[ReturnTypeWillChange]
3639
public function parseValue($value)
3740
{
3841
return $this->call('parseValue', $value);
@@ -41,6 +44,7 @@ public function parseValue($value)
4144
/**
4245
* {@inheritdoc}
4346
*/
47+
#[ReturnTypeWillChange]
4448
public function parseLiteral(/* GraphQL\Language\AST\ValueNode */ $valueNode, array $variables = null)
4549
{
4650
return $this->call('parseLiteral', $valueNode);

src/Upload/Type/GraphQLUploadType.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
use GraphQL\Error\InvariantViolation;
88
use GraphQL\Type\Definition\ScalarType;
9+
use ReturnTypeWillChange;
910
use Symfony\Component\HttpFoundation\File\File;
1011
use function get_class;
1112
use function gettype;
@@ -31,6 +32,7 @@ public function __construct(string $name = null)
3132
/**
3233
* {@inheritdoc}
3334
*/
35+
#[ReturnTypeWillChange]
3436
public function parseValue($value)
3537
{
3638
if (null !== $value && !$value instanceof File) {

src/Validator/Mapping/PropertyMetadata.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
use ReflectionException;
88
use ReflectionProperty;
9+
use ReturnTypeWillChange;
910
use Symfony\Component\Validator\Mapping\MemberMetadata;
1011

1112
class PropertyMetadata extends MemberMetadata
@@ -28,6 +29,7 @@ protected function newReflectionMember($object): ReflectionProperty
2829
return $member;
2930
}
3031

32+
#[ReturnTypeWillChange]
3133
public function getPropertyValue($object)
3234
{
3335
return $this->getReflectionMember($object)->getValue($object);

tests/Functional/App/Type/YearScalarType.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use GraphQL\Error\Error;
88
use GraphQL\Language\AST\StringValueNode;
99
use GraphQL\Type\Definition\ScalarType;
10+
use ReturnTypeWillChange;
1011
use function sprintf;
1112
use function str_replace;
1213

@@ -15,6 +16,7 @@ class YearScalarType extends ScalarType
1516
/**
1617
* {@inheritdoc}
1718
*/
19+
#[ReturnTypeWillChange]
1820
public function serialize($value)
1921
{
2022
return sprintf('%s AC', $value);
@@ -23,6 +25,7 @@ public function serialize($value)
2325
/**
2426
* {@inheritdoc}
2527
*/
28+
#[ReturnTypeWillChange]
2629
public function parseValue($value)
2730
{
2831
return (int) str_replace(' AC', '', $value);
@@ -31,6 +34,7 @@ public function parseValue($value)
3134
/**
3235
* {@inheritdoc}
3336
*/
37+
#[ReturnTypeWillChange]
3438
public function parseLiteral($valueNode, array $variables = null)
3539
{
3640
if (!$valueNode instanceof StringValueNode) {

0 commit comments

Comments
 (0)