@@ -188,7 +188,7 @@ public function testResolveTypeOnInterfaceYieldsUsefulError(): void
188
188
return null ;
189
189
},
190
190
'fields ' => [
191
- 'name ' => [ ' type ' => Type::string ()] ,
191
+ 'name ' => Type::string (),
192
192
],
193
193
]);
194
194
@@ -273,23 +273,23 @@ public function testResolveTypeOnUnionYieldsUsefulError(): void
273
273
$ HumanType = new ObjectType ([
274
274
'name ' => 'Human ' ,
275
275
'fields ' => [
276
- 'name ' => [ ' type ' => Type::string ()] ,
276
+ 'name ' => Type::string (),
277
277
],
278
278
]);
279
279
280
280
$ DogType = new ObjectType ([
281
281
'name ' => 'Dog ' ,
282
282
'fields ' => [
283
- 'name ' => [ ' type ' => Type::string ()] ,
284
- 'woofs ' => [ ' type ' => Type::boolean ()] ,
283
+ 'name ' => Type::string (),
284
+ 'woofs ' => Type::boolean (),
285
285
],
286
286
]);
287
287
288
288
$ CatType = new ObjectType ([
289
289
'name ' => 'Cat ' ,
290
290
'fields ' => [
291
- 'name ' => [ ' type ' => Type::string ()] ,
292
- 'meows ' => [ ' type ' => Type::boolean ()] ,
291
+ 'name ' => Type::string (),
292
+ 'meows ' => Type::boolean (),
293
293
],
294
294
]);
295
295
@@ -792,20 +792,20 @@ public function testResolveValueAllowsModifyingObjectValueForInterfaceType(): vo
792
792
{
793
793
$ PetType = new InterfaceType ([
794
794
'name ' => 'Pet ' ,
795
- 'resolveType ' => static function (PetEntity $ objectValue ): string {
796
- if ($ objectValue ->type === 'dog ' ) {
797
- return 'Dog ' ;
798
- }
799
-
800
- return 'Cat ' ;
801
- },
802
795
'resolveValue ' => static function (PetEntity $ objectValue ): object {
803
796
if ($ objectValue ->type === 'dog ' ) {
804
797
return new Dog ($ objectValue ->name , $ objectValue ->vocalizes );
805
798
}
806
799
807
800
return new Cat ($ objectValue ->name , $ objectValue ->vocalizes );
808
801
},
802
+ 'resolveType ' => static function (object $ objectValue ): string {
803
+ if ($ objectValue instanceof Dog) {
804
+ return 'Dog ' ;
805
+ }
806
+
807
+ return 'Cat ' ;
808
+ },
809
809
'fields ' => [
810
810
'name ' => Type::string (),
811
811
],
@@ -916,20 +916,20 @@ public function testResolveValueAllowsModifyingObjectValueForUnionType(): void
916
916
$ PetType = new UnionType ([
917
917
'name ' => 'Pet ' ,
918
918
'types ' => [$ DogType , $ CatType ],
919
- 'resolveType ' => static function (PetEntity $ objectValue ): string {
920
- if ($ objectValue ->type === 'dog ' ) {
921
- return 'Dog ' ;
922
- }
923
-
924
- return 'Cat ' ;
925
- },
926
919
'resolveValue ' => static function (PetEntity $ objectValue ): object {
927
920
if ($ objectValue ->type === 'dog ' ) {
928
921
return new Dog ($ objectValue ->name , $ objectValue ->vocalizes );
929
922
}
930
923
931
924
return new Cat ($ objectValue ->name , $ objectValue ->vocalizes );
932
925
},
926
+ 'resolveType ' => static function (object $ objectValue ): string {
927
+ if ($ objectValue instanceof Dog) {
928
+ return 'Dog ' ;
929
+ }
930
+
931
+ return 'Cat ' ;
932
+ },
933
933
]);
934
934
935
935
$ schema = new Schema ([
0 commit comments