|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Digia\GraphQL\Schema\Building; |
|
4
|
|
|
|
|
5
|
|
|
use Digia\GraphQL\Language\Node\DocumentNode; |
|
6
|
|
|
use Digia\GraphQL\Schema\Building\BuilderContextCreatorInterface; |
|
|
|
|
|
|
7
|
|
|
use Digia\GraphQL\Schema\Building\SchemaBuilderInterface; |
|
8
|
|
|
use Digia\GraphQL\Schema\DefinitionBuilderCreatorInterface; |
|
9
|
|
|
use Digia\GraphQL\Schema\ResolverRegistryInterface; |
|
10
|
|
|
use Digia\GraphQL\Schema\SchemaInterface; |
|
11
|
|
|
use function Digia\GraphQL\Type\newSchema; |
|
12
|
|
|
|
|
13
|
|
|
class SchemaBuilder implements SchemaBuilderInterface |
|
14
|
|
|
{ |
|
15
|
|
|
/** |
|
16
|
|
|
* @var DefinitionBuilderCreatorInterface |
|
17
|
|
|
*/ |
|
18
|
|
|
protected $definitionBuilderCreator; |
|
19
|
|
|
|
|
20
|
|
|
/** |
|
21
|
|
|
* BuilderContextCreator constructor. |
|
22
|
|
|
* @param DefinitionBuilderCreatorInterface $definitionBuilderCreator |
|
23
|
|
|
*/ |
|
24
|
|
|
public function __construct(DefinitionBuilderCreatorInterface $definitionBuilderCreator) |
|
25
|
|
|
{ |
|
26
|
|
|
$this->definitionBuilderCreator = $definitionBuilderCreator; |
|
27
|
|
|
} |
|
28
|
|
|
|
|
29
|
|
|
/** |
|
30
|
|
|
* @inheritdoc |
|
31
|
|
|
*/ |
|
32
|
|
|
public function build( |
|
33
|
|
|
DocumentNode $document, |
|
34
|
|
|
ResolverRegistryInterface $resolverRegistry, |
|
35
|
|
|
array $options = [] |
|
36
|
|
|
): SchemaInterface { |
|
37
|
|
|
$context = $this->createContext($document, $resolverRegistry); |
|
38
|
|
|
|
|
39
|
|
|
return newSchema([ |
|
40
|
|
|
'query' => $context->buildQueryType(), |
|
41
|
|
|
'mutation' => $context->buildMutationType(), |
|
42
|
|
|
'subscription' => $context->buildSubscriptionType(), |
|
43
|
|
|
'types' => $context->buildTypes(), |
|
44
|
|
|
'directives' => $context->buildDirectives(), |
|
45
|
|
|
'astNode' => $context->getSchemaDefinition(), |
|
46
|
|
|
'assumeValid' => $options['assumeValid'] ?? false, |
|
47
|
|
|
]); |
|
48
|
|
|
} |
|
49
|
|
|
|
|
50
|
|
|
/** |
|
51
|
|
|
* @inheritdoc |
|
52
|
|
|
*/ |
|
53
|
|
|
public function createContext( |
|
54
|
|
|
DocumentNode $document, |
|
55
|
|
|
ResolverRegistryInterface $resolverRegistry |
|
56
|
|
|
): BuildingContextInterface { |
|
57
|
|
|
$context = new BuildingContext($document, $resolverRegistry, $this->definitionBuilderCreator); |
|
58
|
|
|
|
|
59
|
|
|
$context->boot(); |
|
60
|
|
|
|
|
61
|
|
|
return $context; |
|
62
|
|
|
} |
|
63
|
|
|
} |
|
64
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths