Skip to content

Remember initial types instead of lazy-loading #1697

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
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
4 changes: 4 additions & 0 deletions src/Type/Schema.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,10 @@
$this->extensionASTNodes = $config->extensionASTNodes;

$this->config = $config;

foreach ($this->config->types as $type) {

Check failure on line 103 in src/Type/Schema.php

View workflow job for this annotation

GitHub Actions / Static Analysis with PHPStan (7.4)

Argument of an invalid type (callable)|iterable<(callable&GraphQL\Type\Definition\NamedType)|(GraphQL\Type\Definition\NamedType&GraphQL\Type\Definition\Type)> supplied for foreach, only iterables are supported.

Check failure on line 103 in src/Type/Schema.php

View workflow job for this annotation

GitHub Actions / Static Analysis with PHPStan (8.0)

Argument of an invalid type (callable)|iterable<(callable&GraphQL\Type\Definition\NamedType)|(GraphQL\Type\Definition\NamedType&GraphQL\Type\Definition\Type)> supplied for foreach, only iterables are supported.

Check failure on line 103 in src/Type/Schema.php

View workflow job for this annotation

GitHub Actions / Static Analysis with PHPStan (8.1)

Argument of an invalid type (callable)|iterable<(callable&GraphQL\Type\Definition\NamedType)|(GraphQL\Type\Definition\NamedType&GraphQL\Type\Definition\Type)> supplied for foreach, only iterables are supported.

Check failure on line 103 in src/Type/Schema.php

View workflow job for this annotation

GitHub Actions / Static Analysis with PHPStan (8.2)

Argument of an invalid type (callable)|iterable<(callable&GraphQL\Type\Definition\NamedType)|(GraphQL\Type\Definition\NamedType&GraphQL\Type\Definition\Type)> supplied for foreach, only iterables are supported.

Check failure on line 103 in src/Type/Schema.php

View workflow job for this annotation

GitHub Actions / Static Analysis with PHPStan (8.3)

Argument of an invalid type (callable)|iterable<(callable&GraphQL\Type\Definition\NamedType)|(GraphQL\Type\Definition\NamedType&GraphQL\Type\Definition\Type)> supplied for foreach, only iterables are supported.

Check failure on line 103 in src/Type/Schema.php

View workflow job for this annotation

GitHub Actions / Static Analysis with PHPStan (8.4)

Argument of an invalid type (callable)|iterable<(callable&GraphQL\Type\Definition\NamedType)|(GraphQL\Type\Definition\NamedType&GraphQL\Type\Definition\Type)> supplied for foreach, only iterables are supported.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Users may specify types in a multitude of ways, its type is iterable<Type&NamedType>|(callable(): iterable<Type&NamedType>)|iterable<(callable(): Type&NamedType)>|(callable(): iterable<(callable(): Type&NamedType)>). The code you wrote does not work with some of those options.

$this->resolvedTypes[$type->name()] = $type;

Check failure on line 104 in src/Type/Schema.php

View workflow job for this annotation

GitHub Actions / Static Analysis with PHPStan (7.4)

Property GraphQL\Type\Schema::$resolvedTypes (array<string, GraphQL\Type\Definition\NamedType&GraphQL\Type\Definition\Type>) does not accept array<string, (callable&GraphQL\Type\Definition\NamedType)|(GraphQL\Type\Definition\NamedType&GraphQL\Type\Definition\Type)>.

Check failure on line 104 in src/Type/Schema.php

View workflow job for this annotation

GitHub Actions / Static Analysis with PHPStan (8.0)

Property GraphQL\Type\Schema::$resolvedTypes (array<string, GraphQL\Type\Definition\NamedType&GraphQL\Type\Definition\Type>) does not accept array<string, (callable&GraphQL\Type\Definition\NamedType)|(GraphQL\Type\Definition\NamedType&GraphQL\Type\Definition\Type)>.

Check failure on line 104 in src/Type/Schema.php

View workflow job for this annotation

GitHub Actions / Static Analysis with PHPStan (8.1)

Property GraphQL\Type\Schema::$resolvedTypes (array<string, GraphQL\Type\Definition\NamedType&GraphQL\Type\Definition\Type>) does not accept array<string, (callable&GraphQL\Type\Definition\NamedType)|(GraphQL\Type\Definition\NamedType&GraphQL\Type\Definition\Type)>.

Check failure on line 104 in src/Type/Schema.php

View workflow job for this annotation

GitHub Actions / Static Analysis with PHPStan (8.2)

Property GraphQL\Type\Schema::$resolvedTypes (array<string, GraphQL\Type\Definition\NamedType&GraphQL\Type\Definition\Type>) does not accept array<string, (callable&GraphQL\Type\Definition\NamedType)|(GraphQL\Type\Definition\NamedType&GraphQL\Type\Definition\Type)>.

Check failure on line 104 in src/Type/Schema.php

View workflow job for this annotation

GitHub Actions / Static Analysis with PHPStan (8.3)

Property GraphQL\Type\Schema::$resolvedTypes (array<string, GraphQL\Type\Definition\NamedType&GraphQL\Type\Definition\Type>) does not accept array<string, (callable&GraphQL\Type\Definition\NamedType)|(GraphQL\Type\Definition\NamedType&GraphQL\Type\Definition\Type)>.

Check failure on line 104 in src/Type/Schema.php

View workflow job for this annotation

GitHub Actions / Static Analysis with PHPStan (8.4)

Property GraphQL\Type\Schema::$resolvedTypes (array<string, GraphQL\Type\Definition\NamedType&GraphQL\Type\Definition\Type>) does not accept array<string, (callable&GraphQL\Type\Definition\NamedType)|(GraphQL\Type\Definition\NamedType&GraphQL\Type\Definition\Type)>.
}
}

/**
Expand Down
Loading