@@ -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 ($ 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 ($ 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