1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Digia\GraphQL\Execution\Resolver; |
4
|
|
|
|
5
|
|
|
use Digia\GraphQL\Execution\ResponsePath; |
6
|
|
|
use Digia\GraphQL\Language\Node\FieldNode; |
7
|
|
|
use Digia\GraphQL\Language\Node\OperationDefinitionNode; |
8
|
|
|
use Digia\GraphQL\Type\Definition\ObjectType; |
9
|
|
|
use Digia\GraphQL\Type\Definition\OutputTypeInterface; |
10
|
|
|
use Digia\GraphQL\Type\Definition\TypeInterface; |
11
|
|
|
use Digia\GraphQL\Type\SchemaInterface; |
12
|
|
|
|
13
|
|
|
class ResolveInfo |
14
|
|
|
{ |
15
|
|
|
/** |
16
|
|
|
* @var string |
17
|
|
|
*/ |
18
|
|
|
protected $fieldName; |
19
|
|
|
|
20
|
|
|
/** |
21
|
|
|
* @var FieldNode[] |
22
|
|
|
*/ |
23
|
|
|
protected $fieldNodes; |
24
|
|
|
|
25
|
|
|
/** |
26
|
|
|
* @var OutputTypeInterface |
27
|
|
|
*/ |
28
|
|
|
protected $returnType; |
29
|
|
|
|
30
|
|
|
/** |
31
|
|
|
* @var ObjectType |
32
|
|
|
*/ |
33
|
|
|
protected $parentType; |
34
|
|
|
|
35
|
|
|
/** |
36
|
|
|
* @var ResponsePath |
37
|
|
|
*/ |
38
|
|
|
protected $path; |
39
|
|
|
|
40
|
|
|
/** |
41
|
|
|
* @var SchemaInterface |
42
|
|
|
*/ |
43
|
|
|
protected $schema; |
44
|
|
|
|
45
|
|
|
/** |
46
|
|
|
* @var array |
47
|
|
|
*/ |
48
|
|
|
protected $fragments; |
49
|
|
|
|
50
|
|
|
/** |
51
|
|
|
* @var mixed |
52
|
|
|
*/ |
53
|
|
|
protected $rootValue; |
54
|
|
|
|
55
|
|
|
/** |
56
|
|
|
* @var OperationDefinitionNode |
57
|
|
|
*/ |
58
|
|
|
protected $operation; |
59
|
|
|
|
60
|
|
|
/** |
61
|
|
|
* @var array |
62
|
|
|
*/ |
63
|
|
|
protected $variableValues; |
64
|
|
|
|
65
|
|
|
/** |
66
|
|
|
* ResolveInfo constructor. |
67
|
|
|
* @param string $fieldName |
68
|
|
|
* @param FieldNode[] $fieldNodes |
69
|
|
|
* @param TypeInterface $returnType |
70
|
|
|
* @param ObjectType $parentType |
71
|
|
|
* @param array|null $path |
72
|
|
|
* @param SchemaInterface $schema |
73
|
|
|
* @param array $fragments |
74
|
|
|
* @param mixed $rootValue |
75
|
|
|
* @param OperationDefinitionNode $operation |
76
|
|
|
* @param array $variableValues |
77
|
|
|
*/ |
78
|
|
|
public function __construct( |
79
|
|
|
string $fieldName, |
80
|
|
|
?array $fieldNodes, |
81
|
|
|
TypeInterface $returnType, |
82
|
|
|
ObjectType $parentType, |
83
|
|
|
?array $path, |
84
|
|
|
SchemaInterface $schema, |
85
|
|
|
array $fragments, |
86
|
|
|
$rootValue, |
87
|
|
|
OperationDefinitionNode $operation, |
88
|
|
|
array $variableValues |
89
|
|
|
) { |
90
|
|
|
$this->fieldName = $fieldName; |
91
|
|
|
$this->fieldNodes = $fieldNodes; |
92
|
|
|
$this->returnType = $returnType; |
|
|
|
|
93
|
|
|
$this->parentType = $parentType; |
94
|
|
|
$this->path = $path; |
|
|
|
|
95
|
|
|
$this->schema = $schema; |
96
|
|
|
$this->fragments = $fragments; |
97
|
|
|
$this->rootValue = $rootValue; |
98
|
|
|
$this->operation = $operation; |
99
|
|
|
$this->variableValues = $variableValues; |
100
|
|
|
} |
101
|
|
|
|
102
|
|
|
|
103
|
|
|
/** |
104
|
|
|
* @return string |
105
|
|
|
*/ |
106
|
|
|
public function getFieldName(): string |
107
|
|
|
{ |
108
|
|
|
return $this->fieldName; |
109
|
|
|
} |
110
|
|
|
|
111
|
|
|
/** |
112
|
|
|
* @return FieldNode[] |
113
|
|
|
*/ |
114
|
|
|
public function getFieldNodes(): array |
115
|
|
|
{ |
116
|
|
|
return $this->fieldNodes; |
117
|
|
|
} |
118
|
|
|
|
119
|
|
|
/** |
120
|
|
|
* @return OutputTypeInterface |
121
|
|
|
*/ |
122
|
|
|
public function getReturnType(): OutputTypeInterface |
123
|
|
|
{ |
124
|
|
|
return $this->returnType; |
125
|
|
|
} |
126
|
|
|
|
127
|
|
|
/** |
128
|
|
|
* @return ObjectType |
129
|
|
|
*/ |
130
|
|
|
public function getParentType(): ObjectType |
131
|
|
|
{ |
132
|
|
|
return $this->parentType; |
133
|
|
|
} |
134
|
|
|
|
135
|
|
|
/** |
136
|
|
|
* @return ResponsePath |
137
|
|
|
*/ |
138
|
|
|
public function getPath(): ResponsePath |
139
|
|
|
{ |
140
|
|
|
return $this->path; |
141
|
|
|
} |
142
|
|
|
|
143
|
|
|
/** |
144
|
|
|
* @return SchemaInterface |
145
|
|
|
*/ |
146
|
|
|
public function getSchema(): SchemaInterface |
147
|
|
|
{ |
148
|
|
|
return $this->schema; |
149
|
|
|
} |
150
|
|
|
|
151
|
|
|
/** |
152
|
|
|
* @return array |
153
|
|
|
*/ |
154
|
|
|
public function getFragments(): array |
155
|
|
|
{ |
156
|
|
|
return $this->fragments; |
157
|
|
|
} |
158
|
|
|
|
159
|
|
|
/** |
160
|
|
|
* @return mixed |
161
|
|
|
*/ |
162
|
|
|
public function getRootValue() |
163
|
|
|
{ |
164
|
|
|
return $this->rootValue; |
165
|
|
|
} |
166
|
|
|
|
167
|
|
|
/** |
168
|
|
|
* @return OperationDefinitionNode |
169
|
|
|
*/ |
170
|
|
|
public function getOperation(): OperationDefinitionNode |
171
|
|
|
{ |
172
|
|
|
return $this->operation; |
173
|
|
|
} |
174
|
|
|
|
175
|
|
|
/** |
176
|
|
|
* @return array |
177
|
|
|
*/ |
178
|
|
|
public function getVariableValues(): array |
179
|
|
|
{ |
180
|
|
|
return $this->variableValues; |
181
|
|
|
} |
182
|
|
|
} |
183
|
|
|
|
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..