Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix compatiblity of methods with native return type in PHP 8.1 #1011

Merged
merged 1 commit into from
Nov 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/Error/Error.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use GraphQL\Language\Source;
use GraphQL\Language\SourceLocation;
use JsonSerializable;
use ReturnTypeWillChange;
use Throwable;
use Traversable;

Expand Down Expand Up @@ -299,6 +300,7 @@ public function getExtensions(): ?array
* @return array<string, mixed> data which can be serialized by <b>json_encode</b>,
* which is a value of any type other than a resource.
*/
#[ReturnTypeWillChange]
public function jsonSerialize(): array
{
return FormattedError::createFromException($this);
Expand Down
2 changes: 2 additions & 0 deletions src/Language/SourceLocation.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace GraphQL\Language;

use JsonSerializable;
use ReturnTypeWillChange;

class SourceLocation implements JsonSerializable
{
Expand Down Expand Up @@ -40,6 +41,7 @@ public function toSerializableArray(): array
/**
* @return array{line: int, column: int}
*/
#[ReturnTypeWillChange]
public function jsonSerialize(): array
{
return $this->toArray();
Expand Down
2 changes: 2 additions & 0 deletions src/Type/Definition/Type.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
use GraphQL\Utils\Utils;
use JsonSerializable;
use ReflectionClass;
use ReturnTypeWillChange;

use function array_keys;
use function array_merge;
Expand Down Expand Up @@ -287,6 +288,7 @@ public function assertValid(): void
Utils::assertValidName($this->name);
}

#[ReturnTypeWillChange]
public function jsonSerialize(): string
{
return $this->toString();
Expand Down