From a402723528b19857984d5ed0d07616636623105c Mon Sep 17 00:00:00 2001 From: Max Baldanza Date: Tue, 10 Nov 2026 10:19:53 +0000 Subject: [PATCH 1/2] fix: ignore specifiedBy schema entries in dump schema tests Newer webonyx/graphql-php versions add the @specifiedBy directive and the __Type.specifiedByURL field to introspection output. Strip them from both expected and actual JSON so the fixtures stay valid across versions. Co-Authored-By: Claude Sonnet 5.5 --- .../Command/GraphDumpSchemaCommandTest.php | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/tests/Functional/Command/GraphDumpSchemaCommandTest.php b/tests/Functional/Command/GraphDumpSchemaCommandTest.php index a495068d8..5ace5a3dc 100644 --- a/tests/Functional/Command/GraphDumpSchemaCommandTest.php +++ b/tests/Functional/Command/GraphDumpSchemaCommandTest.php @@ -143,12 +143,41 @@ private function assertCommandExecution(array $input, string $expectedFile, stri if ('json' === $format) { $expected = json_decode($expected, true); $actual = json_decode($actual, true); + $this->removeVersionDependentSchemaEntries($expected); + $this->removeVersionDependentSchemaEntries($actual); $this->sortSchemaEntry($expected, 'types', 'name'); $this->sortSchemaEntry($actual, 'types', 'name'); } $this->assertEqualsCanonicalizing($expected, $actual); } + /** + * Newer versions of webonyx/graphql-php introduce the "@specifiedBy" directive + * and the "__Type.specifiedByURL" field. Strip them so that the fixtures + * stay valid regardless of the installed version. + */ + private function removeVersionDependentSchemaEntries(array &$entries): void + { + $schema = &$entries['data']['__schema']; + if (!isset($schema)) { + $schema = &$entries['__schema']; + } + + $schema['directives'] = array_values(array_filter( + $schema['directives'], + fn (array $directive) => 'specifiedBy' !== $directive['name'] + )); + + foreach ($schema['types'] as &$type) { + if ('__Type' === $type['name']) { + $type['fields'] = array_values(array_filter( + $type['fields'], + fn (array $field) => 'specifiedByURL' !== $field['name'] + )); + } + } + } + private function sortSchemaEntry(array &$entries, string $entryKey, string $sortBy): void { if (isset($entries['data']['__schema'][$entryKey])) { From ba2b91472a513ede7ba750adc96221f45ecf11ea Mon Sep 17 00:00:00 2001 From: Max Baldanza Date: Tue, 10 Nov 2026 10:25:24 +0000 Subject: [PATCH 2/2] fix: ignore phpstan covariance error on CustomScalarType::$config The bundle's config shape adds the "scalarType" key, so it cannot be covariant with the parent's type. Suppress it as webonyx does. Co-Authored-By: Claude Sonnet 5.5 --- src/Definition/Type/CustomScalarType.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Definition/Type/CustomScalarType.php b/src/Definition/Type/CustomScalarType.php index 1fb09c2cb..e2d3c1034 100644 --- a/src/Definition/Type/CustomScalarType.php +++ b/src/Definition/Type/CustomScalarType.php @@ -32,6 +32,7 @@ class CustomScalarType extends BaseCustomScalarType { /** @phpstan-var CustomScalarConfig */ + // @phpstan-ignore-next-line specialize type public array $config; /**