@@ -188,7 +188,7 @@ public function testResolveTypeOnInterfaceYieldsUsefulError(): void
188188 return null ;
189189 },
190190 'fields ' => [
191- 'name ' => [ ' type ' => Type::string ()] ,
191+ 'name ' => Type::string (),
192192 ],
193193 ]);
194194
@@ -273,23 +273,23 @@ public function testResolveTypeOnUnionYieldsUsefulError(): void
273273 $ HumanType = new ObjectType ([
274274 'name ' => 'Human ' ,
275275 'fields ' => [
276- 'name ' => [ ' type ' => Type::string ()] ,
276+ 'name ' => Type::string (),
277277 ],
278278 ]);
279279
280280 $ DogType = new ObjectType ([
281281 'name ' => 'Dog ' ,
282282 'fields ' => [
283- 'name ' => [ ' type ' => Type::string ()] ,
284- 'woofs ' => [ ' type ' => Type::boolean ()] ,
283+ 'name ' => Type::string (),
284+ 'woofs ' => Type::boolean (),
285285 ],
286286 ]);
287287
288288 $ CatType = new ObjectType ([
289289 'name ' => 'Cat ' ,
290290 'fields ' => [
291- 'name ' => [ ' type ' => Type::string ()] ,
292- 'meows ' => [ ' type ' => Type::boolean ()] ,
291+ 'name ' => Type::string (),
292+ 'meows ' => Type::boolean (),
293293 ],
294294 ]);
295295
@@ -792,20 +792,20 @@ public function testResolveValueAllowsModifyingObjectValueForInterfaceType(): vo
792792 {
793793 $ PetType = new InterfaceType ([
794794 'name ' => 'Pet ' ,
795- 'resolveType ' => static function (PetEntity $ objectValue ): string {
796- if ($ objectValue ->type === 'dog ' ) {
797- return 'Dog ' ;
798- }
799-
800- return 'Cat ' ;
801- },
802795 'resolveValue ' => static function (PetEntity $ objectValue ): object {
803796 if ($ objectValue ->type === 'dog ' ) {
804797 return new Dog ($ objectValue ->name , $ objectValue ->vocalizes );
805798 }
806799
807800 return new Cat ($ objectValue ->name , $ objectValue ->vocalizes );
808801 },
802+ 'resolveType ' => static function (object $ objectValue ): string {
803+ if ($ objectValue instanceof Dog) {
804+ return 'Dog ' ;
805+ }
806+
807+ return 'Cat ' ;
808+ },
809809 'fields ' => [
810810 'name ' => Type::string (),
811811 ],
@@ -916,20 +916,20 @@ public function testResolveValueAllowsModifyingObjectValueForUnionType(): void
916916 $ PetType = new UnionType ([
917917 'name ' => 'Pet ' ,
918918 'types ' => [$ DogType , $ CatType ],
919- 'resolveType ' => static function (PetEntity $ objectValue ): string {
920- if ($ objectValue ->type === 'dog ' ) {
921- return 'Dog ' ;
922- }
923-
924- return 'Cat ' ;
925- },
926919 'resolveValue ' => static function (PetEntity $ objectValue ): object {
927920 if ($ objectValue ->type === 'dog ' ) {
928921 return new Dog ($ objectValue ->name , $ objectValue ->vocalizes );
929922 }
930923
931924 return new Cat ($ objectValue ->name , $ objectValue ->vocalizes );
932925 },
926+ 'resolveType ' => static function (object $ objectValue ): string {
927+ if ($ objectValue instanceof Dog) {
928+ return 'Dog ' ;
929+ }
930+
931+ return 'Cat ' ;
932+ },
933933 ]);
934934
935935 $ schema = new Schema ([
0 commit comments