@@ -41,7 +41,7 @@ public function testIsTypeOfUsedToResolveRuntimeTypeForInterface() : void
4141 'name ' => 'Dog ' ,
4242 'interfaces ' => [$ petType ],
4343 'isTypeOf ' => static function ($ obj ) {
44- return new Deferred (static function () use ($ obj ) {
44+ return new Deferred (static function () use ($ obj ) : bool {
4545 return $ obj instanceof Dog;
4646 });
4747 },
@@ -55,7 +55,7 @@ public function testIsTypeOfUsedToResolveRuntimeTypeForInterface() : void
5555 'name ' => 'Cat ' ,
5656 'interfaces ' => [$ petType ],
5757 'isTypeOf ' => static function ($ obj ) {
58- return new Deferred (static function () use ($ obj ) {
58+ return new Deferred (static function () use ($ obj ) : bool {
5959 return $ obj instanceof Cat;
6060 });
6161 },
@@ -71,7 +71,7 @@ public function testIsTypeOfUsedToResolveRuntimeTypeForInterface() : void
7171 'fields ' => [
7272 'pets ' => [
7373 'type ' => Type::listOf ($ petType ),
74- 'resolve ' => static function () {
74+ 'resolve ' => static function () : array {
7575 return [
7676 new Dog ('Odie ' , true ),
7777 new Cat ('Garfield ' , false ),
@@ -124,8 +124,8 @@ public function testIsTypeOfCanBeRejected() : void
124124 $ DogType = new ObjectType ([
125125 'name ' => 'Dog ' ,
126126 'interfaces ' => [$ PetType ],
127- 'isTypeOf ' => static function () {
128- return new Deferred (static function () {
127+ 'isTypeOf ' => static function () : Deferred {
128+ return new Deferred (static function () : void {
129129 throw new UserError ('We are testing this error ' );
130130 });
131131 },
@@ -139,7 +139,7 @@ public function testIsTypeOfCanBeRejected() : void
139139 'name ' => 'Cat ' ,
140140 'interfaces ' => [$ PetType ],
141141 'isTypeOf ' => static function ($ obj ) {
142- return new Deferred (static function () use ($ obj ) {
142+ return new Deferred (static function () use ($ obj ) : bool {
143143 return $ obj instanceof Cat;
144144 });
145145 },
@@ -155,7 +155,7 @@ public function testIsTypeOfCanBeRejected() : void
155155 'fields ' => [
156156 'pets ' => [
157157 'type ' => Type::listOf ($ PetType ),
158- 'resolve ' => static function () {
158+ 'resolve ' => static function () : array {
159159 return [
160160 new Dog ('Odie ' , true ),
161161 new Cat ('Garfield ' , false ),
@@ -210,7 +210,7 @@ public function testIsTypeOfUsedToResolveRuntimeTypeForUnion() : void
210210 $ dogType = new ObjectType ([
211211 'name ' => 'Dog ' ,
212212 'isTypeOf ' => static function ($ obj ) {
213- return new Deferred (static function () use ($ obj ) {
213+ return new Deferred (static function () use ($ obj ) : bool {
214214 return $ obj instanceof Dog;
215215 });
216216 },
@@ -223,7 +223,7 @@ public function testIsTypeOfUsedToResolveRuntimeTypeForUnion() : void
223223 $ catType = new ObjectType ([
224224 'name ' => 'Cat ' ,
225225 'isTypeOf ' => static function ($ obj ) {
226- return new Deferred (static function () use ($ obj ) {
226+ return new Deferred (static function () use ($ obj ) : bool {
227227 return $ obj instanceof Cat;
228228 });
229229 },
@@ -244,7 +244,7 @@ public function testIsTypeOfUsedToResolveRuntimeTypeForUnion() : void
244244 'fields ' => [
245245 'pets ' => [
246246 'type ' => Type::listOf ($ petType ),
247- 'resolve ' => static function () {
247+ 'resolve ' => static function () : array {
248248 return [new Dog ('Odie ' , true ), new Cat ('Garfield ' , false )];
249249 },
250250 ],
@@ -286,8 +286,8 @@ public function testResolveTypeOnInterfaceYieldsUsefulError() : void
286286 {
287287 $ PetType = new InterfaceType ([
288288 'name ' => 'Pet ' ,
289- 'resolveType ' => static function ($ obj ) use (&$ DogType , &$ CatType , &$ HumanType ) {
290- return new Deferred (static function () use ($ obj , $ DogType , $ CatType , $ HumanType ) {
289+ 'resolveType ' => static function ($ obj ) use (&$ DogType , &$ CatType , &$ HumanType ) : Deferred {
290+ return new Deferred (static function () use ($ obj , $ DogType , $ CatType , $ HumanType ) : ? Type {
291291 if ($ obj instanceof Dog) {
292292 return $ DogType ;
293293 }
@@ -338,7 +338,7 @@ public function testResolveTypeOnInterfaceYieldsUsefulError() : void
338338 'pets ' => [
339339 'type ' => Type::listOf ($ PetType ),
340340 'resolve ' => static function () {
341- return new Deferred (static function () {
341+ return new Deferred (static function () : array {
342342 return [
343343 new Dog ('Odie ' , true ),
344344 new Cat ('Garfield ' , false ),
@@ -417,7 +417,7 @@ public function testResolveTypeOnUnionYieldsUsefulError() : void
417417 $ PetType = new UnionType ([
418418 'name ' => 'Pet ' ,
419419 'resolveType ' => static function ($ obj ) use ($ DogType , $ CatType , $ HumanType ) {
420- return new Deferred (static function () use ($ obj , $ DogType , $ CatType , $ HumanType ) {
420+ return new Deferred (static function () use ($ obj , $ DogType , $ CatType , $ HumanType ) : ? Type {
421421 if ($ obj instanceof Dog) {
422422 return $ DogType ;
423423 }
@@ -440,7 +440,7 @@ public function testResolveTypeOnUnionYieldsUsefulError() : void
440440 'fields ' => [
441441 'pets ' => [
442442 'type ' => Type::listOf ($ PetType ),
443- 'resolve ' => static function () {
443+ 'resolve ' => static function () : array {
444444 return [
445445 new Dog ('Odie ' , true ),
446446 new Cat ('Garfield ' , false ),
@@ -535,7 +535,7 @@ public function testResolveTypeAllowsResolvingWithTypeName() : void
535535 'fields ' => [
536536 'pets ' => [
537537 'type ' => Type::listOf ($ PetType ),
538- 'resolve ' => static function () {
538+ 'resolve ' => static function () : array {
539539 return [
540540 new Dog ('Odie ' , true ),
541541 new Cat ('Garfield ' , false ),
@@ -579,8 +579,8 @@ public function testResolveTypeCanBeCaught() : void
579579 {
580580 $ PetType = new InterfaceType ([
581581 'name ' => 'Pet ' ,
582- 'resolveType ' => static function () {
583- return new Deferred (static function () {
582+ 'resolveType ' => static function () : Deferred {
583+ return new Deferred (static function () : void {
584584 throw new UserError ('We are testing this error ' );
585585 });
586586 },
@@ -613,7 +613,7 @@ public function testResolveTypeCanBeCaught() : void
613613 'fields ' => [
614614 'pets ' => [
615615 'type ' => Type::listOf ($ PetType ),
616- 'resolve ' => static function () {
616+ 'resolve ' => static function () : array {
617617 return [
618618 new Dog ('Odie ' , true ),
619619 new Cat ('Garfield ' , false ),
0 commit comments