Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
6d25583
LoneAnonymouseOperation
shmax Apr 28, 2020
d7f6c30
AbstractPromiseTest
shmax Apr 28, 2020
5cc8919
AbstractPromiseTest
shmax Apr 28, 2020
61a995f
AbstractPromiseTest, AbstractTest
shmax Apr 28, 2020
8937b66
DeferredFieldsTest
shmax Apr 28, 2020
97c0a35
ExecutorLazySchemaTest
shmax Apr 29, 2020
ce0b796
ExecutorSchemaTest,ExecutorTest
shmax Apr 29, 2020
a996b43
LazyInterfaceTest
shmax Apr 29, 2020
8796571
ListsTest
shmax Apr 29, 2020
3d3e778
MutationsTest
shmax Apr 29, 2020
3d1a0b7
MutationsTest
shmax Apr 29, 2020
2ce57d3
NonNullTest
shmax Apr 29, 2020
596821c
ReactPromiseAdapterTest
shmax Apr 29, 2020
9c7f67b
SyncPromiseAdapterTest,SyncPromiseTest
shmax Apr 29, 2020
d9706d9
SyncTest
shmax Apr 29, 2020
4457985
LazyInterfaceTest
shmax Apr 29, 2020
bbf8873
ResolveTest
shmax Apr 29, 2020
6162127
Adder
shmax Apr 29, 2020
2e0dc56
Root
shmax Apr 29, 2020
fd5a739
Root
shmax Apr 29, 2020
a018420
UnionInterfaceTest
shmax Apr 29, 2020
37509ad
VariablesTest
shmax Apr 29, 2020
d239a0d
CollectorTest, GraphQLTest
shmax Apr 29, 2020
76fd042
ParserTest
shmax Apr 29, 2020
0f97882
SchemaParserTest
shmax Apr 29, 2020
2df2e3b
ExecutorSchemaTest,ExecutorTest,VisitorTest
shmax Apr 29, 2020
f7e7d77
Issue396Test
shmax Apr 29, 2020
7278077
QueryExecutionTest
shmax Apr 29, 2020
e590f63
RequestParsingTest
shmax Apr 29, 2020
8564883
RequestParsingTest
shmax Apr 29, 2020
61ed6f2
ServerConfigTest
shmax Apr 29, 2020
0d0b3ad
ServerTestCase
shmax Apr 29, 2020
6940ab6
StarWarsSchema
shmax Apr 29, 2020
95af3e3
StarWarsSchema,DefinitionTest
shmax Apr 29, 2020
6e0946f
QueryPlanTest
shmax Apr 29, 2020
63ed985
EnumTypeTest
shmax Apr 29, 2020
737d5ae
Update tests/Executor/AbstractTest.php
shmax Apr 29, 2020
4dd0279
remove flag
shmax Apr 29, 2020
2b8b40f
Merge branch 'fix-native-return-typehint-pt-ii' of https://github.com…
shmax Apr 29, 2020
fa4e4e1
Revert "remove flag"
shmax Apr 29, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
425 changes: 0 additions & 425 deletions phpstan-baseline.neon

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/Validator/Rules/LoneAnonymousOperation.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ static function (Node $definition) : bool {
NodeKind::OPERATION_DEFINITION => static function (OperationDefinitionNode $node) use (
&$operationCount,
$context
) {
) : void {
if ($node->name !== null || $operationCount <= 1) {
return;
}
Expand Down
38 changes: 19 additions & 19 deletions tests/Executor/AbstractPromiseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function testIsTypeOfUsedToResolveRuntimeTypeForInterface() : void
'name' => 'Dog',
'interfaces' => [$petType],
'isTypeOf' => static function ($obj) {
return new Deferred(static function () use ($obj) {
return new Deferred(static function () use ($obj) : bool {
return $obj instanceof Dog;
});
},
Expand All @@ -55,7 +55,7 @@ public function testIsTypeOfUsedToResolveRuntimeTypeForInterface() : void
'name' => 'Cat',
'interfaces' => [$petType],
'isTypeOf' => static function ($obj) {
return new Deferred(static function () use ($obj) {
return new Deferred(static function () use ($obj) : bool {
return $obj instanceof Cat;
});
},
Expand All @@ -71,7 +71,7 @@ public function testIsTypeOfUsedToResolveRuntimeTypeForInterface() : void
'fields' => [
'pets' => [
'type' => Type::listOf($petType),
'resolve' => static function () {
'resolve' => static function () : array {
return [
new Dog('Odie', true),
new Cat('Garfield', false),
Expand Down Expand Up @@ -124,8 +124,8 @@ public function testIsTypeOfCanBeRejected() : void
$DogType = new ObjectType([
'name' => 'Dog',
'interfaces' => [$PetType],
'isTypeOf' => static function () {
return new Deferred(static function () {
'isTypeOf' => static function () : Deferred {
return new Deferred(static function () : void {
throw new UserError('We are testing this error');
});
},
Expand All @@ -139,7 +139,7 @@ public function testIsTypeOfCanBeRejected() : void
'name' => 'Cat',
'interfaces' => [$PetType],
'isTypeOf' => static function ($obj) {
return new Deferred(static function () use ($obj) {
return new Deferred(static function () use ($obj) : bool {
return $obj instanceof Cat;
});
},
Expand All @@ -155,7 +155,7 @@ public function testIsTypeOfCanBeRejected() : void
'fields' => [
'pets' => [
'type' => Type::listOf($PetType),
'resolve' => static function () {
'resolve' => static function () : array {
return [
new Dog('Odie', true),
new Cat('Garfield', false),
Expand Down Expand Up @@ -210,7 +210,7 @@ public function testIsTypeOfUsedToResolveRuntimeTypeForUnion() : void
$dogType = new ObjectType([
'name' => 'Dog',
'isTypeOf' => static function ($obj) {
return new Deferred(static function () use ($obj) {
return new Deferred(static function () use ($obj) : bool {
return $obj instanceof Dog;
});
},
Expand All @@ -223,7 +223,7 @@ public function testIsTypeOfUsedToResolveRuntimeTypeForUnion() : void
$catType = new ObjectType([
'name' => 'Cat',
'isTypeOf' => static function ($obj) {
return new Deferred(static function () use ($obj) {
return new Deferred(static function () use ($obj) : bool {
return $obj instanceof Cat;
});
},
Expand All @@ -244,7 +244,7 @@ public function testIsTypeOfUsedToResolveRuntimeTypeForUnion() : void
'fields' => [
'pets' => [
'type' => Type::listOf($petType),
'resolve' => static function () {
'resolve' => static function () : array {
return [new Dog('Odie', true), new Cat('Garfield', false)];
},
],
Expand Down Expand Up @@ -286,8 +286,8 @@ public function testResolveTypeOnInterfaceYieldsUsefulError() : void
{
$PetType = new InterfaceType([
'name' => 'Pet',
'resolveType' => static function ($obj) use (&$DogType, &$CatType, &$HumanType) {
return new Deferred(static function () use ($obj, $DogType, $CatType, $HumanType) {
'resolveType' => static function ($obj) use (&$DogType, &$CatType, &$HumanType) : Deferred {
return new Deferred(static function () use ($obj, $DogType, $CatType, $HumanType) : ?Type {
if ($obj instanceof Dog) {
return $DogType;
}
Expand Down Expand Up @@ -338,7 +338,7 @@ public function testResolveTypeOnInterfaceYieldsUsefulError() : void
'pets' => [
'type' => Type::listOf($PetType),
'resolve' => static function () {
return new Deferred(static function () {
return new Deferred(static function () : array {
return [
new Dog('Odie', true),
new Cat('Garfield', false),
Expand Down Expand Up @@ -417,7 +417,7 @@ public function testResolveTypeOnUnionYieldsUsefulError() : void
$PetType = new UnionType([
'name' => 'Pet',
'resolveType' => static function ($obj) use ($DogType, $CatType, $HumanType) {
return new Deferred(static function () use ($obj, $DogType, $CatType, $HumanType) {
return new Deferred(static function () use ($obj, $DogType, $CatType, $HumanType) : ?Type {
if ($obj instanceof Dog) {
return $DogType;
}
Expand All @@ -440,7 +440,7 @@ public function testResolveTypeOnUnionYieldsUsefulError() : void
'fields' => [
'pets' => [
'type' => Type::listOf($PetType),
'resolve' => static function () {
'resolve' => static function () : array {
return [
new Dog('Odie', true),
new Cat('Garfield', false),
Expand Down Expand Up @@ -535,7 +535,7 @@ public function testResolveTypeAllowsResolvingWithTypeName() : void
'fields' => [
'pets' => [
'type' => Type::listOf($PetType),
'resolve' => static function () {
'resolve' => static function () : array {
return [
new Dog('Odie', true),
new Cat('Garfield', false),
Expand Down Expand Up @@ -579,8 +579,8 @@ public function testResolveTypeCanBeCaught() : void
{
$PetType = new InterfaceType([
'name' => 'Pet',
'resolveType' => static function () {
return new Deferred(static function () {
'resolveType' => static function () : Deferred {
return new Deferred(static function () : void {
throw new UserError('We are testing this error');
});
},
Expand Down Expand Up @@ -613,7 +613,7 @@ public function testResolveTypeCanBeCaught() : void
'fields' => [
'pets' => [
'type' => Type::listOf($PetType),
'resolve' => static function () {
'resolve' => static function () : array {
return [
new Dog('Odie', true),
new Cat('Garfield', false),
Expand Down
29 changes: 16 additions & 13 deletions tests/Executor/AbstractTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace GraphQL\Tests\Executor;

use GraphQL\Error\InvariantViolation;
use GraphQL\Executor\ExecutionResult;
use GraphQL\Executor\Executor;
use GraphQL\GraphQL;
Expand Down Expand Up @@ -43,7 +44,7 @@ public function testIsTypeOfUsedToResolveRuntimeTypeForInterface() : void
$dogType = new ObjectType([
'name' => 'Dog',
'interfaces' => [$petType],
'isTypeOf' => static function ($obj) {
'isTypeOf' => static function ($obj) : bool {
return $obj instanceof Dog;
},
'fields' => [
Expand All @@ -55,7 +56,7 @@ public function testIsTypeOfUsedToResolveRuntimeTypeForInterface() : void
$catType = new ObjectType([
'name' => 'Cat',
'interfaces' => [$petType],
'isTypeOf' => static function ($obj) {
'isTypeOf' => static function ($obj) : bool {
return $obj instanceof Cat;
},
'fields' => [
Expand All @@ -70,7 +71,7 @@ public function testIsTypeOfUsedToResolveRuntimeTypeForInterface() : void
'fields' => [
'pets' => [
'type' => Type::listOf($petType),
'resolve' => static function () {
'resolve' => static function () : array {
return [new Dog('Odie', true), new Cat('Garfield', false)];
},
],
Expand Down Expand Up @@ -109,7 +110,7 @@ public function testIsTypeOfUsedToResolveRuntimeTypeForUnion() : void
{
$dogType = new ObjectType([
'name' => 'Dog',
'isTypeOf' => static function ($obj) {
'isTypeOf' => static function ($obj) : bool {
return $obj instanceof Dog;
},
'fields' => [
Expand All @@ -120,7 +121,7 @@ public function testIsTypeOfUsedToResolveRuntimeTypeForUnion() : void

$catType = new ObjectType([
'name' => 'Cat',
'isTypeOf' => static function ($obj) {
'isTypeOf' => static function ($obj) : bool {
return $obj instanceof Cat;
},
'fields' => [
Expand All @@ -140,7 +141,7 @@ public function testIsTypeOfUsedToResolveRuntimeTypeForUnion() : void
'fields' => [
'pets' => [
'type' => Type::listOf($petType),
'resolve' => static function () {
'resolve' => static function () : array {
return [new Dog('Odie', true), new Cat('Garfield', false)];
},
],
Expand Down Expand Up @@ -230,7 +231,7 @@ public function testResolveTypeOnInterfaceYieldsUsefulError() : void
'fields' => [
'pets' => [
'type' => Type::listOf($PetType),
'resolve' => static function () {
'resolve' => static function () : array {
return [
new Dog('Odie', true),
new Cat('Garfield', false),
Expand Down Expand Up @@ -305,7 +306,7 @@ public function testResolveTypeOnUnionYieldsUsefulError() : void

$PetType = new UnionType([
'name' => 'Pet',
'resolveType' => static function ($obj) use ($DogType, $CatType, $HumanType) {
'resolveType' => static function ($obj) use ($DogType, $CatType, $HumanType) : Type {
if ($obj instanceof Dog) {
return $DogType;
}
Expand All @@ -315,6 +316,8 @@ public function testResolveTypeOnUnionYieldsUsefulError() : void
if ($obj instanceof Human) {
return $HumanType;
}

throw new InvariantViolation('Invalid type');
},
'types' => [$DogType, $CatType],
]);
Expand All @@ -325,7 +328,7 @@ public function testResolveTypeOnUnionYieldsUsefulError() : void
'fields' => [
'pets' => [
'type' => Type::listOf($PetType),
'resolve' => static function () {
'resolve' => static function () : array {
return [
new Dog('Odie', true),
new Cat('Garfield', false),
Expand Down Expand Up @@ -383,7 +386,7 @@ public function testReturningInvalidValueFromResolveTypeYieldsUsefulError() : vo
$fooInterface = new InterfaceType([
'name' => 'FooInterface',
'fields' => ['bar' => ['type' => Type::string()]],
'resolveType' => static function () {
'resolveType' => static function () : array {
return [];
},
]);
Expand All @@ -400,7 +403,7 @@ public function testReturningInvalidValueFromResolveTypeYieldsUsefulError() : vo
'fields' => [
'foo' => [
'type' => $fooInterface,
'resolve' => static function () {
'resolve' => static function () : string {
return 'dummy';
},
],
Expand Down Expand Up @@ -476,7 +479,7 @@ public function testResolveTypeAllowsResolvingWithTypeName() : void
'fields' => [
'pets' => [
'type' => Type::listOf($PetType),
'resolve' => static function () {
'resolve' => static function () : array {
return [
new Dog('Odie', true),
new Cat('Garfield', false),
Expand Down Expand Up @@ -523,7 +526,7 @@ public function testHintsOnConflictingTypeInstancesInResolveType() : void
'fields' => [
'a' => Type::string(),
],
'interfaces' => static function () use ($iface) {
'interfaces' => static function () use ($iface) : array {
return [$iface];
},
]);
Expand Down
20 changes: 10 additions & 10 deletions tests/Executor/DeferredFieldsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ public function setUp() : void

return Utils::filter(
$this->storyDataSource,
static function ($story) use ($category) {
static function ($story) use ($category) : bool {
return in_array($category['id'], $story['categoryIds'], true);
}
);
Expand Down Expand Up @@ -192,23 +192,23 @@ static function ($story) use ($category) {

return Utils::filter(
$this->storyDataSource,
static function ($story) {
static function ($story) : bool {
return $story['id'] % 2 === 1;
}
);
},
],
'featuredCategory' => [
'type' => $this->categoryType,
'resolve' => function ($rootValue, $args, $context, ResolveInfo $info) {
'resolve' => function ($rootValue, $args, $context, ResolveInfo $info) : array {
$this->paths[] = $info->path;

return $this->categoryDataSource[0];
},
],
'categories' => [
'type' => Type::listOf($this->categoryType),
'resolve' => function ($rootValue, $args, $context, ResolveInfo $info) {
'resolve' => function ($rootValue, $args, $context, ResolveInfo $info) : array {
$this->paths[] = $info->path;

return $this->categoryDataSource;
Expand Down Expand Up @@ -403,7 +403,7 @@ public function testComplexRecursiveDeferredFields() : void
return [
'sync' => [
'type' => Type::string(),
'resolve' => function ($complexType, $args, $context, ResolveInfo $info) {
'resolve' => function ($complexType, $args, $context, ResolveInfo $info) : string {
$this->paths[] = $info->path;

return 'sync';
Expand All @@ -414,7 +414,7 @@ public function testComplexRecursiveDeferredFields() : void
'resolve' => function ($complexType, $args, $context, ResolveInfo $info) {
$this->paths[] = $info->path;

return new Deferred(function () use ($info) {
return new Deferred(function () use ($info) : string {
$this->paths[] = ['!dfd for: ', $info->path];

return 'deferred';
Expand All @@ -423,7 +423,7 @@ public function testComplexRecursiveDeferredFields() : void
],
'nest' => [
'type' => $complexType,
'resolve' => function ($complexType, $args, $context, ResolveInfo $info) {
'resolve' => function ($complexType, $args, $context, ResolveInfo $info) : array {
$this->paths[] = $info->path;

return [];
Expand All @@ -434,7 +434,7 @@ public function testComplexRecursiveDeferredFields() : void
'resolve' => function ($complexType, $args, $context, ResolveInfo $info) {
$this->paths[] = $info->path;

return new Deferred(function () use ($info) {
return new Deferred(function () use ($info) : array {
$this->paths[] = ['!dfd nest for: ', $info->path];

return [];
Expand Down Expand Up @@ -635,7 +635,7 @@ private function findStoryById($id)
{
return Utils::find(
$this->storyDataSource,
static function ($story) use ($id) {
static function ($story) use ($id) : bool {
return $story['id'] === $id;
}
);
Expand All @@ -645,7 +645,7 @@ private function findUserById($id)
{
return Utils::find(
$this->userDataSource,
static function ($user) use ($id) {
static function ($user) use ($id) : bool {
return $user['id'] === $id;
}
);
Expand Down
Loading