@@ -188,10 +188,7 @@ function (string $typeName) use ($schema): Type {
188
188
}
189
189
}
190
190
191
- $ schemaExtensionASTNodes = \array_merge ($ schema ->extensionASTNodes , $ schemaExtensions );
192
-
193
- return new Schema (
194
- (new SchemaConfig ())
191
+ $ schemaConfig = (new SchemaConfig ())
195
192
// @phpstan-ignore-next-line the root types may be invalid, but just passing them leads to more actionable errors
196
193
->setQuery ($ operationTypes ['query ' ])
197
194
// @phpstan-ignore-next-line the root types may be invalid, but just passing them leads to more actionable errors
@@ -201,8 +198,9 @@ function (string $typeName) use ($schema): Type {
201
198
->setTypes ($ types )
202
199
->setDirectives ($ this ->getMergedDirectives ($ schema , $ directiveDefinitions ))
203
200
->setAstNode ($ schema ->astNode ?? $ schemaDef )
204
- ->setExtensionASTNodes ($ schemaExtensionASTNodes )
205
- );
201
+ ->setExtensionASTNodes ([...$ schema ->extensionASTNodes , ...$ schemaExtensions ]);
202
+
203
+ return new Schema ($ schemaConfig );
206
204
}
207
205
208
206
/**
@@ -212,10 +210,10 @@ function (string $typeName) use ($schema): Type {
212
210
*/
213
211
protected function extensionASTNodes (NamedType $ type ): ?array
214
212
{
215
- return \array_merge (
216
- $ type ->extensionASTNodes ?? [],
217
- $ this ->typeExtensionsMap [$ type ->name ] ?? []
218
- ) ;
213
+ return [
214
+ ... $ type ->extensionASTNodes ?? [],
215
+ ... $ this ->typeExtensionsMap [$ type ->name ] ?? [],
216
+ ] ;
219
217
}
220
218
221
219
/**
@@ -225,7 +223,7 @@ protected function extensionASTNodes(NamedType $type): ?array
225
223
*/
226
224
protected function extendScalarType (ScalarType $ type ): CustomScalarType
227
225
{
228
- /** @var array<int, ScalarTypeExtensionNode> $extensionASTNodes */
226
+ /** @var array<ScalarTypeExtensionNode> $extensionASTNodes */
229
227
$ extensionASTNodes = $ this ->extensionASTNodes ($ type );
230
228
231
229
return new CustomScalarType ([
@@ -242,7 +240,7 @@ protected function extendScalarType(ScalarType $type): CustomScalarType
242
240
/** @throws InvariantViolation */
243
241
protected function extendUnionType (UnionType $ type ): UnionType
244
242
{
245
- /** @var array<int, UnionTypeExtensionNode> $extensionASTNodes */
243
+ /** @var array<UnionTypeExtensionNode> $extensionASTNodes */
246
244
$ extensionASTNodes = $ this ->extensionASTNodes ($ type );
247
245
248
246
return new UnionType ([
@@ -262,7 +260,7 @@ protected function extendUnionType(UnionType $type): UnionType
262
260
*/
263
261
protected function extendEnumType (EnumType $ type ): EnumType
264
262
{
265
- /** @var array<int, EnumTypeExtensionNode> $extensionASTNodes */
263
+ /** @var array<EnumTypeExtensionNode> $extensionASTNodes */
266
264
$ extensionASTNodes = $ this ->extensionASTNodes ($ type );
267
265
268
266
return new EnumType ([
@@ -277,16 +275,16 @@ protected function extendEnumType(EnumType $type): EnumType
277
275
/** @throws InvariantViolation */
278
276
protected function extendInputObjectType (InputObjectType $ type ): InputObjectType
279
277
{
280
- /** @var array<int, InputObjectTypeExtensionNode> $extensionASTNodes */
278
+ /** @var array<InputObjectTypeExtensionNode> $extensionASTNodes */
281
279
$ extensionASTNodes = $ this ->extensionASTNodes ($ type );
282
280
283
281
return new InputObjectType ([
284
282
'name ' => $ type ->name ,
285
283
'description ' => $ type ->description ,
286
284
'fields ' => fn (): array => $ this ->extendInputFieldMap ($ type ),
285
+ 'parseValue ' => [$ type , 'parseValue ' ],
287
286
'astNode ' => $ type ->astNode ,
288
287
'extensionASTNodes ' => $ extensionASTNodes ,
289
- 'parseValue ' => [$ type , 'parseValue ' ],
290
288
]);
291
289
}
292
290
@@ -529,7 +527,7 @@ protected function extendFieldMap(Type $type): array
529
527
/** @throws InvariantViolation */
530
528
protected function extendObjectType (ObjectType $ type ): ObjectType
531
529
{
532
- /** @var array<int, ObjectTypeExtensionNode> $extensionASTNodes */
530
+ /** @var array<ObjectTypeExtensionNode> $extensionASTNodes */
533
531
$ extensionASTNodes = $ this ->extensionASTNodes ($ type );
534
532
535
533
return new ObjectType ([
@@ -548,7 +546,7 @@ protected function extendObjectType(ObjectType $type): ObjectType
548
546
/** @throws InvariantViolation */
549
547
protected function extendInterfaceType (InterfaceType $ type ): InterfaceType
550
548
{
551
- /** @var array<int, InterfaceTypeExtensionNode> $extensionASTNodes */
549
+ /** @var array<InterfaceTypeExtensionNode> $extensionASTNodes */
552
550
$ extensionASTNodes = $ this ->extensionASTNodes ($ type );
553
551
554
552
return new InterfaceType ([
0 commit comments