From f5f6dd8c509ac78967d2a5566115da54bd72130d Mon Sep 17 00:00:00 2001 From: Benedikt Franke Date: Tue, 21 Feb 2023 18:44:15 +0100 Subject: [PATCH 01/14] Update webonyx/graphql-php --- composer.json | 2 +- tests/Unit/Schema/ResolverProviderTest.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 5015a1e66e..d5d64afd54 100644 --- a/composer.json +++ b/composer.json @@ -40,7 +40,7 @@ "illuminate/validation": "^9 || ^10", "laragraph/utils": "^1.5", "thecodingmachine/safe": "^1 || ^2", - "webonyx/graphql-php": "^15" + "webonyx/graphql-php": "dev-master as 15.1.1" }, "require-dev": { "algolia/algoliasearch-client-php": "^3 || ^4", diff --git a/tests/Unit/Schema/ResolverProviderTest.php b/tests/Unit/Schema/ResolverProviderTest.php index acafa2f2a7..dda31c0e14 100644 --- a/tests/Unit/Schema/ResolverProviderTest.php +++ b/tests/Unit/Schema/ResolverProviderTest.php @@ -75,7 +75,7 @@ protected function constructFieldValue(string $fieldDefinition, string $parentTy return new FieldValue( $typeValue, - $queryType->fields[0] + $queryType->fields->get(0) ); } } From 4fa8d51dff4fdb9780d38af9f6bc41f8b6590883 Mon Sep 17 00:00:00 2001 From: Benedikt Franke Date: Tue, 21 Feb 2023 20:17:33 +0100 Subject: [PATCH 02/14] fix --- tests/Unit/Schema/Directives/BaseDirectiveTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Unit/Schema/Directives/BaseDirectiveTest.php b/tests/Unit/Schema/Directives/BaseDirectiveTest.php index dfc25f4050..e509bd52c7 100644 --- a/tests/Unit/Schema/Directives/BaseDirectiveTest.php +++ b/tests/Unit/Schema/Directives/BaseDirectiveTest.php @@ -212,7 +212,7 @@ public function __call(string $method, array $args) }; $directive->hydrate( - $fieldDefinition->directives[0], + $fieldDefinition->directives->get(0), $fieldDefinition ); From d5c128abb709f069942c488e967aac75f6a8e343 Mon Sep 17 00:00:00 2001 From: Benedikt Franke Date: Wed, 22 Feb 2023 09:48:00 +0100 Subject: [PATCH 03/14] switch branch --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index d5d64afd54..764147c824 100644 --- a/composer.json +++ b/composer.json @@ -40,7 +40,7 @@ "illuminate/validation": "^9 || ^10", "laragraph/utils": "^1.5", "thecodingmachine/safe": "^1 || ^2", - "webonyx/graphql-php": "dev-master as 15.1.1" + "webonyx/graphql-php": "dev-nodelist-array-access as 15.1.1" }, "require-dev": { "algolia/algoliasearch-client-php": "^3 || ^4", From 79a265737257c10bcbbd0927bf3b571c7209bc00 Mon Sep 17 00:00:00 2001 From: spawnia Date: Tue, 10 Feb 2026 13:16:54 +0100 Subject: [PATCH 04/14] Preserve composer override and normalize GraphQL test literals to #2748 --- composer.json | 2 +- .../Schema/Directives/BaseDirectiveTest.php | 28 +++++++++---------- tests/Unit/Schema/ResolverProviderTest.php | 4 +-- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/composer.json b/composer.json index 85b6ca3f4d..ed87abbb47 100644 --- a/composer.json +++ b/composer.json @@ -40,7 +40,7 @@ "illuminate/validation": "^9 || ^10 || ^11 || ^12", "laragraph/utils": "^1.5 || ^2", "thecodingmachine/safe": "^1 || ^2 || ^3", - "webonyx/graphql-php": "^15" + "webonyx/graphql-php": "dev-nodelist-array-access as 15.1.1" }, "require-dev": { "algolia/algoliasearch-client-php": "^3", diff --git a/tests/Unit/Schema/Directives/BaseDirectiveTest.php b/tests/Unit/Schema/Directives/BaseDirectiveTest.php index e509bd52c7..5c25219ca0 100644 --- a/tests/Unit/Schema/Directives/BaseDirectiveTest.php +++ b/tests/Unit/Schema/Directives/BaseDirectiveTest.php @@ -25,11 +25,11 @@ final class BaseDirectiveTest extends TestCase { public function testGetsModelClassFromDirective(): void { - $this->schema .= /** @lang GraphQL */ ' + $this->schema .= /** @lang GraphQL */ <<<'GRAPHQL' type User @model(class: "Team") { id: ID } - '; + GRAPHQL; $directive = $this->constructFieldDirective('foo: User @dummy'); @@ -41,11 +41,11 @@ public function testGetsModelClassFromDirective(): void public function testDefaultsToFieldTypeForTheModelClass(): void { - $this->schema .= /** @lang GraphQL */ ' + $this->schema .= /** @lang GraphQL */ <<<'GRAPHQL' type User { id: ID } - '; + GRAPHQL; $directive = $this->constructFieldDirective('foo: User @dummy'); @@ -75,11 +75,11 @@ public function testBuiltInTypeTolerated(): void public function testThrowsIfTheClassIsNotAModel(): void { - $this->schema .= /** @lang GraphQL */ ' + $this->schema .= /** @lang GraphQL */ <<<'GRAPHQL' type Exception { id: ID } - '; + GRAPHQL; $directive = $this->constructFieldDirective('foo: Exception @dummy'); @@ -89,11 +89,11 @@ public function testThrowsIfTheClassIsNotAModel(): void public function testResolvesAModelThatIsNamedLikeABaseClass(): void { - $this->schema .= /** @lang GraphQL */ ' + $this->schema .= /** @lang GraphQL */ <<<'GRAPHQL' type Closure { id: ID } - '; + GRAPHQL; $directive = $this->constructFieldDirective('foo: Closure @dummy'); @@ -105,11 +105,11 @@ public function testResolvesAModelThatIsNamedLikeABaseClass(): void public function testPrefersThePrimaryModelNamespace(): void { - $this->schema .= /** @lang GraphQL */ ' + $this->schema .= /** @lang GraphQL */ <<<'GRAPHQL' type Category { id: ID } - '; + GRAPHQL; $directive = $this->constructFieldDirective('foo: Category @dummy'); @@ -121,11 +121,11 @@ public function testPrefersThePrimaryModelNamespace(): void public function testAllowsOverwritingTheDefaultModel(): void { - $this->schema .= /** @lang GraphQL */ ' + $this->schema .= /** @lang GraphQL */ <<<'GRAPHQL' type OnlyHere { id: ID } - '; + GRAPHQL; $directive = $this->constructFieldDirective('foo: OnlyHere @dummy(model: "Tests\\\Utils\\\ModelsSecondary\\\Category")'); @@ -137,11 +137,11 @@ public function testAllowsOverwritingTheDefaultModel(): void public function testResolvesFromTheSecondaryModelNamespace(): void { - $this->schema .= /** @lang GraphQL */ ' + $this->schema .= /** @lang GraphQL */ <<<'GRAPHQL' type OnlyHere { id: ID } - '; + GRAPHQL; $directive = $this->constructFieldDirective('foo: OnlyHere @dummy'); diff --git a/tests/Unit/Schema/ResolverProviderTest.php b/tests/Unit/Schema/ResolverProviderTest.php index c25d3091ba..bec0b98ab4 100644 --- a/tests/Unit/Schema/ResolverProviderTest.php +++ b/tests/Unit/Schema/ResolverProviderTest.php @@ -58,11 +58,11 @@ public function testThrowsIfRootFieldHasNoResolver(): void protected function constructFieldValue(string $fieldDefinition, string $parentTypeName = RootType::QUERY): FieldValue { - $queryType = Parser::objectTypeDefinition(/** @lang GraphQL */ " + $queryType = Parser::objectTypeDefinition(/** @lang GraphQL */ << Date: Tue, 10 Feb 2026 13:17:48 +0100 Subject: [PATCH 05/14] Normalize GraphQL test literals to #2748 after merging master --- tests/Unit/Schema/Directives/BaseDirectiveTest.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/Unit/Schema/Directives/BaseDirectiveTest.php b/tests/Unit/Schema/Directives/BaseDirectiveTest.php index 5c25219ca0..25f779d394 100644 --- a/tests/Unit/Schema/Directives/BaseDirectiveTest.php +++ b/tests/Unit/Schema/Directives/BaseDirectiveTest.php @@ -195,7 +195,9 @@ protected function constructFieldDirective(string $definition): BaseDirective $directive = new class() extends BaseDirective { public static function definition(): string { - return /** @lang GraphQL */ 'directive @base on FIELD_DEFINITION'; + return /** @lang GraphQL */ <<<'GRAPHQL' +directive @base on FIELD_DEFINITION +GRAPHQL; } /** From 9d8511222d83a0b43ddd780c22025c17f050dad6 Mon Sep 17 00:00:00 2001 From: spawnia Date: Tue, 10 Feb 2026 12:19:19 +0000 Subject: [PATCH 06/14] Apply php-cs-fixer changes --- .../Schema/Directives/BaseDirectiveTest.php | 24 +++++++++---------- tests/Unit/Schema/ResolverProviderTest.php | 8 +++---- 2 files changed, 15 insertions(+), 17 deletions(-) diff --git a/tests/Unit/Schema/Directives/BaseDirectiveTest.php b/tests/Unit/Schema/Directives/BaseDirectiveTest.php index 25f779d394..926644fa94 100644 --- a/tests/Unit/Schema/Directives/BaseDirectiveTest.php +++ b/tests/Unit/Schema/Directives/BaseDirectiveTest.php @@ -1,4 +1,4 @@ -assertSame( Team::class, - $directive->getModelClass() + $directive->getModelClass(), ); } @@ -51,7 +51,7 @@ public function testDefaultsToFieldTypeForTheModelClass(): void $this->assertSame( User::class, - $directive->getModelClass() + $directive->getModelClass(), ); } @@ -69,7 +69,7 @@ public function testBuiltInTypeTolerated(): void $this->assertSame( Team::class, - $directive->getModelClass() + $directive->getModelClass(), ); } @@ -99,7 +99,7 @@ public function testResolvesAModelThatIsNamedLikeABaseClass(): void $this->assertSame( Closure::class, - $directive->getModelClass() + $directive->getModelClass(), ); } @@ -115,7 +115,7 @@ public function testPrefersThePrimaryModelNamespace(): void $this->assertSame( Category::class, - $directive->getModelClass() + $directive->getModelClass(), ); } @@ -131,7 +131,7 @@ public function testAllowsOverwritingTheDefaultModel(): void $this->assertSame( CategorySecondary::class, - $directive->getModelClass() + $directive->getModelClass(), ); } @@ -147,7 +147,7 @@ public function testResolvesFromTheSecondaryModelNamespace(): void $this->assertSame( OnlyHere::class, - $directive->getModelClass() + $directive->getModelClass(), ); } @@ -158,13 +158,13 @@ public function testGetsArgumentFromDirective(): void $this->assertSame( 'argValue', // @phpstan-ignore-next-line protected method is called via wrapper below - $directive->directiveArgValue('argName') + $directive->directiveArgValue('argName'), ); $this->assertSame( 'argValue2', // @phpstan-ignore-next-line protected method is called via wrapper below - $directive->directiveArgValue('argName2') + $directive->directiveArgValue('argName2'), ); } @@ -182,7 +182,7 @@ public function testMutuallyExclusive(): void $directive = $this->constructFieldDirective('foo: ID @dummy(bar: 1, baz: 2)'); $this->expectExceptionObject( - new DefinitionException('The arguments [bar, baz, qux] for @base are mutually exclusive, found [bar, baz] on foo.') + new DefinitionException('The arguments [bar, baz, qux] for @base are mutually exclusive, found [bar, baz] on foo.'), ); // @phpstan-ignore-next-line protected method is called via wrapper below $directive->validateMutuallyExclusiveArguments(['bar', 'baz', 'qux']); @@ -215,7 +215,7 @@ public function __call(string $method, array $args) $directive->hydrate( $fieldDefinition->directives->get(0), - $fieldDefinition + $fieldDefinition, ); return $directive; diff --git a/tests/Unit/Schema/ResolverProviderTest.php b/tests/Unit/Schema/ResolverProviderTest.php index bec0b98ab4..16f7359b8f 100644 --- a/tests/Unit/Schema/ResolverProviderTest.php +++ b/tests/Unit/Schema/ResolverProviderTest.php @@ -1,4 +1,4 @@ -fields->get(0) + $queryType->fields->get(0), ); } } From 9551e7c76038d8d86bfa4cc07f238e7cbdfd7f94 Mon Sep 17 00:00:00 2001 From: spawnia Date: Tue, 10 Feb 2026 13:25:39 +0100 Subject: [PATCH 07/14] Restore original PR test changes without #2748 normalization --- .../Schema/Directives/BaseDirectiveTest.php | 32 +++++++++---------- tests/Unit/Schema/ResolverProviderTest.php | 4 +-- 2 files changed, 17 insertions(+), 19 deletions(-) diff --git a/tests/Unit/Schema/Directives/BaseDirectiveTest.php b/tests/Unit/Schema/Directives/BaseDirectiveTest.php index 926644fa94..d0bad4b7c5 100644 --- a/tests/Unit/Schema/Directives/BaseDirectiveTest.php +++ b/tests/Unit/Schema/Directives/BaseDirectiveTest.php @@ -25,11 +25,11 @@ final class BaseDirectiveTest extends TestCase { public function testGetsModelClassFromDirective(): void { - $this->schema .= /** @lang GraphQL */ <<<'GRAPHQL' + $this->schema .= /** @lang GraphQL */ ' type User @model(class: "Team") { id: ID } - GRAPHQL; + '; $directive = $this->constructFieldDirective('foo: User @dummy'); @@ -41,11 +41,11 @@ public function testGetsModelClassFromDirective(): void public function testDefaultsToFieldTypeForTheModelClass(): void { - $this->schema .= /** @lang GraphQL */ <<<'GRAPHQL' + $this->schema .= /** @lang GraphQL */ ' type User { id: ID } - GRAPHQL; + '; $directive = $this->constructFieldDirective('foo: User @dummy'); @@ -75,11 +75,11 @@ public function testBuiltInTypeTolerated(): void public function testThrowsIfTheClassIsNotAModel(): void { - $this->schema .= /** @lang GraphQL */ <<<'GRAPHQL' + $this->schema .= /** @lang GraphQL */ ' type Exception { id: ID } - GRAPHQL; + '; $directive = $this->constructFieldDirective('foo: Exception @dummy'); @@ -89,11 +89,11 @@ public function testThrowsIfTheClassIsNotAModel(): void public function testResolvesAModelThatIsNamedLikeABaseClass(): void { - $this->schema .= /** @lang GraphQL */ <<<'GRAPHQL' + $this->schema .= /** @lang GraphQL */ ' type Closure { id: ID } - GRAPHQL; + '; $directive = $this->constructFieldDirective('foo: Closure @dummy'); @@ -105,11 +105,11 @@ public function testResolvesAModelThatIsNamedLikeABaseClass(): void public function testPrefersThePrimaryModelNamespace(): void { - $this->schema .= /** @lang GraphQL */ <<<'GRAPHQL' + $this->schema .= /** @lang GraphQL */ ' type Category { id: ID } - GRAPHQL; + '; $directive = $this->constructFieldDirective('foo: Category @dummy'); @@ -121,11 +121,11 @@ public function testPrefersThePrimaryModelNamespace(): void public function testAllowsOverwritingTheDefaultModel(): void { - $this->schema .= /** @lang GraphQL */ <<<'GRAPHQL' + $this->schema .= /** @lang GraphQL */ ' type OnlyHere { id: ID } - GRAPHQL; + '; $directive = $this->constructFieldDirective('foo: OnlyHere @dummy(model: "Tests\\\Utils\\\ModelsSecondary\\\Category")'); @@ -137,11 +137,11 @@ public function testAllowsOverwritingTheDefaultModel(): void public function testResolvesFromTheSecondaryModelNamespace(): void { - $this->schema .= /** @lang GraphQL */ <<<'GRAPHQL' + $this->schema .= /** @lang GraphQL */ ' type OnlyHere { id: ID } - GRAPHQL; + '; $directive = $this->constructFieldDirective('foo: OnlyHere @dummy'); @@ -195,9 +195,7 @@ protected function constructFieldDirective(string $definition): BaseDirective $directive = new class() extends BaseDirective { public static function definition(): string { - return /** @lang GraphQL */ <<<'GRAPHQL' -directive @base on FIELD_DEFINITION -GRAPHQL; + return /** @lang GraphQL */ 'directive @base on FIELD_DEFINITION'; } /** diff --git a/tests/Unit/Schema/ResolverProviderTest.php b/tests/Unit/Schema/ResolverProviderTest.php index 16f7359b8f..2706009167 100644 --- a/tests/Unit/Schema/ResolverProviderTest.php +++ b/tests/Unit/Schema/ResolverProviderTest.php @@ -56,11 +56,11 @@ public function testThrowsIfRootFieldHasNoResolver(): void protected function constructFieldValue(string $fieldDefinition, string $parentTypeName = RootType::QUERY): FieldValue { - $queryType = Parser::objectTypeDefinition(/** @lang GraphQL */ << Date: Tue, 10 Feb 2026 13:43:14 +0100 Subject: [PATCH 08/14] Restore original one-line GraphQL literals in PR test files --- .../Schema/Directives/BaseDirectiveTest.php | 24 +++++++++---------- tests/Unit/Schema/ResolverProviderTest.php | 8 ++++--- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/tests/Unit/Schema/Directives/BaseDirectiveTest.php b/tests/Unit/Schema/Directives/BaseDirectiveTest.php index d0bad4b7c5..e509bd52c7 100644 --- a/tests/Unit/Schema/Directives/BaseDirectiveTest.php +++ b/tests/Unit/Schema/Directives/BaseDirectiveTest.php @@ -1,4 +1,4 @@ -assertSame( Team::class, - $directive->getModelClass(), + $directive->getModelClass() ); } @@ -51,7 +51,7 @@ public function testDefaultsToFieldTypeForTheModelClass(): void $this->assertSame( User::class, - $directive->getModelClass(), + $directive->getModelClass() ); } @@ -69,7 +69,7 @@ public function testBuiltInTypeTolerated(): void $this->assertSame( Team::class, - $directive->getModelClass(), + $directive->getModelClass() ); } @@ -99,7 +99,7 @@ public function testResolvesAModelThatIsNamedLikeABaseClass(): void $this->assertSame( Closure::class, - $directive->getModelClass(), + $directive->getModelClass() ); } @@ -115,7 +115,7 @@ public function testPrefersThePrimaryModelNamespace(): void $this->assertSame( Category::class, - $directive->getModelClass(), + $directive->getModelClass() ); } @@ -131,7 +131,7 @@ public function testAllowsOverwritingTheDefaultModel(): void $this->assertSame( CategorySecondary::class, - $directive->getModelClass(), + $directive->getModelClass() ); } @@ -147,7 +147,7 @@ public function testResolvesFromTheSecondaryModelNamespace(): void $this->assertSame( OnlyHere::class, - $directive->getModelClass(), + $directive->getModelClass() ); } @@ -158,13 +158,13 @@ public function testGetsArgumentFromDirective(): void $this->assertSame( 'argValue', // @phpstan-ignore-next-line protected method is called via wrapper below - $directive->directiveArgValue('argName'), + $directive->directiveArgValue('argName') ); $this->assertSame( 'argValue2', // @phpstan-ignore-next-line protected method is called via wrapper below - $directive->directiveArgValue('argName2'), + $directive->directiveArgValue('argName2') ); } @@ -182,7 +182,7 @@ public function testMutuallyExclusive(): void $directive = $this->constructFieldDirective('foo: ID @dummy(bar: 1, baz: 2)'); $this->expectExceptionObject( - new DefinitionException('The arguments [bar, baz, qux] for @base are mutually exclusive, found [bar, baz] on foo.'), + new DefinitionException('The arguments [bar, baz, qux] for @base are mutually exclusive, found [bar, baz] on foo.') ); // @phpstan-ignore-next-line protected method is called via wrapper below $directive->validateMutuallyExclusiveArguments(['bar', 'baz', 'qux']); @@ -213,7 +213,7 @@ public function __call(string $method, array $args) $directive->hydrate( $fieldDefinition->directives->get(0), - $fieldDefinition, + $fieldDefinition ); return $directive; diff --git a/tests/Unit/Schema/ResolverProviderTest.php b/tests/Unit/Schema/ResolverProviderTest.php index 2706009167..c25d3091ba 100644 --- a/tests/Unit/Schema/ResolverProviderTest.php +++ b/tests/Unit/Schema/ResolverProviderTest.php @@ -1,4 +1,4 @@ -fields->get(0), + $queryType->fields->get(0) ); } } From 0630f70ee61a637c726873581029bc4303fb8c93 Mon Sep 17 00:00:00 2001 From: spawnia Date: Tue, 10 Feb 2026 12:44:02 +0000 Subject: [PATCH 09/14] Apply php-cs-fixer changes --- .../Schema/Directives/BaseDirectiveTest.php | 24 +++++++++---------- tests/Unit/Schema/ResolverProviderTest.php | 8 +++---- 2 files changed, 15 insertions(+), 17 deletions(-) diff --git a/tests/Unit/Schema/Directives/BaseDirectiveTest.php b/tests/Unit/Schema/Directives/BaseDirectiveTest.php index e509bd52c7..d0bad4b7c5 100644 --- a/tests/Unit/Schema/Directives/BaseDirectiveTest.php +++ b/tests/Unit/Schema/Directives/BaseDirectiveTest.php @@ -1,4 +1,4 @@ -assertSame( Team::class, - $directive->getModelClass() + $directive->getModelClass(), ); } @@ -51,7 +51,7 @@ public function testDefaultsToFieldTypeForTheModelClass(): void $this->assertSame( User::class, - $directive->getModelClass() + $directive->getModelClass(), ); } @@ -69,7 +69,7 @@ public function testBuiltInTypeTolerated(): void $this->assertSame( Team::class, - $directive->getModelClass() + $directive->getModelClass(), ); } @@ -99,7 +99,7 @@ public function testResolvesAModelThatIsNamedLikeABaseClass(): void $this->assertSame( Closure::class, - $directive->getModelClass() + $directive->getModelClass(), ); } @@ -115,7 +115,7 @@ public function testPrefersThePrimaryModelNamespace(): void $this->assertSame( Category::class, - $directive->getModelClass() + $directive->getModelClass(), ); } @@ -131,7 +131,7 @@ public function testAllowsOverwritingTheDefaultModel(): void $this->assertSame( CategorySecondary::class, - $directive->getModelClass() + $directive->getModelClass(), ); } @@ -147,7 +147,7 @@ public function testResolvesFromTheSecondaryModelNamespace(): void $this->assertSame( OnlyHere::class, - $directive->getModelClass() + $directive->getModelClass(), ); } @@ -158,13 +158,13 @@ public function testGetsArgumentFromDirective(): void $this->assertSame( 'argValue', // @phpstan-ignore-next-line protected method is called via wrapper below - $directive->directiveArgValue('argName') + $directive->directiveArgValue('argName'), ); $this->assertSame( 'argValue2', // @phpstan-ignore-next-line protected method is called via wrapper below - $directive->directiveArgValue('argName2') + $directive->directiveArgValue('argName2'), ); } @@ -182,7 +182,7 @@ public function testMutuallyExclusive(): void $directive = $this->constructFieldDirective('foo: ID @dummy(bar: 1, baz: 2)'); $this->expectExceptionObject( - new DefinitionException('The arguments [bar, baz, qux] for @base are mutually exclusive, found [bar, baz] on foo.') + new DefinitionException('The arguments [bar, baz, qux] for @base are mutually exclusive, found [bar, baz] on foo.'), ); // @phpstan-ignore-next-line protected method is called via wrapper below $directive->validateMutuallyExclusiveArguments(['bar', 'baz', 'qux']); @@ -213,7 +213,7 @@ public function __call(string $method, array $args) $directive->hydrate( $fieldDefinition->directives->get(0), - $fieldDefinition + $fieldDefinition, ); return $directive; diff --git a/tests/Unit/Schema/ResolverProviderTest.php b/tests/Unit/Schema/ResolverProviderTest.php index c25d3091ba..2706009167 100644 --- a/tests/Unit/Schema/ResolverProviderTest.php +++ b/tests/Unit/Schema/ResolverProviderTest.php @@ -1,4 +1,4 @@ -fields->get(0) + $queryType->fields->get(0), ); } } From 4909d776edf8e57880ebecaa8793175eb439d7e7 Mon Sep 17 00:00:00 2001 From: spawnia Date: Tue, 10 Feb 2026 13:47:30 +0100 Subject: [PATCH 10/14] Restore PR #2314 files to d5c128ab state after merging master --- composer.json | 64 +++++++++---------- .../Schema/Directives/BaseDirectiveTest.php | 24 +++---- tests/Unit/Schema/ResolverProviderTest.php | 8 ++- 3 files changed, 47 insertions(+), 49 deletions(-) diff --git a/composer.json b/composer.json index ed87abbb47..764147c824 100644 --- a/composer.json +++ b/composer.json @@ -29,51 +29,46 @@ "php": "^8", "ext-json": "*", "haydenpierce/class-finder": "^0.4 || ^0.5", - "illuminate/auth": "^9 || ^10 || ^11 || ^12", - "illuminate/bus": "^9 || ^10 || ^11 || ^12", - "illuminate/contracts": "^9 || ^10 || ^11 || ^12", - "illuminate/http": "^9 || ^10 || ^11 || ^12", - "illuminate/pagination": "^9 || ^10 || ^11 || ^12", - "illuminate/queue": "^9 || ^10 || ^11 || ^12", - "illuminate/routing": "^9 || ^10 || ^11 || ^12", - "illuminate/support": "^9 || ^10 || ^11 || ^12", - "illuminate/validation": "^9 || ^10 || ^11 || ^12", - "laragraph/utils": "^1.5 || ^2", - "thecodingmachine/safe": "^1 || ^2 || ^3", + "illuminate/auth": "^9 || ^10", + "illuminate/bus": "^9 || ^10", + "illuminate/contracts": "^9 || ^10", + "illuminate/http": "^9 || ^10", + "illuminate/pagination": "^9 || ^10", + "illuminate/queue": "^9 || ^10", + "illuminate/routing": "^9 || ^10", + "illuminate/support": "^9 || ^10", + "illuminate/validation": "^9 || ^10", + "laragraph/utils": "^1.5", + "thecodingmachine/safe": "^1 || ^2", "webonyx/graphql-php": "dev-nodelist-array-access as 15.1.1" }, "require-dev": { - "algolia/algoliasearch-client-php": "^3", + "algolia/algoliasearch-client-php": "^3 || ^4", "bensampo/laravel-enum": "^5 || ^6", + "dms/phpunit-arraysubset-asserts": "^0.4", "ergebnis/composer-normalize": "^2.2.2", - "fakerphp/faker": "^1.21", - "google/protobuf": "^3.21", - "larastan/larastan": "^2.9.14 || ^3.0.4", - "laravel/framework": "^9 || ^10 || ^11 || ^12", + "laravel/framework": "^9 || ^10", "laravel/legacy-factories": "^1.1.1", - "laravel/pennant": "^1", + "laravel/lumen-framework": "^9 || ^10 || dev-master", "laravel/scout": "^8 || ^9 || ^10", - "mattiasgeniar/phpunit-query-count-assertions": "^1.1", - "mll-lab/graphql-php-scalars": "^6.4.1", + "mll-lab/graphql-php-scalars": "^6", "mll-lab/php-cs-fixer-config": "^5", "mockery/mockery": "^1.5", - "nesbot/carbon": "^2.62.1 || ^3.8.4", - "orchestra/testbench": "^7.50 || ^8.32 || ^9.10 || ^10.1", + "nesbot/carbon": "^2.62.1", + "nunomaduro/larastan": "^2", + "orchestra/testbench": "^7.7 || ^8.8", "phpbench/phpbench": "^1.2.6", - "phpstan/extension-installer": "^1", - "phpstan/phpstan": "^1.12.18 || ^2", - "phpstan/phpstan-mockery": "^1.1.3 || ^2", - "phpstan/phpstan-phpunit": "^1.1.1 || ^2", - "phpunit/phpunit": "^9.6.4 || ^10 || ^11 || ^12", + "phpstan/phpstan": "^1.8.4", + "phpstan/phpstan-mockery": "~0.12 || ^1.1", + "phpstan/phpstan-phpunit": "~0.12 || ^1.1.1", + "phpunit/phpunit": "^9.5.24", "predis/predis": "^1.1 || ^2.1", "pusher/pusher-php-server": "^5 || ^6 || ^7.0.2", - "rector/rector": "^1 || ^2", + "rector/rector": "^0.12.23", "thecodingmachine/phpstan-safe-rule": "^1.2" }, "suggest": { - "ext-protobuf": "Improve protobuf serialization performance (used for tracing)", - "google/protobuf": "Required when using the tracing driver federated-tracing", - "laravel/pennant": "Required for the @feature directive", + "bensampo/laravel-enum": "Convenient enum definitions that can easily be registered in your Schema", "laravel/scout": "Required for the @search directive", "mll-lab/graphql-php-scalars": "Useful scalar types, required for @whereConditions", "mll-lab/laravel-graphiql": "A graphical interactive in-browser GraphQL IDE - integrated with Laravel", @@ -96,22 +91,23 @@ "allow-plugins": { "composer/package-versions-deprecated": true, "ergebnis/composer-normalize": true, - "kylekatarnls/update-helper": true, - "phpstan/extension-installer": true + "kylekatarnls/update-helper": true }, "sort-packages": true }, "extra": { "laravel": { + "aliases": { + "graphql": "Nuwave\\Lighthouse\\GraphQL" + }, "providers": [ "Nuwave\\Lighthouse\\LighthouseServiceProvider", - "Nuwave\\Lighthouse\\Async\\AsyncServiceProvider", "Nuwave\\Lighthouse\\Auth\\AuthServiceProvider", - "Nuwave\\Lighthouse\\Bind\\BindServiceProvider", "Nuwave\\Lighthouse\\Cache\\CacheServiceProvider", "Nuwave\\Lighthouse\\GlobalId\\GlobalIdServiceProvider", "Nuwave\\Lighthouse\\OrderBy\\OrderByServiceProvider", "Nuwave\\Lighthouse\\Pagination\\PaginationServiceProvider", + "Nuwave\\Lighthouse\\Scout\\ScoutServiceProvider", "Nuwave\\Lighthouse\\SoftDeletes\\SoftDeletesServiceProvider", "Nuwave\\Lighthouse\\Testing\\TestingServiceProvider", "Nuwave\\Lighthouse\\Validation\\ValidationServiceProvider" diff --git a/tests/Unit/Schema/Directives/BaseDirectiveTest.php b/tests/Unit/Schema/Directives/BaseDirectiveTest.php index d0bad4b7c5..e509bd52c7 100644 --- a/tests/Unit/Schema/Directives/BaseDirectiveTest.php +++ b/tests/Unit/Schema/Directives/BaseDirectiveTest.php @@ -1,4 +1,4 @@ -assertSame( Team::class, - $directive->getModelClass(), + $directive->getModelClass() ); } @@ -51,7 +51,7 @@ public function testDefaultsToFieldTypeForTheModelClass(): void $this->assertSame( User::class, - $directive->getModelClass(), + $directive->getModelClass() ); } @@ -69,7 +69,7 @@ public function testBuiltInTypeTolerated(): void $this->assertSame( Team::class, - $directive->getModelClass(), + $directive->getModelClass() ); } @@ -99,7 +99,7 @@ public function testResolvesAModelThatIsNamedLikeABaseClass(): void $this->assertSame( Closure::class, - $directive->getModelClass(), + $directive->getModelClass() ); } @@ -115,7 +115,7 @@ public function testPrefersThePrimaryModelNamespace(): void $this->assertSame( Category::class, - $directive->getModelClass(), + $directive->getModelClass() ); } @@ -131,7 +131,7 @@ public function testAllowsOverwritingTheDefaultModel(): void $this->assertSame( CategorySecondary::class, - $directive->getModelClass(), + $directive->getModelClass() ); } @@ -147,7 +147,7 @@ public function testResolvesFromTheSecondaryModelNamespace(): void $this->assertSame( OnlyHere::class, - $directive->getModelClass(), + $directive->getModelClass() ); } @@ -158,13 +158,13 @@ public function testGetsArgumentFromDirective(): void $this->assertSame( 'argValue', // @phpstan-ignore-next-line protected method is called via wrapper below - $directive->directiveArgValue('argName'), + $directive->directiveArgValue('argName') ); $this->assertSame( 'argValue2', // @phpstan-ignore-next-line protected method is called via wrapper below - $directive->directiveArgValue('argName2'), + $directive->directiveArgValue('argName2') ); } @@ -182,7 +182,7 @@ public function testMutuallyExclusive(): void $directive = $this->constructFieldDirective('foo: ID @dummy(bar: 1, baz: 2)'); $this->expectExceptionObject( - new DefinitionException('The arguments [bar, baz, qux] for @base are mutually exclusive, found [bar, baz] on foo.'), + new DefinitionException('The arguments [bar, baz, qux] for @base are mutually exclusive, found [bar, baz] on foo.') ); // @phpstan-ignore-next-line protected method is called via wrapper below $directive->validateMutuallyExclusiveArguments(['bar', 'baz', 'qux']); @@ -213,7 +213,7 @@ public function __call(string $method, array $args) $directive->hydrate( $fieldDefinition->directives->get(0), - $fieldDefinition, + $fieldDefinition ); return $directive; diff --git a/tests/Unit/Schema/ResolverProviderTest.php b/tests/Unit/Schema/ResolverProviderTest.php index 2706009167..c25d3091ba 100644 --- a/tests/Unit/Schema/ResolverProviderTest.php +++ b/tests/Unit/Schema/ResolverProviderTest.php @@ -1,4 +1,4 @@ -fields->get(0), + $queryType->fields->get(0) ); } } From 3222b063feec60b3984f8c8389cf6f1a90b1a83b Mon Sep 17 00:00:00 2001 From: spawnia Date: Tue, 10 Feb 2026 12:48:04 +0000 Subject: [PATCH 11/14] Normalize composer.json --- composer.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 764147c824..cd6f14668e 100644 --- a/composer.json +++ b/composer.json @@ -59,8 +59,8 @@ "orchestra/testbench": "^7.7 || ^8.8", "phpbench/phpbench": "^1.2.6", "phpstan/phpstan": "^1.8.4", - "phpstan/phpstan-mockery": "~0.12 || ^1.1", - "phpstan/phpstan-phpunit": "~0.12 || ^1.1.1", + "phpstan/phpstan-mockery": "^0.12 || ^1.1", + "phpstan/phpstan-phpunit": "^0.12 || ^1.1.1", "phpunit/phpunit": "^9.5.24", "predis/predis": "^1.1 || ^2.1", "pusher/pusher-php-server": "^5 || ^6 || ^7.0.2", From 5dd9f1e64a29eec84883634a119669d3f9d8cf17 Mon Sep 17 00:00:00 2001 From: spawnia Date: Tue, 10 Feb 2026 12:48:18 +0000 Subject: [PATCH 12/14] Apply php-cs-fixer changes --- .../Schema/Directives/BaseDirectiveTest.php | 24 +++++++++---------- tests/Unit/Schema/ResolverProviderTest.php | 8 +++---- 2 files changed, 15 insertions(+), 17 deletions(-) diff --git a/tests/Unit/Schema/Directives/BaseDirectiveTest.php b/tests/Unit/Schema/Directives/BaseDirectiveTest.php index e509bd52c7..d0bad4b7c5 100644 --- a/tests/Unit/Schema/Directives/BaseDirectiveTest.php +++ b/tests/Unit/Schema/Directives/BaseDirectiveTest.php @@ -1,4 +1,4 @@ -assertSame( Team::class, - $directive->getModelClass() + $directive->getModelClass(), ); } @@ -51,7 +51,7 @@ public function testDefaultsToFieldTypeForTheModelClass(): void $this->assertSame( User::class, - $directive->getModelClass() + $directive->getModelClass(), ); } @@ -69,7 +69,7 @@ public function testBuiltInTypeTolerated(): void $this->assertSame( Team::class, - $directive->getModelClass() + $directive->getModelClass(), ); } @@ -99,7 +99,7 @@ public function testResolvesAModelThatIsNamedLikeABaseClass(): void $this->assertSame( Closure::class, - $directive->getModelClass() + $directive->getModelClass(), ); } @@ -115,7 +115,7 @@ public function testPrefersThePrimaryModelNamespace(): void $this->assertSame( Category::class, - $directive->getModelClass() + $directive->getModelClass(), ); } @@ -131,7 +131,7 @@ public function testAllowsOverwritingTheDefaultModel(): void $this->assertSame( CategorySecondary::class, - $directive->getModelClass() + $directive->getModelClass(), ); } @@ -147,7 +147,7 @@ public function testResolvesFromTheSecondaryModelNamespace(): void $this->assertSame( OnlyHere::class, - $directive->getModelClass() + $directive->getModelClass(), ); } @@ -158,13 +158,13 @@ public function testGetsArgumentFromDirective(): void $this->assertSame( 'argValue', // @phpstan-ignore-next-line protected method is called via wrapper below - $directive->directiveArgValue('argName') + $directive->directiveArgValue('argName'), ); $this->assertSame( 'argValue2', // @phpstan-ignore-next-line protected method is called via wrapper below - $directive->directiveArgValue('argName2') + $directive->directiveArgValue('argName2'), ); } @@ -182,7 +182,7 @@ public function testMutuallyExclusive(): void $directive = $this->constructFieldDirective('foo: ID @dummy(bar: 1, baz: 2)'); $this->expectExceptionObject( - new DefinitionException('The arguments [bar, baz, qux] for @base are mutually exclusive, found [bar, baz] on foo.') + new DefinitionException('The arguments [bar, baz, qux] for @base are mutually exclusive, found [bar, baz] on foo.'), ); // @phpstan-ignore-next-line protected method is called via wrapper below $directive->validateMutuallyExclusiveArguments(['bar', 'baz', 'qux']); @@ -213,7 +213,7 @@ public function __call(string $method, array $args) $directive->hydrate( $fieldDefinition->directives->get(0), - $fieldDefinition + $fieldDefinition, ); return $directive; diff --git a/tests/Unit/Schema/ResolverProviderTest.php b/tests/Unit/Schema/ResolverProviderTest.php index c25d3091ba..2706009167 100644 --- a/tests/Unit/Schema/ResolverProviderTest.php +++ b/tests/Unit/Schema/ResolverProviderTest.php @@ -1,4 +1,4 @@ -fields->get(0) + $queryType->fields->get(0), ); } } From 060546048fd4438a844cee51d28a3aca9ae84efd Mon Sep 17 00:00:00 2001 From: spawnia Date: Tue, 10 Feb 2026 13:49:16 +0100 Subject: [PATCH 13/14] Reduce PR #2314 to intended NodeList one-line changes --- .../Schema/Directives/BaseDirectiveTest.php | 160 +++++++++++++----- 1 file changed, 117 insertions(+), 43 deletions(-) diff --git a/tests/Unit/Schema/Directives/BaseDirectiveTest.php b/tests/Unit/Schema/Directives/BaseDirectiveTest.php index d0bad4b7c5..c205c8449e 100644 --- a/tests/Unit/Schema/Directives/BaseDirectiveTest.php +++ b/tests/Unit/Schema/Directives/BaseDirectiveTest.php @@ -14,22 +14,22 @@ use Tests\Utils\ModelsSecondary\OnlyHere; /** - * This class does test the internal behaviour of the BaseDirective class. + * This class does test the internal behavior of the BaseDirective class. * * While typically considered an anti-pattern, the BaseDirective is meant * to be extended by other directives and offers basic utilities that * are commonly used in directives. As users may also extend it to create - * custom directives, its behaviour should be stable and well-defined. + * custom directives, its behavior should be stable and well-defined. */ final class BaseDirectiveTest extends TestCase { public function testGetsModelClassFromDirective(): void { - $this->schema .= /** @lang GraphQL */ ' - type User @model(class: "Team") { - id: ID - } - '; + $this->schema .= /** @lang GraphQL */ <<<'GRAPHQL' + type User @model(class: "Team") { + id: ID + } + GRAPHQL; $directive = $this->constructFieldDirective('foo: User @dummy'); @@ -39,13 +39,13 @@ public function testGetsModelClassFromDirective(): void ); } - public function testDefaultsToFieldTypeForTheModelClass(): void + public function testDefaultsToFieldTypeForTheModelClassIfObject(): void { - $this->schema .= /** @lang GraphQL */ ' - type User { - id: ID - } - '; + $this->schema .= /** @lang GraphQL */ <<<'GRAPHQL' + type User { + id: ID + } + GRAPHQL; $directive = $this->constructFieldDirective('foo: User @dummy'); @@ -55,6 +55,56 @@ public function testDefaultsToFieldTypeForTheModelClass(): void ); } + public function testDefaultsToFieldTypeForTheModelClassIfInterface(): void + { + $this->schema .= /** @lang GraphQL */ <<<'GRAPHQL' + interface User { + id: ID + } + GRAPHQL; + + $directive = $this->constructFieldDirective('foo: User @dummy'); + + $this->assertSame( + User::class, + $directive->getModelClass(), + ); + } + + public function testDefaultsToFieldTypeForTheModelClassIfUnion(): void + { + $this->schema .= /** @lang GraphQL */ <<<'GRAPHQL' + union User = Admin | Member + + type Admin { + id: ID + } + + type Member { + id: ID + } + GRAPHQL; + + $directive = $this->constructFieldDirective('foo: User @dummy'); + + $this->assertSame( + User::class, + $directive->getModelClass(), + ); + } + + public function testDoesntDefaultToFieldTypeForTheModelClassIfScalar(): void + { + $this->schema .= /** @lang GraphQL */ <<<'GRAPHQL' + scalar User + GRAPHQL; + + $directive = $this->constructFieldDirective('foo: User @dummy'); + + $this->expectException(DefinitionException::class); + $directive->getModelClass(); + } + public function testThrowsIfTheClassIsNotInTheSchema(): void { $directive = $this->constructFieldDirective('foo: UnknownType @dummy'); @@ -75,11 +125,11 @@ public function testBuiltInTypeTolerated(): void public function testThrowsIfTheClassIsNotAModel(): void { - $this->schema .= /** @lang GraphQL */ ' - type Exception { - id: ID - } - '; + $this->schema .= /** @lang GraphQL */ <<<'GRAPHQL' + type Exception { + id: ID + } + GRAPHQL; $directive = $this->constructFieldDirective('foo: Exception @dummy'); @@ -89,11 +139,11 @@ public function testThrowsIfTheClassIsNotAModel(): void public function testResolvesAModelThatIsNamedLikeABaseClass(): void { - $this->schema .= /** @lang GraphQL */ ' - type Closure { - id: ID - } - '; + $this->schema .= /** @lang GraphQL */ <<<'GRAPHQL' + type Closure { + id: ID + } + GRAPHQL; $directive = $this->constructFieldDirective('foo: Closure @dummy'); @@ -105,11 +155,11 @@ public function testResolvesAModelThatIsNamedLikeABaseClass(): void public function testPrefersThePrimaryModelNamespace(): void { - $this->schema .= /** @lang GraphQL */ ' - type Category { - id: ID - } - '; + $this->schema .= /** @lang GraphQL */ <<<'GRAPHQL' + type Category { + id: ID + } + GRAPHQL; $directive = $this->constructFieldDirective('foo: Category @dummy'); @@ -121,11 +171,11 @@ public function testPrefersThePrimaryModelNamespace(): void public function testAllowsOverwritingTheDefaultModel(): void { - $this->schema .= /** @lang GraphQL */ ' - type OnlyHere { - id: ID - } - '; + $this->schema .= /** @lang GraphQL */ <<<'GRAPHQL' + type OnlyHere { + id: ID + } + GRAPHQL; $directive = $this->constructFieldDirective('foo: OnlyHere @dummy(model: "Tests\\\Utils\\\ModelsSecondary\\\Category")'); @@ -137,11 +187,11 @@ public function testAllowsOverwritingTheDefaultModel(): void public function testResolvesFromTheSecondaryModelNamespace(): void { - $this->schema .= /** @lang GraphQL */ ' - type OnlyHere { - id: ID - } - '; + $this->schema .= /** @lang GraphQL */ <<<'GRAPHQL' + type OnlyHere { + id: ID + } + GRAPHQL; $directive = $this->constructFieldDirective('foo: OnlyHere @dummy'); @@ -188,24 +238,48 @@ public function testMutuallyExclusive(): void $directive->validateMutuallyExclusiveArguments(['bar', 'baz', 'qux']); } - protected function constructFieldDirective(string $definition): BaseDirective + public function testHydrateShouldResetCachedArgs(): void + { + $directive = $this->constructFieldDirective('foo: ID @dummy(arg: "value")'); + + $this->assertSame( + 'value', + // @phpstan-ignore-next-line protected method is called via wrapper below + $directive->directiveArgValue('arg'), + ); + + $field = Parser::fieldDefinition('foo: ID @dummy(arg: "new value")'); + + $directive->hydrate( + $field->directives->get(0), + $field, + ); + + $this->assertSame( + 'new value', + // @phpstan-ignore-next-line protected method is called via wrapper below + $directive->directiveArgValue('arg'), + ); + } + + private function constructFieldDirective(string $definition): BaseDirective { $fieldDefinition = Parser::fieldDefinition($definition); $directive = new class() extends BaseDirective { public static function definition(): string { - return /** @lang GraphQL */ 'directive @base on FIELD_DEFINITION'; + return /** @lang GraphQL */ <<<'GRAPHQL' + directive @base on FIELD_DEFINITION + GRAPHQL; } /** * Allows calling protected methods from the test. * * @param array $args - * - * @return mixed whatever the method returns */ - public function __call(string $method, array $args) + public function __call(string $method, array $args): mixed { return $this->{$method}(...$args); } From a2c48f686ad43396d2fdb675c8f7db5402ace15d Mon Sep 17 00:00:00 2001 From: spawnia Date: Tue, 10 Feb 2026 13:51:28 +0100 Subject: [PATCH 14/14] Align PR #2314 to master with only intended one-line NodeList changes --- composer.json | 64 ++++++++++++---------- tests/Unit/Schema/ResolverProviderTest.php | 11 ++-- 2 files changed, 39 insertions(+), 36 deletions(-) diff --git a/composer.json b/composer.json index cd6f14668e..ed87abbb47 100644 --- a/composer.json +++ b/composer.json @@ -29,46 +29,51 @@ "php": "^8", "ext-json": "*", "haydenpierce/class-finder": "^0.4 || ^0.5", - "illuminate/auth": "^9 || ^10", - "illuminate/bus": "^9 || ^10", - "illuminate/contracts": "^9 || ^10", - "illuminate/http": "^9 || ^10", - "illuminate/pagination": "^9 || ^10", - "illuminate/queue": "^9 || ^10", - "illuminate/routing": "^9 || ^10", - "illuminate/support": "^9 || ^10", - "illuminate/validation": "^9 || ^10", - "laragraph/utils": "^1.5", - "thecodingmachine/safe": "^1 || ^2", + "illuminate/auth": "^9 || ^10 || ^11 || ^12", + "illuminate/bus": "^9 || ^10 || ^11 || ^12", + "illuminate/contracts": "^9 || ^10 || ^11 || ^12", + "illuminate/http": "^9 || ^10 || ^11 || ^12", + "illuminate/pagination": "^9 || ^10 || ^11 || ^12", + "illuminate/queue": "^9 || ^10 || ^11 || ^12", + "illuminate/routing": "^9 || ^10 || ^11 || ^12", + "illuminate/support": "^9 || ^10 || ^11 || ^12", + "illuminate/validation": "^9 || ^10 || ^11 || ^12", + "laragraph/utils": "^1.5 || ^2", + "thecodingmachine/safe": "^1 || ^2 || ^3", "webonyx/graphql-php": "dev-nodelist-array-access as 15.1.1" }, "require-dev": { - "algolia/algoliasearch-client-php": "^3 || ^4", + "algolia/algoliasearch-client-php": "^3", "bensampo/laravel-enum": "^5 || ^6", - "dms/phpunit-arraysubset-asserts": "^0.4", "ergebnis/composer-normalize": "^2.2.2", - "laravel/framework": "^9 || ^10", + "fakerphp/faker": "^1.21", + "google/protobuf": "^3.21", + "larastan/larastan": "^2.9.14 || ^3.0.4", + "laravel/framework": "^9 || ^10 || ^11 || ^12", "laravel/legacy-factories": "^1.1.1", - "laravel/lumen-framework": "^9 || ^10 || dev-master", + "laravel/pennant": "^1", "laravel/scout": "^8 || ^9 || ^10", - "mll-lab/graphql-php-scalars": "^6", + "mattiasgeniar/phpunit-query-count-assertions": "^1.1", + "mll-lab/graphql-php-scalars": "^6.4.1", "mll-lab/php-cs-fixer-config": "^5", "mockery/mockery": "^1.5", - "nesbot/carbon": "^2.62.1", - "nunomaduro/larastan": "^2", - "orchestra/testbench": "^7.7 || ^8.8", + "nesbot/carbon": "^2.62.1 || ^3.8.4", + "orchestra/testbench": "^7.50 || ^8.32 || ^9.10 || ^10.1", "phpbench/phpbench": "^1.2.6", - "phpstan/phpstan": "^1.8.4", - "phpstan/phpstan-mockery": "^0.12 || ^1.1", - "phpstan/phpstan-phpunit": "^0.12 || ^1.1.1", - "phpunit/phpunit": "^9.5.24", + "phpstan/extension-installer": "^1", + "phpstan/phpstan": "^1.12.18 || ^2", + "phpstan/phpstan-mockery": "^1.1.3 || ^2", + "phpstan/phpstan-phpunit": "^1.1.1 || ^2", + "phpunit/phpunit": "^9.6.4 || ^10 || ^11 || ^12", "predis/predis": "^1.1 || ^2.1", "pusher/pusher-php-server": "^5 || ^6 || ^7.0.2", - "rector/rector": "^0.12.23", + "rector/rector": "^1 || ^2", "thecodingmachine/phpstan-safe-rule": "^1.2" }, "suggest": { - "bensampo/laravel-enum": "Convenient enum definitions that can easily be registered in your Schema", + "ext-protobuf": "Improve protobuf serialization performance (used for tracing)", + "google/protobuf": "Required when using the tracing driver federated-tracing", + "laravel/pennant": "Required for the @feature directive", "laravel/scout": "Required for the @search directive", "mll-lab/graphql-php-scalars": "Useful scalar types, required for @whereConditions", "mll-lab/laravel-graphiql": "A graphical interactive in-browser GraphQL IDE - integrated with Laravel", @@ -91,23 +96,22 @@ "allow-plugins": { "composer/package-versions-deprecated": true, "ergebnis/composer-normalize": true, - "kylekatarnls/update-helper": true + "kylekatarnls/update-helper": true, + "phpstan/extension-installer": true }, "sort-packages": true }, "extra": { "laravel": { - "aliases": { - "graphql": "Nuwave\\Lighthouse\\GraphQL" - }, "providers": [ "Nuwave\\Lighthouse\\LighthouseServiceProvider", + "Nuwave\\Lighthouse\\Async\\AsyncServiceProvider", "Nuwave\\Lighthouse\\Auth\\AuthServiceProvider", + "Nuwave\\Lighthouse\\Bind\\BindServiceProvider", "Nuwave\\Lighthouse\\Cache\\CacheServiceProvider", "Nuwave\\Lighthouse\\GlobalId\\GlobalIdServiceProvider", "Nuwave\\Lighthouse\\OrderBy\\OrderByServiceProvider", "Nuwave\\Lighthouse\\Pagination\\PaginationServiceProvider", - "Nuwave\\Lighthouse\\Scout\\ScoutServiceProvider", "Nuwave\\Lighthouse\\SoftDeletes\\SoftDeletesServiceProvider", "Nuwave\\Lighthouse\\Testing\\TestingServiceProvider", "Nuwave\\Lighthouse\\Validation\\ValidationServiceProvider" diff --git a/tests/Unit/Schema/ResolverProviderTest.php b/tests/Unit/Schema/ResolverProviderTest.php index 2706009167..03928d81ce 100644 --- a/tests/Unit/Schema/ResolverProviderTest.php +++ b/tests/Unit/Schema/ResolverProviderTest.php @@ -12,10 +12,9 @@ final class ResolverProviderTest extends TestCase { - /** @var \Nuwave\Lighthouse\Schema\ResolverProvider */ - protected $resolverProvider; + protected ResolverProvider $resolverProvider; - public function setUp(): void + protected function setUp(): void { parent::setUp(); @@ -54,13 +53,13 @@ public function testThrowsIfRootFieldHasNoResolver(): void $this->resolverProvider->provideResolver($fieldValue); } - protected function constructFieldValue(string $fieldDefinition, string $parentTypeName = RootType::QUERY): FieldValue + private function constructFieldValue(string $fieldDefinition, string $parentTypeName = RootType::QUERY): FieldValue { - $queryType = Parser::objectTypeDefinition(/** @lang GraphQL */ " + $queryType = Parser::objectTypeDefinition(/** @lang GraphQL */ <<