From 655448177b31f65e262c47016e29080c89e41b0f Mon Sep 17 00:00:00 2001 From: Simon Podlipsky Date: Sat, 4 Jul 2026 12:40:03 +0300 Subject: [PATCH 1/2] Apply PHP CS Fixer updates (#1940) --- tests/Executor/AbstractTest.php | 4 ++-- tests/Executor/ExecutorTest.php | 6 +++--- tests/Type/LazyDefinitionTest.php | 2 +- tests/Type/ScalarSerializationTest.php | 2 +- tests/Validator/CustomRuleTest.php | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/tests/Executor/AbstractTest.php b/tests/Executor/AbstractTest.php index 097074e42..6c342284f 100644 --- a/tests/Executor/AbstractTest.php +++ b/tests/Executor/AbstractTest.php @@ -460,14 +460,14 @@ public static function dogCatRootValues(): iterable ], ]; yield [ - new class() { + new class { public string $__typename = 'Dog'; public string $name = 'Odie'; public bool $woofs = true; }, - new class() { + new class { public string $__typename = 'Cat'; public string $name = 'Garfield'; diff --git a/tests/Executor/ExecutorTest.php b/tests/Executor/ExecutorTest.php index 812c33d4a..ffee65d0b 100644 --- a/tests/Executor/ExecutorTest.php +++ b/tests/Executor/ExecutorTest.php @@ -1223,7 +1223,7 @@ public function testDefaultResolverGrabsValuesOffOfCommonPhpDataStructures(): vo ], 'arrayAccess' => [ 'type' => $ArrayAccess, - 'resolve' => static fn (): \ArrayAccess => new class() implements \ArrayAccess { + 'resolve' => static fn (): \ArrayAccess => new class implements \ArrayAccess { /** @param mixed $offset */ #[\ReturnTypeWillChange] public function offsetExists($offset): bool @@ -1271,7 +1271,7 @@ public function offsetUnset($offset): void {} ], 'objectField' => [ 'type' => $ObjectField, - 'resolve' => static fn (): \stdClass => new class() extends \stdClass { + 'resolve' => static fn (): \stdClass => new class extends \stdClass { public ?int $set = 1; public ?int $unset; @@ -1279,7 +1279,7 @@ public function offsetUnset($offset): void {} ], 'objectVirtual' => [ 'type' => $ObjectVirtual, - 'resolve' => static fn (): object => new class() { + 'resolve' => static fn (): object => new class { public function __isset(string $name): bool { switch ($name) { diff --git a/tests/Type/LazyDefinitionTest.php b/tests/Type/LazyDefinitionTest.php index 228276295..d7a466efc 100644 --- a/tests/Type/LazyDefinitionTest.php +++ b/tests/Type/LazyDefinitionTest.php @@ -53,7 +53,7 @@ public function testAllowsTypeWhichDefinesItFieldsAsInvokableClassReturningField $objType = new ObjectType([ 'name' => 'SomeObject', 'fields' => [ - 'f' => new class() { + 'f' => new class { /** * @throws InvariantViolation * diff --git a/tests/Type/ScalarSerializationTest.php b/tests/Type/ScalarSerializationTest.php index 8221c9a45..ca5842ed4 100644 --- a/tests/Type/ScalarSerializationTest.php +++ b/tests/Type/ScalarSerializationTest.php @@ -111,7 +111,7 @@ public function testSerializesOutputAsString(): void self::assertSame('1', $stringType->serialize(true)); self::assertSame('', $stringType->serialize(false)); self::assertSame('', $stringType->serialize(null)); - self::assertSame('foo', $stringType->serialize(new class() implements \Stringable { + self::assertSame('foo', $stringType->serialize(new class implements \Stringable { public function __toString(): string { return 'foo'; diff --git a/tests/Validator/CustomRuleTest.php b/tests/Validator/CustomRuleTest.php index e40dc1fe6..098b68f15 100644 --- a/tests/Validator/CustomRuleTest.php +++ b/tests/Validator/CustomRuleTest.php @@ -16,7 +16,7 @@ final class CustomRuleTest extends ValidatorTestCase public function testAddRuleCanReplaceDefaultRules(): void { - DocumentValidator::addRule(new class() extends ExecutableDefinitions { + DocumentValidator::addRule(new class extends ExecutableDefinitions { public function getName(): string { return ExecutableDefinitions::class; From 91343b7d064b82aee6532beab9b29d15abef8c9c Mon Sep 17 00:00:00 2001 From: Simon Podlipsky Date: Sat, 4 Jul 2026 12:13:27 +0300 Subject: [PATCH 2/2] fix: reference amphp types by FQN in Promise @var Promise imported `Amp\Future` and `Amp\Promise` solely for the docblock `@var` union. amphp/amp v2 ships `Amp\Promise` and v3 ships `Amp\Future`, so on any single install one imported symbol is absent, and a `use` of a missing class breaks static analysis. Reference the amphp types by fully-qualified name in the `@var` and drop the imports. --- src/Executor/Promise/Promise.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/Executor/Promise/Promise.php b/src/Executor/Promise/Promise.php index 42c307b28..b2bf84c30 100644 --- a/src/Executor/Promise/Promise.php +++ b/src/Executor/Promise/Promise.php @@ -2,8 +2,6 @@ namespace GraphQL\Executor\Promise; -use Amp\Future as AmpFuture; -use Amp\Promise as AmpPromise; use GraphQL\Error\InvariantViolation; use GraphQL\Executor\Promise\Adapter\SyncPromise; use React\Promise\PromiseInterface as ReactPromise; @@ -13,7 +11,7 @@ */ class Promise { - /** @var SyncPromise|ReactPromise|AmpFuture|AmpPromise */ + /** @var SyncPromise|ReactPromise|\Amp\Future|\Amp\Promise */ public $adoptedPromise; private PromiseAdapter $adapter;