@@ -56,13 +56,13 @@ |
||
56 | 56 | * @param mixed $fieldResolver |
57 | 57 | */ |
58 | 58 | public function __construct( |
59 | - Schema $schema, |
|
60 | - DocumentNode $document, |
|
61 | - $rootValue, |
|
62 | - $contextValue, |
|
63 | - array $variableValues, |
|
64 | - OperationDefinitionNode $operation, |
|
65 | - $fieldResolver |
|
59 | + Schema $schema, |
|
60 | + DocumentNode $document, |
|
61 | + $rootValue, |
|
62 | + $contextValue, |
|
63 | + array $variableValues, |
|
64 | + OperationDefinitionNode $operation, |
|
65 | + $fieldResolver |
|
66 | 66 | ) { |
67 | 67 | $this->schema = $schema; |
68 | 68 | $this->document = $document; |
@@ -42,23 +42,23 @@ |
||
42 | 42 | * @throws \Exception |
43 | 43 | */ |
44 | 44 | public function execute( |
45 | - Schema $schema, |
|
46 | - DocumentNode $documentNode, |
|
47 | - $rootValue = null, |
|
48 | - $contextValue = null, |
|
49 | - $variableValues = [], |
|
50 | - $operationName = null, |
|
51 | - callable $fieldResolver = null |
|
45 | + Schema $schema, |
|
46 | + DocumentNode $documentNode, |
|
47 | + $rootValue = null, |
|
48 | + $contextValue = null, |
|
49 | + $variableValues = [], |
|
50 | + $operationName = null, |
|
51 | + callable $fieldResolver = null |
|
52 | 52 | ): ExecutionResult { |
53 | 53 | try { |
54 | 54 | $context = $this->contextBuilder->buildContext( |
55 | - $schema, |
|
56 | - $documentNode, |
|
57 | - $rootValue, |
|
58 | - $contextValue, |
|
59 | - $variableValues, |
|
60 | - $operationName, |
|
61 | - $fieldResolver |
|
55 | + $schema, |
|
56 | + $documentNode, |
|
57 | + $rootValue, |
|
58 | + $contextValue, |
|
59 | + $variableValues, |
|
60 | + $operationName, |
|
61 | + $fieldResolver |
|
62 | 62 | ); |
63 | 63 | |
64 | 64 | // Return early errors if execution context failed. |
@@ -20,12 +20,12 @@ |
||
20 | 20 | * @return mixed |
21 | 21 | */ |
22 | 22 | public function execute( |
23 | - Schema $schema, |
|
24 | - DocumentNode $documentNode, |
|
25 | - $rootValue = null, |
|
26 | - $contextValue = null, |
|
27 | - $variableValues = [], |
|
28 | - $operationName = null, |
|
29 | - callable $fieldResolver = null |
|
23 | + Schema $schema, |
|
24 | + DocumentNode $documentNode, |
|
25 | + $rootValue = null, |
|
26 | + $contextValue = null, |
|
27 | + $variableValues = [], |
|
28 | + $operationName = null, |
|
29 | + callable $fieldResolver = null |
|
30 | 30 | ): ExecutionResult; |
31 | 31 | } |
@@ -26,10 +26,10 @@ discard block |
||
26 | 26 | $visitedFragmentNames = []; |
27 | 27 | try { |
28 | 28 | $fields = $this->collectFields( |
29 | - $objectType, |
|
30 | - $this->operation->getSelectionSet(), |
|
31 | - $fields, |
|
32 | - $visitedFragmentNames |
|
29 | + $objectType, |
|
30 | + $this->operation->getSelectionSet(), |
|
31 | + $fields, |
|
32 | + $visitedFragmentNames |
|
33 | 33 | ); |
34 | 34 | |
35 | 35 | $result = ($operation === 'mutation') |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | |
41 | 41 | } catch (\Exception $ex) { |
42 | 42 | $this->context->addError( |
43 | - new ExecutionException($ex->getMessage()) |
|
43 | + new ExecutionException($ex->getMessage()) |
|
44 | 44 | ); |
45 | 45 | |
46 | 46 | //@TODO return [null] |
@@ -23,9 +23,9 @@ discard block |
||
23 | 23 | * @throws InvariantException |
24 | 24 | */ |
25 | 25 | function buildSchema( |
26 | - $source, |
|
27 | - $resolverRegistry = [], |
|
28 | - array $options = [] |
|
26 | + $source, |
|
27 | + $resolverRegistry = [], |
|
28 | + array $options = [] |
|
29 | 29 | ): SchemaInterface { |
30 | 30 | return GraphQL::buildSchema($source, $resolverRegistry, $options); |
31 | 31 | } |
@@ -40,10 +40,10 @@ discard block |
||
40 | 40 | * @throws InvariantException |
41 | 41 | */ |
42 | 42 | function extendSchema( |
43 | - SchemaInterface $schema, |
|
44 | - $source, |
|
45 | - $resolverRegistry = [], |
|
46 | - array $options = [] |
|
43 | + SchemaInterface $schema, |
|
44 | + $source, |
|
45 | + $resolverRegistry = [], |
|
46 | + array $options = [] |
|
47 | 47 | ): SchemaInterface { |
48 | 48 | return GraphQL::extendSchema($schema, $source, $resolverRegistry, $options); |
49 | 49 | } |
@@ -120,22 +120,22 @@ discard block |
||
120 | 120 | * @return ExecutionResult |
121 | 121 | */ |
122 | 122 | function execute( |
123 | - SchemaInterface $schema, |
|
124 | - DocumentNode $document, |
|
125 | - $rootValue = null, |
|
126 | - $contextValue = null, |
|
127 | - array $variableValues = [], |
|
128 | - $operationName = null, |
|
129 | - callable $fieldResolver = null |
|
123 | + SchemaInterface $schema, |
|
124 | + DocumentNode $document, |
|
125 | + $rootValue = null, |
|
126 | + $contextValue = null, |
|
127 | + array $variableValues = [], |
|
128 | + $operationName = null, |
|
129 | + callable $fieldResolver = null |
|
130 | 130 | ): ExecutionResult { |
131 | 131 | return GraphQL::execute( |
132 | - $schema, |
|
133 | - $document, |
|
134 | - $rootValue, |
|
135 | - $contextValue, |
|
136 | - $variableValues, |
|
137 | - $operationName, |
|
138 | - $fieldResolver |
|
132 | + $schema, |
|
133 | + $document, |
|
134 | + $rootValue, |
|
135 | + $contextValue, |
|
136 | + $variableValues, |
|
137 | + $operationName, |
|
138 | + $fieldResolver |
|
139 | 139 | ); |
140 | 140 | } |
141 | 141 | |
@@ -162,13 +162,13 @@ discard block |
||
162 | 162 | * @throws InvariantException |
163 | 163 | */ |
164 | 164 | function graphql( |
165 | - SchemaInterface $schema, |
|
166 | - string $source, |
|
167 | - $rootValue = null, |
|
168 | - $contextValue = null, |
|
169 | - array $variableValues = [], |
|
170 | - $operationName = null, |
|
171 | - callable $fieldResolver = null |
|
165 | + SchemaInterface $schema, |
|
166 | + string $source, |
|
167 | + $rootValue = null, |
|
168 | + $contextValue = null, |
|
169 | + array $variableValues = [], |
|
170 | + $operationName = null, |
|
171 | + callable $fieldResolver = null |
|
172 | 172 | ): array { |
173 | 173 | $schemaValidationErrors = validateSchema($schema); |
174 | 174 | if (!empty($schemaValidationErrors)) { |
@@ -189,13 +189,13 @@ discard block |
||
189 | 189 | } |
190 | 190 | |
191 | 191 | $result = execute( |
192 | - $schema, |
|
193 | - $document, |
|
194 | - $rootValue, |
|
195 | - $contextValue, |
|
196 | - $variableValues, |
|
197 | - $operationName, |
|
198 | - $fieldResolver |
|
192 | + $schema, |
|
193 | + $document, |
|
194 | + $rootValue, |
|
195 | + $contextValue, |
|
196 | + $variableValues, |
|
197 | + $operationName, |
|
198 | + $fieldResolver |
|
199 | 199 | ); |
200 | 200 | |
201 | 201 | return $result->toArray(); |
@@ -81,19 +81,19 @@ discard block |
||
81 | 81 | * @var array |
82 | 82 | */ |
83 | 83 | private static $providers = [ |
84 | - CacheProvider::class, |
|
85 | - LanguageProvider::class, |
|
86 | - SchemaBuildingProvider::class, |
|
87 | - SchemaExtensionProvider::class, |
|
88 | - SchemaValidationProvider::class, |
|
89 | - CoercerProvider::class, |
|
90 | - IntrospectionProvider::class, |
|
91 | - ScalarTypesProvider::class, |
|
92 | - DirectivesProvider::class, |
|
93 | - RulesProvider::class, |
|
94 | - ValidationProvider::class, |
|
95 | - ExecutionProvider::class, |
|
96 | - UtilityProvider::class, |
|
84 | + CacheProvider::class, |
|
85 | + LanguageProvider::class, |
|
86 | + SchemaBuildingProvider::class, |
|
87 | + SchemaExtensionProvider::class, |
|
88 | + SchemaValidationProvider::class, |
|
89 | + CoercerProvider::class, |
|
90 | + IntrospectionProvider::class, |
|
91 | + ScalarTypesProvider::class, |
|
92 | + DirectivesProvider::class, |
|
93 | + RulesProvider::class, |
|
94 | + ValidationProvider::class, |
|
95 | + ExecutionProvider::class, |
|
96 | + UtilityProvider::class, |
|
97 | 97 | ]; |
98 | 98 | |
99 | 99 | /** |
@@ -137,18 +137,18 @@ discard block |
||
137 | 137 | * @throws InvariantException |
138 | 138 | */ |
139 | 139 | public static function buildSchema( |
140 | - $source, |
|
141 | - $resolverRegistry, |
|
142 | - array $options = [] |
|
140 | + $source, |
|
141 | + $resolverRegistry, |
|
142 | + array $options = [] |
|
143 | 143 | ): SchemaInterface { |
144 | 144 | return static::make(SchemaBuilderInterface::class) |
145 | - ->build( |
|
145 | + ->build( |
|
146 | 146 | static::parse($source, $options), |
147 | 147 | $resolverRegistry instanceof ResolverRegistryInterface |
148 | 148 | ? $resolverRegistry |
149 | 149 | : new ResolverRegistry($resolverRegistry), |
150 | 150 | $options |
151 | - ); |
|
151 | + ); |
|
152 | 152 | } |
153 | 153 | |
154 | 154 | /** |
@@ -160,8 +160,8 @@ discard block |
||
160 | 160 | public static function make(string $id, array $args = []) |
161 | 161 | { |
162 | 162 | return static::getInstance() |
163 | - ->getContainer() |
|
164 | - ->get($id, $args); |
|
163 | + ->getContainer() |
|
164 | + ->get($id, $args); |
|
165 | 165 | } |
166 | 166 | |
167 | 167 | /** |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | public static function parse($source, array $options = []): DocumentNode |
195 | 195 | { |
196 | 196 | return static::make(ParserInterface::class) |
197 | - ->parse(static::lex($source, $options)); |
|
197 | + ->parse(static::lex($source, $options)); |
|
198 | 198 | } |
199 | 199 | |
200 | 200 | /** |
@@ -208,8 +208,8 @@ discard block |
||
208 | 208 | { |
209 | 209 | // TODO: Introduce a LexerCreator to allow setting source and options via the constructor. |
210 | 210 | return static::make(LexerInterface::class) |
211 | - ->setSource($source instanceof Source ? $source : new Source($source)) |
|
212 | - ->setOptions($options); |
|
211 | + ->setSource($source instanceof Source ? $source : new Source($source)) |
|
212 | + ->setOptions($options); |
|
213 | 213 | } |
214 | 214 | |
215 | 215 | /** |
@@ -222,20 +222,20 @@ discard block |
||
222 | 222 | * @throws InvariantException |
223 | 223 | */ |
224 | 224 | public static function extendSchema( |
225 | - SchemaInterface $schema, |
|
226 | - $source, |
|
227 | - $resolverRegistry, |
|
228 | - array $options = [] |
|
225 | + SchemaInterface $schema, |
|
226 | + $source, |
|
227 | + $resolverRegistry, |
|
228 | + array $options = [] |
|
229 | 229 | ): SchemaInterface { |
230 | 230 | return static::make(SchemaExtenderInterface::class) |
231 | - ->extend( |
|
231 | + ->extend( |
|
232 | 232 | $schema, |
233 | 233 | static::parse($source, $options), |
234 | 234 | $resolverRegistry instanceof ResolverRegistryInterface |
235 | 235 | ? $resolverRegistry |
236 | 236 | : new ResolverRegistry($resolverRegistry), |
237 | 237 | $options |
238 | - ); |
|
238 | + ); |
|
239 | 239 | } |
240 | 240 | |
241 | 241 | /** |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | public static function validateSchema(SchemaInterface $schema): array |
247 | 247 | { |
248 | 248 | return static::make(SchemaValidatorInterface::class) |
249 | - ->validate($schema); |
|
249 | + ->validate($schema); |
|
250 | 250 | } |
251 | 251 | |
252 | 252 | /** |
@@ -257,11 +257,11 @@ discard block |
||
257 | 257 | * @throws InvariantException |
258 | 258 | */ |
259 | 259 | public static function parseValue( |
260 | - $source, |
|
261 | - array $options = [] |
|
260 | + $source, |
|
261 | + array $options = [] |
|
262 | 262 | ): ValueNodeInterface { |
263 | 263 | return static::make(ParserInterface::class) |
264 | - ->parseValue(static::lex($source, $options)); |
|
264 | + ->parseValue(static::lex($source, $options)); |
|
265 | 265 | } |
266 | 266 | |
267 | 267 | /** |
@@ -272,11 +272,11 @@ discard block |
||
272 | 272 | * @throws InvariantException |
273 | 273 | */ |
274 | 274 | public static function parseType( |
275 | - $source, |
|
276 | - array $options = [] |
|
275 | + $source, |
|
276 | + array $options = [] |
|
277 | 277 | ): TypeNodeInterface { |
278 | 278 | return static::make(ParserInterface::class) |
279 | - ->parseType(static::lex($source, $options)); |
|
279 | + ->parseType(static::lex($source, $options)); |
|
280 | 280 | } |
281 | 281 | |
282 | 282 | /** |
@@ -286,11 +286,11 @@ discard block |
||
286 | 286 | * @return array |
287 | 287 | */ |
288 | 288 | public static function validate( |
289 | - SchemaInterface $schema, |
|
290 | - DocumentNode $document |
|
289 | + SchemaInterface $schema, |
|
290 | + DocumentNode $document |
|
291 | 291 | ): array { |
292 | 292 | return static::make(ValidatorInterface::class) |
293 | - ->validate($schema, $document); |
|
293 | + ->validate($schema, $document); |
|
294 | 294 | } |
295 | 295 | |
296 | 296 | /** |
@@ -305,16 +305,16 @@ discard block |
||
305 | 305 | * @return ExecutionResult |
306 | 306 | */ |
307 | 307 | public static function execute( |
308 | - SchemaInterface $schema, |
|
309 | - DocumentNode $document, |
|
310 | - $rootValue = null, |
|
311 | - $contextValue = null, |
|
312 | - array $variableValues = [], |
|
313 | - $operationName = null, |
|
314 | - callable $fieldResolver = null |
|
308 | + SchemaInterface $schema, |
|
309 | + DocumentNode $document, |
|
310 | + $rootValue = null, |
|
311 | + $contextValue = null, |
|
312 | + array $variableValues = [], |
|
313 | + $operationName = null, |
|
314 | + callable $fieldResolver = null |
|
315 | 315 | ): ExecutionResult { |
316 | 316 | return static::make(ExecutionInterface::class) |
317 | - ->execute( |
|
317 | + ->execute( |
|
318 | 318 | $schema, |
319 | 319 | $document, |
320 | 320 | $rootValue, |
@@ -322,7 +322,7 @@ discard block |
||
322 | 322 | $variableValues, |
323 | 323 | $operationName, |
324 | 324 | $fieldResolver |
325 | - ); |
|
325 | + ); |
|
326 | 326 | } |
327 | 327 | |
328 | 328 | /** |
@@ -30,18 +30,18 @@ discard block |
||
30 | 30 | */ |
31 | 31 | protected $provides = [ |
32 | 32 | // Introspection types |
33 | - GraphQL::SCHEMA_INTROSPECTION, |
|
34 | - GraphQL::DIRECTIVE_INTROSPECTION, |
|
35 | - GraphQL::DIRECTIVE_LOCATION_INTROSPECTION, |
|
36 | - GraphQL::TYPE_INTROSPECTION, |
|
37 | - GraphQL::FIELD_INTROSPECTION, |
|
38 | - GraphQL::INPUT_VALUE_INTROSPECTION, |
|
39 | - GraphQL::ENUM_VALUE_INTROSPECTION, |
|
40 | - GraphQL::TYPE_KIND_INTROSPECTION, |
|
33 | + GraphQL::SCHEMA_INTROSPECTION, |
|
34 | + GraphQL::DIRECTIVE_INTROSPECTION, |
|
35 | + GraphQL::DIRECTIVE_LOCATION_INTROSPECTION, |
|
36 | + GraphQL::TYPE_INTROSPECTION, |
|
37 | + GraphQL::FIELD_INTROSPECTION, |
|
38 | + GraphQL::INPUT_VALUE_INTROSPECTION, |
|
39 | + GraphQL::ENUM_VALUE_INTROSPECTION, |
|
40 | + GraphQL::TYPE_KIND_INTROSPECTION, |
|
41 | 41 | // Meta fields |
42 | - GraphQL::SCHEMA_META_FIELD_DEFINITION, |
|
43 | - GraphQL::TYPE_META_FIELD_DEFINITION, |
|
44 | - GraphQL::TYPE_NAME_META_FIELD_DEFINITION, |
|
42 | + GraphQL::SCHEMA_META_FIELD_DEFINITION, |
|
43 | + GraphQL::TYPE_META_FIELD_DEFINITION, |
|
44 | + GraphQL::TYPE_NAME_META_FIELD_DEFINITION, |
|
45 | 45 | ]; |
46 | 46 | |
47 | 47 | /** |
@@ -60,163 +60,163 @@ discard block |
||
60 | 60 | { |
61 | 61 | $this->container->add(GraphQL::SCHEMA_INTROSPECTION, function () { |
62 | 62 | return newObjectType([ |
63 | - 'name' => GraphQL::SCHEMA_INTROSPECTION, |
|
64 | - 'isIntrospection' => true, |
|
65 | - 'description' => |
|
63 | + 'name' => GraphQL::SCHEMA_INTROSPECTION, |
|
64 | + 'isIntrospection' => true, |
|
65 | + 'description' => |
|
66 | 66 | 'A GraphQL Schema defines the capabilities of a GraphQL server. It ' . |
67 | 67 | 'exposes all available types and directives on the server, as well as ' . |
68 | 68 | 'the entry points for query, mutation, and subscription operations.', |
69 | - 'fields' => function () { |
|
70 | - return [ |
|
69 | + 'fields' => function () { |
|
70 | + return [ |
|
71 | 71 | 'types' => [ |
72 | - 'description' => 'A list of all types supported by this server.', |
|
73 | - 'type' => newNonNull(newList(newNonNull(__Type()))), |
|
74 | - 'resolve' => function (SchemaInterface $schema): array { |
|
75 | - return array_values($schema->getTypeMap()); |
|
76 | - }, |
|
72 | + 'description' => 'A list of all types supported by this server.', |
|
73 | + 'type' => newNonNull(newList(newNonNull(__Type()))), |
|
74 | + 'resolve' => function (SchemaInterface $schema): array { |
|
75 | + return array_values($schema->getTypeMap()); |
|
76 | + }, |
|
77 | 77 | ], |
78 | 78 | 'queryType' => [ |
79 | - 'description' => 'The type that query operations will be rooted at.', |
|
80 | - 'type' => newNonNull(__Type()), |
|
81 | - 'resolve' => function (SchemaInterface $schema |
|
82 | - ): ?TypeInterface { |
|
83 | - return $schema->getQueryType(); |
|
84 | - }, |
|
79 | + 'description' => 'The type that query operations will be rooted at.', |
|
80 | + 'type' => newNonNull(__Type()), |
|
81 | + 'resolve' => function (SchemaInterface $schema |
|
82 | + ): ?TypeInterface { |
|
83 | + return $schema->getQueryType(); |
|
84 | + }, |
|
85 | 85 | ], |
86 | 86 | 'mutationType' => [ |
87 | - 'description' => |
|
87 | + 'description' => |
|
88 | 88 | 'If this server supports mutation, the type that ' . |
89 | 89 | 'mutation operations will be rooted at.', |
90 | - 'type' => __Type(), |
|
91 | - 'resolve' => function (SchemaInterface $schema |
|
92 | - ): ?TypeInterface { |
|
93 | - return $schema->getMutationType(); |
|
94 | - }, |
|
90 | + 'type' => __Type(), |
|
91 | + 'resolve' => function (SchemaInterface $schema |
|
92 | + ): ?TypeInterface { |
|
93 | + return $schema->getMutationType(); |
|
94 | + }, |
|
95 | 95 | ], |
96 | 96 | 'subscriptionType' => [ |
97 | - 'description' => |
|
97 | + 'description' => |
|
98 | 98 | 'If this server support subscription, the type that ' . |
99 | 99 | 'subscription operations will be rooted at.', |
100 | - 'type' => __Type(), |
|
101 | - 'resolve' => function (SchemaInterface $schema |
|
102 | - ): ?TypeInterface { |
|
103 | - return $schema->getSubscriptionType(); |
|
104 | - }, |
|
100 | + 'type' => __Type(), |
|
101 | + 'resolve' => function (SchemaInterface $schema |
|
102 | + ): ?TypeInterface { |
|
103 | + return $schema->getSubscriptionType(); |
|
104 | + }, |
|
105 | 105 | ], |
106 | 106 | 'directives' => [ |
107 | - 'description' => 'A list of all directives supported by this server.', |
|
108 | - 'type' => newNonNull(newList(newNonNull(__Directive()))), |
|
109 | - 'resolve' => function (SchemaInterface $schema): array { |
|
110 | - return $schema->getDirectives(); |
|
111 | - }, |
|
112 | - ], |
|
113 | - ]; |
|
114 | - }, |
|
107 | + 'description' => 'A list of all directives supported by this server.', |
|
108 | + 'type' => newNonNull(newList(newNonNull(__Directive()))), |
|
109 | + 'resolve' => function (SchemaInterface $schema): array { |
|
110 | + return $schema->getDirectives(); |
|
111 | + }, |
|
112 | + ], |
|
113 | + ]; |
|
114 | + }, |
|
115 | 115 | ]); |
116 | 116 | }, true/* $shared */); |
117 | 117 | |
118 | 118 | $this->container->add(GraphQL::DIRECTIVE_INTROSPECTION, function () { |
119 | 119 | return newObjectType([ |
120 | - 'name' => GraphQL::DIRECTIVE_INTROSPECTION, |
|
121 | - 'isIntrospection' => true, |
|
122 | - 'description' => |
|
120 | + 'name' => GraphQL::DIRECTIVE_INTROSPECTION, |
|
121 | + 'isIntrospection' => true, |
|
122 | + 'description' => |
|
123 | 123 | 'A Directive provides a way to describe alternate runtime execution and ' . |
124 | 124 | 'type validation behavior in a GraphQL document.' . |
125 | 125 | "\n\nIn some cases, you need to provide options to alter GraphQL's " . |
126 | 126 | 'execution behavior in ways field arguments will not suffice, such as ' . |
127 | 127 | 'conditionally including or skipping a field. Directives provide this by ' . |
128 | 128 | 'describing additional information to the executor.', |
129 | - 'fields' => function () { |
|
130 | - return [ |
|
129 | + 'fields' => function () { |
|
130 | + return [ |
|
131 | 131 | 'name' => ['type' => newNonNull(String())], |
132 | 132 | 'description' => ['type' => String()], |
133 | 133 | 'locations' => [ |
134 | - 'type' => newNonNull(newList(newNonNull(__DirectiveLocation()))), |
|
134 | + 'type' => newNonNull(newList(newNonNull(__DirectiveLocation()))), |
|
135 | 135 | ], |
136 | 136 | 'args' => [ |
137 | - 'type' => newNonNull(newList(newNonNull(__InputValue()))), |
|
138 | - 'resolve' => function (DirectiveInterface $directive |
|
139 | - ): array { |
|
140 | - return $directive->getArguments() ?: []; |
|
141 | - }, |
|
142 | - ], |
|
143 | - ]; |
|
144 | - }, |
|
137 | + 'type' => newNonNull(newList(newNonNull(__InputValue()))), |
|
138 | + 'resolve' => function (DirectiveInterface $directive |
|
139 | + ): array { |
|
140 | + return $directive->getArguments() ?: []; |
|
141 | + }, |
|
142 | + ], |
|
143 | + ]; |
|
144 | + }, |
|
145 | 145 | ]); |
146 | 146 | }, true/* $shared */); |
147 | 147 | |
148 | 148 | $this->container->add(GraphQL::DIRECTIVE_LOCATION_INTROSPECTION, |
149 | - function () { |
|
150 | - return newEnumType([ |
|
149 | + function () { |
|
150 | + return newEnumType([ |
|
151 | 151 | 'name' => GraphQL::DIRECTIVE_LOCATION_INTROSPECTION, |
152 | 152 | 'isIntrospection' => true, |
153 | 153 | 'description' => |
154 | - 'A Directive can be adjacent to many parts of the GraphQL language, a ' . |
|
155 | - '__DirectiveLocation describes one such possible adjacencies.', |
|
154 | + 'A Directive can be adjacent to many parts of the GraphQL language, a ' . |
|
155 | + '__DirectiveLocation describes one such possible adjacencies.', |
|
156 | 156 | 'values' => [ |
157 | - DirectiveLocationEnum::QUERY => [ |
|
157 | + DirectiveLocationEnum::QUERY => [ |
|
158 | 158 | 'description' => 'Location adjacent to a query operation.', |
159 | - ], |
|
160 | - DirectiveLocationEnum::MUTATION => [ |
|
159 | + ], |
|
160 | + DirectiveLocationEnum::MUTATION => [ |
|
161 | 161 | 'description' => 'Location adjacent to a mutation operation.', |
162 | - ], |
|
163 | - DirectiveLocationEnum::SUBSCRIPTION => [ |
|
162 | + ], |
|
163 | + DirectiveLocationEnum::SUBSCRIPTION => [ |
|
164 | 164 | 'description' => 'Location adjacent to a subscription operation.', |
165 | - ], |
|
166 | - DirectiveLocationEnum::FIELD => [ |
|
165 | + ], |
|
166 | + DirectiveLocationEnum::FIELD => [ |
|
167 | 167 | 'description' => 'Location adjacent to a field.', |
168 | - ], |
|
169 | - DirectiveLocationEnum::FRAGMENT_DEFINITION => [ |
|
168 | + ], |
|
169 | + DirectiveLocationEnum::FRAGMENT_DEFINITION => [ |
|
170 | 170 | 'description' => 'Location adjacent to a fragment definition.', |
171 | - ], |
|
172 | - DirectiveLocationEnum::FRAGMENT_SPREAD => [ |
|
171 | + ], |
|
172 | + DirectiveLocationEnum::FRAGMENT_SPREAD => [ |
|
173 | 173 | 'description' => 'Location adjacent to a fragment spread.', |
174 | - ], |
|
175 | - DirectiveLocationEnum::INLINE_FRAGMENT => [ |
|
174 | + ], |
|
175 | + DirectiveLocationEnum::INLINE_FRAGMENT => [ |
|
176 | 176 | 'description' => 'Location adjacent to an inline fragment.', |
177 | - ], |
|
178 | - DirectiveLocationEnum::SCHEMA => [ |
|
177 | + ], |
|
178 | + DirectiveLocationEnum::SCHEMA => [ |
|
179 | 179 | 'description' => 'Location adjacent to a schema definition.', |
180 | - ], |
|
181 | - DirectiveLocationEnum::SCALAR => [ |
|
180 | + ], |
|
181 | + DirectiveLocationEnum::SCALAR => [ |
|
182 | 182 | 'description' => 'Location adjacent to a scalar definition.', |
183 | - ], |
|
184 | - DirectiveLocationEnum::OBJECT => [ |
|
183 | + ], |
|
184 | + DirectiveLocationEnum::OBJECT => [ |
|
185 | 185 | 'description' => 'Location adjacent to an object type definition.', |
186 | - ], |
|
187 | - DirectiveLocationEnum::FIELD_DEFINITION => [ |
|
186 | + ], |
|
187 | + DirectiveLocationEnum::FIELD_DEFINITION => [ |
|
188 | 188 | 'description' => 'Location adjacent to a field definition.', |
189 | - ], |
|
190 | - DirectiveLocationEnum::ARGUMENT_DEFINITION => [ |
|
189 | + ], |
|
190 | + DirectiveLocationEnum::ARGUMENT_DEFINITION => [ |
|
191 | 191 | 'description' => 'Location adjacent to an argument definition.', |
192 | - ], |
|
193 | - DirectiveLocationEnum::INTERFACE => [ |
|
192 | + ], |
|
193 | + DirectiveLocationEnum::INTERFACE => [ |
|
194 | 194 | 'description' => 'Location adjacent to an interface definition.', |
195 | - ], |
|
196 | - DirectiveLocationEnum::UNION => [ |
|
195 | + ], |
|
196 | + DirectiveLocationEnum::UNION => [ |
|
197 | 197 | 'description' => 'Location adjacent to a union definition.', |
198 | - ], |
|
199 | - DirectiveLocationEnum::ENUM => [ |
|
198 | + ], |
|
199 | + DirectiveLocationEnum::ENUM => [ |
|
200 | 200 | 'description' => 'Location adjacent to an enum definition.', |
201 | - ], |
|
202 | - DirectiveLocationEnum::ENUM_VALUE => [ |
|
201 | + ], |
|
202 | + DirectiveLocationEnum::ENUM_VALUE => [ |
|
203 | 203 | 'description' => 'Location adjacent to an enum value definition.', |
204 | - ], |
|
205 | - DirectiveLocationEnum::INPUT_OBJECT => [ |
|
204 | + ], |
|
205 | + DirectiveLocationEnum::INPUT_OBJECT => [ |
|
206 | 206 | 'description' => 'Location adjacent to an input object type definition.', |
207 | - ], |
|
208 | - DirectiveLocationEnum::INPUT_FIELD_DEFINITION => [ |
|
207 | + ], |
|
208 | + DirectiveLocationEnum::INPUT_FIELD_DEFINITION => [ |
|
209 | 209 | 'description' => 'Location adjacent to an input object field definition.', |
210 | - ], |
|
210 | + ], |
|
211 | 211 | ], |
212 | - ]); |
|
213 | - }, true/* $shared */); |
|
212 | + ]); |
|
213 | + }, true/* $shared */); |
|
214 | 214 | |
215 | 215 | $this->container->add(GraphQL::TYPE_INTROSPECTION, function () { |
216 | 216 | return newObjectType([ |
217 | - 'name' => GraphQL::TYPE_INTROSPECTION, |
|
218 | - 'isIntrospection' => true, |
|
219 | - 'description' => |
|
217 | + 'name' => GraphQL::TYPE_INTROSPECTION, |
|
218 | + 'isIntrospection' => true, |
|
219 | + 'description' => |
|
220 | 220 | 'The fundamental unit of any GraphQL Schema is the type. There are ' . |
221 | 221 | 'many kinds of types in GraphQL as represented by the `__TypeKind` enum.' . |
222 | 222 | '\n\nDepending on the kind of a type, certain fields describe ' . |
@@ -225,237 +225,237 @@ discard block |
||
225 | 225 | 'Object and Interface types provide the fields they describe. Abstract ' . |
226 | 226 | 'types, Union and Interface, provide the Object types possible ' . |
227 | 227 | 'at runtime. List and NonNull types compose other types.', |
228 | - 'fields' => function () { |
|
229 | - return [ |
|
228 | + 'fields' => function () { |
|
229 | + return [ |
|
230 | 230 | 'kind' => [ |
231 | - 'type' => newNonNull(__TypeKind()), |
|
232 | - 'resolve' => function (TypeInterface $type) { |
|
233 | - if ($type instanceof ScalarType) { |
|
234 | - return TypeKindEnum::SCALAR; |
|
235 | - } |
|
236 | - if ($type instanceof ObjectType) { |
|
237 | - return TypeKindEnum::OBJECT; |
|
238 | - } |
|
239 | - if ($type instanceof InterfaceType) { |
|
240 | - return TypeKindEnum::INTERFACE; |
|
241 | - } |
|
242 | - if ($type instanceof UnionType) { |
|
243 | - return TypeKindEnum::UNION; |
|
244 | - } |
|
245 | - if ($type instanceof EnumType) { |
|
246 | - return TypeKindEnum::ENUM; |
|
247 | - } |
|
248 | - if ($type instanceof InputObjectType) { |
|
249 | - return TypeKindEnum::INPUT_OBJECT; |
|
250 | - } |
|
251 | - if ($type instanceof ListType) { |
|
252 | - return TypeKindEnum::LIST; |
|
253 | - } |
|
254 | - if ($type instanceof NonNullType) { |
|
255 | - return TypeKindEnum::NON_NULL; |
|
256 | - } |
|
231 | + 'type' => newNonNull(__TypeKind()), |
|
232 | + 'resolve' => function (TypeInterface $type) { |
|
233 | + if ($type instanceof ScalarType) { |
|
234 | + return TypeKindEnum::SCALAR; |
|
235 | + } |
|
236 | + if ($type instanceof ObjectType) { |
|
237 | + return TypeKindEnum::OBJECT; |
|
238 | + } |
|
239 | + if ($type instanceof InterfaceType) { |
|
240 | + return TypeKindEnum::INTERFACE; |
|
241 | + } |
|
242 | + if ($type instanceof UnionType) { |
|
243 | + return TypeKindEnum::UNION; |
|
244 | + } |
|
245 | + if ($type instanceof EnumType) { |
|
246 | + return TypeKindEnum::ENUM; |
|
247 | + } |
|
248 | + if ($type instanceof InputObjectType) { |
|
249 | + return TypeKindEnum::INPUT_OBJECT; |
|
250 | + } |
|
251 | + if ($type instanceof ListType) { |
|
252 | + return TypeKindEnum::LIST; |
|
253 | + } |
|
254 | + if ($type instanceof NonNullType) { |
|
255 | + return TypeKindEnum::NON_NULL; |
|
256 | + } |
|
257 | 257 | |
258 | - throw new InvalidTypeException(sprintf('Unknown kind of type: %s', |
|
258 | + throw new InvalidTypeException(sprintf('Unknown kind of type: %s', |
|
259 | 259 | $type)); |
260 | - }, |
|
260 | + }, |
|
261 | 261 | ], |
262 | 262 | 'name' => ['type' => String()], |
263 | 263 | 'description' => ['type' => String()], |
264 | 264 | 'fields' => [ |
265 | - 'type' => newList(newNonNull(__Field())), |
|
266 | - 'args' => [ |
|
265 | + 'type' => newList(newNonNull(__Field())), |
|
266 | + 'args' => [ |
|
267 | 267 | 'includeDeprecated' => [ |
268 | - 'type' => Boolean(), |
|
269 | - 'defaultValue' => false, |
|
268 | + 'type' => Boolean(), |
|
269 | + 'defaultValue' => false, |
|
270 | 270 | ], |
271 | - ], |
|
272 | - 'resolve' => function (TypeInterface $type, array $args): |
|
271 | + ], |
|
272 | + 'resolve' => function (TypeInterface $type, array $args): |
|
273 | 273 | ?array { |
274 | - ['includeDeprecated' => $includeDeprecated] = $args; |
|
274 | + ['includeDeprecated' => $includeDeprecated] = $args; |
|
275 | 275 | |
276 | - if ($type instanceof ObjectType || $type instanceof InterfaceType) { |
|
277 | - $fields = array_values($type->getFields()); |
|
276 | + if ($type instanceof ObjectType || $type instanceof InterfaceType) { |
|
277 | + $fields = array_values($type->getFields()); |
|
278 | 278 | |
279 | - if (!$includeDeprecated) { |
|
280 | - $fields = array_filter($fields, |
|
279 | + if (!$includeDeprecated) { |
|
280 | + $fields = array_filter($fields, |
|
281 | 281 | function (Field $field) { |
282 | 282 | return !$field->getIsDeprecated(); |
283 | 283 | }); |
284 | - } |
|
284 | + } |
|
285 | 285 | |
286 | - return $fields; |
|
287 | - } |
|
286 | + return $fields; |
|
287 | + } |
|
288 | 288 | |
289 | - return null; |
|
290 | - }, |
|
289 | + return null; |
|
290 | + }, |
|
291 | 291 | ], |
292 | 292 | 'interfaces' => [ |
293 | - 'type' => newList(newNonNull(__Type())), |
|
294 | - 'resolve' => function (TypeInterface $type): ?array { |
|
295 | - return $type instanceof ObjectType ? $type->getInterfaces() : null; |
|
296 | - }, |
|
293 | + 'type' => newList(newNonNull(__Type())), |
|
294 | + 'resolve' => function (TypeInterface $type): ?array { |
|
295 | + return $type instanceof ObjectType ? $type->getInterfaces() : null; |
|
296 | + }, |
|
297 | 297 | ], |
298 | 298 | 'possibleTypes' => [ |
299 | - 'type' => newList(newNonNull(__Type())), |
|
300 | - 'resolve' => function ( |
|
299 | + 'type' => newList(newNonNull(__Type())), |
|
300 | + 'resolve' => function ( |
|
301 | 301 | TypeInterface $type, |
302 | 302 | array $args, |
303 | 303 | array $context, |
304 | 304 | ResolveInfo $info |
305 | - ): |
|
305 | + ): |
|
306 | 306 | ?array { |
307 | - /** @var SchemaInterface $schema */ |
|
308 | - $schema = $info->getSchema(); |
|
309 | - /** @noinspection PhpParamsInspection */ |
|
310 | - return $type instanceof AbstractTypeInterface ? $schema->getPossibleTypes($type) : null; |
|
311 | - }, |
|
307 | + /** @var SchemaInterface $schema */ |
|
308 | + $schema = $info->getSchema(); |
|
309 | + /** @noinspection PhpParamsInspection */ |
|
310 | + return $type instanceof AbstractTypeInterface ? $schema->getPossibleTypes($type) : null; |
|
311 | + }, |
|
312 | 312 | ], |
313 | 313 | 'enumValues' => [ |
314 | - 'type' => newList(newNonNull(__EnumValue())), |
|
315 | - 'args' => [ |
|
314 | + 'type' => newList(newNonNull(__EnumValue())), |
|
315 | + 'args' => [ |
|
316 | 316 | 'includeDeprecated' => [ |
317 | - 'type' => Boolean(), |
|
318 | - 'defaultValue' => false, |
|
317 | + 'type' => Boolean(), |
|
318 | + 'defaultValue' => false, |
|
319 | + ], |
|
319 | 320 | ], |
320 | - ], |
|
321 | - 'resolve' => function ( |
|
321 | + 'resolve' => function ( |
|
322 | 322 | TypeInterface $type, |
323 | 323 | array $args |
324 | - ): ?array { |
|
325 | - ['includeDeprecated' => $includeDeprecated] = $args; |
|
324 | + ): ?array { |
|
325 | + ['includeDeprecated' => $includeDeprecated] = $args; |
|
326 | 326 | |
327 | - if ($type instanceof EnumType) { |
|
328 | - $values = array_values($type->getValues()); |
|
327 | + if ($type instanceof EnumType) { |
|
328 | + $values = array_values($type->getValues()); |
|
329 | 329 | |
330 | - if (!$includeDeprecated) { |
|
331 | - $values = array_filter($values, |
|
330 | + if (!$includeDeprecated) { |
|
331 | + $values = array_filter($values, |
|
332 | 332 | function (Field $field) { |
333 | 333 | return !$field->getIsDeprecated(); |
334 | 334 | }); |
335 | - } |
|
335 | + } |
|
336 | 336 | |
337 | - return $values; |
|
338 | - } |
|
337 | + return $values; |
|
338 | + } |
|
339 | 339 | |
340 | - return null; |
|
341 | - }, |
|
340 | + return null; |
|
341 | + }, |
|
342 | 342 | ], |
343 | 343 | 'inputFields' => [ |
344 | - 'type' => newList(newNonNull(__InputValue())), |
|
345 | - 'resolve' => function (TypeInterface $type): ?array { |
|
346 | - return $type instanceof InputObjectType ? $type->getFields() : null; |
|
347 | - }, |
|
344 | + 'type' => newList(newNonNull(__InputValue())), |
|
345 | + 'resolve' => function (TypeInterface $type): ?array { |
|
346 | + return $type instanceof InputObjectType ? $type->getFields() : null; |
|
347 | + }, |
|
348 | 348 | ], |
349 | 349 | 'ofType' => ['type' => __Type()], |
350 | - ]; |
|
351 | - }, |
|
350 | + ]; |
|
351 | + }, |
|
352 | 352 | ]); |
353 | 353 | }, true/* $shared */); |
354 | 354 | |
355 | 355 | $this->container->add(GraphQL::FIELD_INTROSPECTION, function () { |
356 | 356 | return newObjectType([ |
357 | - 'name' => GraphQL::FIELD_INTROSPECTION, |
|
358 | - 'isIntrospection' => true, |
|
359 | - 'description' => |
|
357 | + 'name' => GraphQL::FIELD_INTROSPECTION, |
|
358 | + 'isIntrospection' => true, |
|
359 | + 'description' => |
|
360 | 360 | 'Object and Interface types are described by a list of Fields, each of ' . |
361 | 361 | 'which has a name, potentially a list of arguments, and a return type.', |
362 | - 'fields' => function () { |
|
363 | - return [ |
|
362 | + 'fields' => function () { |
|
363 | + return [ |
|
364 | 364 | 'name' => ['type' => newNonNull(String())], |
365 | 365 | 'description' => ['type' => String()], |
366 | 366 | 'args' => [ |
367 | - 'type' => newNonNull(newList(newNonNull(__InputValue()))), |
|
368 | - 'resolve' => function (ArgumentsAwareInterface $directive |
|
369 | - ): array { |
|
370 | - return $directive->getArguments() ?? []; |
|
371 | - }, |
|
367 | + 'type' => newNonNull(newList(newNonNull(__InputValue()))), |
|
368 | + 'resolve' => function (ArgumentsAwareInterface $directive |
|
369 | + ): array { |
|
370 | + return $directive->getArguments() ?? []; |
|
371 | + }, |
|
372 | 372 | ], |
373 | 373 | 'type' => ['type' => newNonNull(__Type())], |
374 | 374 | 'isDeprecated' => ['type' => newNonNull(Boolean())], |
375 | 375 | 'deprecationReason' => ['type' => String()], |
376 | - ]; |
|
377 | - }, |
|
376 | + ]; |
|
377 | + }, |
|
378 | 378 | ]); |
379 | 379 | }, true/* $shared */); |
380 | 380 | |
381 | 381 | $this->container->add(GraphQL::INPUT_VALUE_INTROSPECTION, function () { |
382 | 382 | return newObjectType([ |
383 | - 'name' => GraphQL::INPUT_VALUE_INTROSPECTION, |
|
384 | - 'isIntrospection' => true, |
|
385 | - 'description' => |
|
383 | + 'name' => GraphQL::INPUT_VALUE_INTROSPECTION, |
|
384 | + 'isIntrospection' => true, |
|
385 | + 'description' => |
|
386 | 386 | 'Arguments provided to Fields or Directives and the input fields of an ' . |
387 | 387 | 'InputObject are represented as Input Values which describe their type ' . |
388 | 388 | 'and optionally a default value.', |
389 | - 'fields' => function () { |
|
390 | - return [ |
|
389 | + 'fields' => function () { |
|
390 | + return [ |
|
391 | 391 | 'name' => ['type' => newNonNull(String())], |
392 | 392 | 'description' => ['type' => String()], |
393 | 393 | 'type' => ['type' => newNonNull(__Type())], |
394 | 394 | 'defaultValue' => [ |
395 | - 'type' => String(), |
|
396 | - 'description' => |
|
395 | + 'type' => String(), |
|
396 | + 'description' => |
|
397 | 397 | 'A GraphQL-formatted string representing the default value for this ' . |
398 | 398 | 'input value.', |
399 | - 'resolve' => function ($inputValue) { |
|
400 | - // TODO: Implement this when we have support for printing AST. |
|
401 | - return null; |
|
402 | - }, |
|
399 | + 'resolve' => function ($inputValue) { |
|
400 | + // TODO: Implement this when we have support for printing AST. |
|
401 | + return null; |
|
402 | + }, |
|
403 | 403 | ], |
404 | - ]; |
|
405 | - }, |
|
404 | + ]; |
|
405 | + }, |
|
406 | 406 | ]); |
407 | 407 | }, true/* $shared */); |
408 | 408 | |
409 | 409 | $this->container->add(GraphQL::ENUM_VALUE_INTROSPECTION, function () { |
410 | 410 | return newObjectType([ |
411 | - 'name' => GraphQL::ENUM_VALUE_INTROSPECTION, |
|
412 | - 'isIntrospection' => true, |
|
413 | - 'description' => |
|
411 | + 'name' => GraphQL::ENUM_VALUE_INTROSPECTION, |
|
412 | + 'isIntrospection' => true, |
|
413 | + 'description' => |
|
414 | 414 | 'One possible value for a given Enum. Enum values are unique values, not ' . |
415 | 415 | 'a placeholder for a string or numeric value. However an Enum value is ' . |
416 | 416 | 'returned in a JSON response as a string.', |
417 | - 'fields' => function () { |
|
418 | - return [ |
|
417 | + 'fields' => function () { |
|
418 | + return [ |
|
419 | 419 | 'name' => ['type' => newNonNull(String())], |
420 | 420 | 'description' => ['type' => String()], |
421 | 421 | 'isDeprecated' => ['type' => newNonNull(Boolean())], |
422 | 422 | 'deprecationReason' => ['type' => String()], |
423 | - ]; |
|
424 | - }, |
|
423 | + ]; |
|
424 | + }, |
|
425 | 425 | ]); |
426 | 426 | }, true/* $shared */); |
427 | 427 | |
428 | 428 | $this->container->add(GraphQL::TYPE_KIND_INTROSPECTION, function () { |
429 | 429 | return newEnumType([ |
430 | - 'name' => GraphQL::TYPE_KIND_INTROSPECTION, |
|
431 | - 'isIntrospection' => true, |
|
432 | - 'description' => 'An enum describing what kind of type a given `__Type` is.', |
|
433 | - 'values' => [ |
|
430 | + 'name' => GraphQL::TYPE_KIND_INTROSPECTION, |
|
431 | + 'isIntrospection' => true, |
|
432 | + 'description' => 'An enum describing what kind of type a given `__Type` is.', |
|
433 | + 'values' => [ |
|
434 | 434 | TypeKindEnum::SCALAR => [ |
435 | - 'description' => 'Indicates this type is a scalar.', |
|
435 | + 'description' => 'Indicates this type is a scalar.', |
|
436 | 436 | ], |
437 | 437 | TypeKindEnum::OBJECT => [ |
438 | - 'description' => 'Indicates this type is an object. `fields` and `interfaces` are valid fields.', |
|
438 | + 'description' => 'Indicates this type is an object. `fields` and `interfaces` are valid fields.', |
|
439 | 439 | ], |
440 | 440 | TypeKindEnum::INTERFACE => [ |
441 | - 'description' => 'Indicates this type is an interface. `fields` and `possibleTypes` are valid fields.', |
|
441 | + 'description' => 'Indicates this type is an interface. `fields` and `possibleTypes` are valid fields.', |
|
442 | 442 | ], |
443 | 443 | TypeKindEnum::UNION => [ |
444 | - 'description' => 'Indicates this type is a union. `possibleTypes` is a valid field.', |
|
444 | + 'description' => 'Indicates this type is a union. `possibleTypes` is a valid field.', |
|
445 | 445 | ], |
446 | 446 | TypeKindEnum::ENUM => [ |
447 | - 'description' => 'Indicates this type is an enum. `enumValues` is a valid field.', |
|
447 | + 'description' => 'Indicates this type is an enum. `enumValues` is a valid field.', |
|
448 | 448 | ], |
449 | 449 | TypeKindEnum::INPUT_OBJECT => [ |
450 | - 'description' => 'Indicates this type is an input object. `inputFields` is a valid field.', |
|
450 | + 'description' => 'Indicates this type is an input object. `inputFields` is a valid field.', |
|
451 | 451 | ], |
452 | 452 | TypeKindEnum::LIST => [ |
453 | - 'description' => 'Indicates this type is a list. `ofType` is a valid field.', |
|
453 | + 'description' => 'Indicates this type is a list. `ofType` is a valid field.', |
|
454 | 454 | ], |
455 | 455 | TypeKindEnum::NON_NULL => [ |
456 | - 'description' => 'Indicates this type is a non-null. `ofType` is a valid field.', |
|
456 | + 'description' => 'Indicates this type is a non-null. `ofType` is a valid field.', |
|
457 | + ], |
|
457 | 458 | ], |
458 | - ], |
|
459 | 459 | ]); |
460 | 460 | }, true/* $shared */); |
461 | 461 | } |
@@ -466,62 +466,62 @@ discard block |
||
466 | 466 | protected function registerMetaFields() |
467 | 467 | { |
468 | 468 | $this->container->add(GraphQL::SCHEMA_META_FIELD_DEFINITION, |
469 | - function ($__Schema) { |
|
470 | - return new Field([ |
|
469 | + function ($__Schema) { |
|
470 | + return new Field([ |
|
471 | 471 | 'name' => '__schema', |
472 | 472 | 'type' => newNonNull($__Schema), |
473 | 473 | 'description' => 'Access the current type schema of this server.', |
474 | 474 | 'resolve' => function ( |
475 | - $source, |
|
476 | - $args, |
|
477 | - $context, |
|
478 | - ResolveInfo $info |
|
475 | + $source, |
|
476 | + $args, |
|
477 | + $context, |
|
478 | + ResolveInfo $info |
|
479 | 479 | ): SchemaInterface { |
480 | 480 | return $info->getSchema(); |
481 | 481 | }, |
482 | - ]); |
|
483 | - }) |
|
484 | - ->withArgument(GraphQL::SCHEMA_INTROSPECTION); |
|
482 | + ]); |
|
483 | + }) |
|
484 | + ->withArgument(GraphQL::SCHEMA_INTROSPECTION); |
|
485 | 485 | |
486 | 486 | $this->container->add(GraphQL::TYPE_META_FIELD_DEFINITION, |
487 | - function ($__Type) { |
|
488 | - return new Field([ |
|
487 | + function ($__Type) { |
|
488 | + return new Field([ |
|
489 | 489 | 'name' => '__type', |
490 | 490 | 'type' => $__Type, |
491 | 491 | 'description' => 'Request the type information of a single type.', |
492 | 492 | 'args' => [ |
493 | - 'name' => ['type' => newNonNull(String())], |
|
493 | + 'name' => ['type' => newNonNull(String())], |
|
494 | 494 | ], |
495 | 495 | 'resolve' => function ( |
496 | - $source, |
|
497 | - $args, |
|
498 | - $context, |
|
499 | - ResolveInfo $info |
|
496 | + $source, |
|
497 | + $args, |
|
498 | + $context, |
|
499 | + ResolveInfo $info |
|
500 | 500 | ): TypeInterface { |
501 | 501 | ['name' => $name] = $args; |
502 | 502 | $schema = $info->getSchema(); |
503 | 503 | return $schema->getType($name); |
504 | 504 | }, |
505 | - ]); |
|
506 | - }) |
|
507 | - ->withArgument(GraphQL::TYPE_INTROSPECTION); |
|
505 | + ]); |
|
506 | + }) |
|
507 | + ->withArgument(GraphQL::TYPE_INTROSPECTION); |
|
508 | 508 | |
509 | 509 | $this->container->add(GraphQL::TYPE_NAME_META_FIELD_DEFINITION, |
510 | - function () { |
|
511 | - return new Field([ |
|
510 | + function () { |
|
511 | + return new Field([ |
|
512 | 512 | 'name' => '__typename', |
513 | 513 | 'type' => newNonNull(String()), |
514 | 514 | 'description' => 'The name of the current Object type at runtime.', |
515 | 515 | 'resolve' => function ( |
516 | - $source, |
|
517 | - $args, |
|
518 | - $context, |
|
519 | - ResolveInfo $info |
|
516 | + $source, |
|
517 | + $args, |
|
518 | + $context, |
|
519 | + ResolveInfo $info |
|
520 | 520 | ): string { |
521 | 521 | $parentType = $info->getParentType(); |
522 | 522 | return null !== $parentType ? $parentType->getName() : null; |
523 | 523 | }, |
524 | - ]); |
|
525 | - }); |
|
524 | + ]); |
|
525 | + }); |
|
526 | 526 | } |
527 | 527 | } |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | */ |
59 | 59 | protected function registerIntrospectionTypes() |
60 | 60 | { |
61 | - $this->container->add(GraphQL::SCHEMA_INTROSPECTION, function () { |
|
61 | + $this->container->add(GraphQL::SCHEMA_INTROSPECTION, function() { |
|
62 | 62 | return newObjectType([ |
63 | 63 | 'name' => GraphQL::SCHEMA_INTROSPECTION, |
64 | 64 | 'isIntrospection' => true, |
@@ -66,19 +66,19 @@ discard block |
||
66 | 66 | 'A GraphQL Schema defines the capabilities of a GraphQL server. It ' . |
67 | 67 | 'exposes all available types and directives on the server, as well as ' . |
68 | 68 | 'the entry points for query, mutation, and subscription operations.', |
69 | - 'fields' => function () { |
|
69 | + 'fields' => function() { |
|
70 | 70 | return [ |
71 | 71 | 'types' => [ |
72 | 72 | 'description' => 'A list of all types supported by this server.', |
73 | 73 | 'type' => newNonNull(newList(newNonNull(__Type()))), |
74 | - 'resolve' => function (SchemaInterface $schema): array { |
|
74 | + 'resolve' => function(SchemaInterface $schema): array { |
|
75 | 75 | return array_values($schema->getTypeMap()); |
76 | 76 | }, |
77 | 77 | ], |
78 | 78 | 'queryType' => [ |
79 | 79 | 'description' => 'The type that query operations will be rooted at.', |
80 | 80 | 'type' => newNonNull(__Type()), |
81 | - 'resolve' => function (SchemaInterface $schema |
|
81 | + 'resolve' => function(SchemaInterface $schema |
|
82 | 82 | ): ?TypeInterface { |
83 | 83 | return $schema->getQueryType(); |
84 | 84 | }, |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | 'If this server supports mutation, the type that ' . |
89 | 89 | 'mutation operations will be rooted at.', |
90 | 90 | 'type' => __Type(), |
91 | - 'resolve' => function (SchemaInterface $schema |
|
91 | + 'resolve' => function(SchemaInterface $schema |
|
92 | 92 | ): ?TypeInterface { |
93 | 93 | return $schema->getMutationType(); |
94 | 94 | }, |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | 'If this server support subscription, the type that ' . |
99 | 99 | 'subscription operations will be rooted at.', |
100 | 100 | 'type' => __Type(), |
101 | - 'resolve' => function (SchemaInterface $schema |
|
101 | + 'resolve' => function(SchemaInterface $schema |
|
102 | 102 | ): ?TypeInterface { |
103 | 103 | return $schema->getSubscriptionType(); |
104 | 104 | }, |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | 'directives' => [ |
107 | 107 | 'description' => 'A list of all directives supported by this server.', |
108 | 108 | 'type' => newNonNull(newList(newNonNull(__Directive()))), |
109 | - 'resolve' => function (SchemaInterface $schema): array { |
|
109 | + 'resolve' => function(SchemaInterface $schema): array { |
|
110 | 110 | return $schema->getDirectives(); |
111 | 111 | }, |
112 | 112 | ], |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | ]); |
116 | 116 | }, true/* $shared */); |
117 | 117 | |
118 | - $this->container->add(GraphQL::DIRECTIVE_INTROSPECTION, function () { |
|
118 | + $this->container->add(GraphQL::DIRECTIVE_INTROSPECTION, function() { |
|
119 | 119 | return newObjectType([ |
120 | 120 | 'name' => GraphQL::DIRECTIVE_INTROSPECTION, |
121 | 121 | 'isIntrospection' => true, |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | 'execution behavior in ways field arguments will not suffice, such as ' . |
127 | 127 | 'conditionally including or skipping a field. Directives provide this by ' . |
128 | 128 | 'describing additional information to the executor.', |
129 | - 'fields' => function () { |
|
129 | + 'fields' => function() { |
|
130 | 130 | return [ |
131 | 131 | 'name' => ['type' => newNonNull(String())], |
132 | 132 | 'description' => ['type' => String()], |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | ], |
136 | 136 | 'args' => [ |
137 | 137 | 'type' => newNonNull(newList(newNonNull(__InputValue()))), |
138 | - 'resolve' => function (DirectiveInterface $directive |
|
138 | + 'resolve' => function(DirectiveInterface $directive |
|
139 | 139 | ): array { |
140 | 140 | return $directive->getArguments() ?: []; |
141 | 141 | }, |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | }, true/* $shared */); |
147 | 147 | |
148 | 148 | $this->container->add(GraphQL::DIRECTIVE_LOCATION_INTROSPECTION, |
149 | - function () { |
|
149 | + function() { |
|
150 | 150 | return newEnumType([ |
151 | 151 | 'name' => GraphQL::DIRECTIVE_LOCATION_INTROSPECTION, |
152 | 152 | 'isIntrospection' => true, |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | ]); |
213 | 213 | }, true/* $shared */); |
214 | 214 | |
215 | - $this->container->add(GraphQL::TYPE_INTROSPECTION, function () { |
|
215 | + $this->container->add(GraphQL::TYPE_INTROSPECTION, function() { |
|
216 | 216 | return newObjectType([ |
217 | 217 | 'name' => GraphQL::TYPE_INTROSPECTION, |
218 | 218 | 'isIntrospection' => true, |
@@ -225,11 +225,11 @@ discard block |
||
225 | 225 | 'Object and Interface types provide the fields they describe. Abstract ' . |
226 | 226 | 'types, Union and Interface, provide the Object types possible ' . |
227 | 227 | 'at runtime. List and NonNull types compose other types.', |
228 | - 'fields' => function () { |
|
228 | + 'fields' => function() { |
|
229 | 229 | return [ |
230 | 230 | 'kind' => [ |
231 | 231 | 'type' => newNonNull(__TypeKind()), |
232 | - 'resolve' => function (TypeInterface $type) { |
|
232 | + 'resolve' => function(TypeInterface $type) { |
|
233 | 233 | if ($type instanceof ScalarType) { |
234 | 234 | return TypeKindEnum::SCALAR; |
235 | 235 | } |
@@ -269,7 +269,7 @@ discard block |
||
269 | 269 | 'defaultValue' => false, |
270 | 270 | ], |
271 | 271 | ], |
272 | - 'resolve' => function (TypeInterface $type, array $args): |
|
272 | + 'resolve' => function(TypeInterface $type, array $args): |
|
273 | 273 | ?array { |
274 | 274 | ['includeDeprecated' => $includeDeprecated] = $args; |
275 | 275 | |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | |
279 | 279 | if (!$includeDeprecated) { |
280 | 280 | $fields = array_filter($fields, |
281 | - function (Field $field) { |
|
281 | + function(Field $field) { |
|
282 | 282 | return !$field->getIsDeprecated(); |
283 | 283 | }); |
284 | 284 | } |
@@ -291,13 +291,13 @@ discard block |
||
291 | 291 | ], |
292 | 292 | 'interfaces' => [ |
293 | 293 | 'type' => newList(newNonNull(__Type())), |
294 | - 'resolve' => function (TypeInterface $type): ?array { |
|
294 | + 'resolve' => function(TypeInterface $type): ?array { |
|
295 | 295 | return $type instanceof ObjectType ? $type->getInterfaces() : null; |
296 | 296 | }, |
297 | 297 | ], |
298 | 298 | 'possibleTypes' => [ |
299 | 299 | 'type' => newList(newNonNull(__Type())), |
300 | - 'resolve' => function ( |
|
300 | + 'resolve' => function( |
|
301 | 301 | TypeInterface $type, |
302 | 302 | array $args, |
303 | 303 | array $context, |
@@ -318,7 +318,7 @@ discard block |
||
318 | 318 | 'defaultValue' => false, |
319 | 319 | ], |
320 | 320 | ], |
321 | - 'resolve' => function ( |
|
321 | + 'resolve' => function( |
|
322 | 322 | TypeInterface $type, |
323 | 323 | array $args |
324 | 324 | ): ?array { |
@@ -329,7 +329,7 @@ discard block |
||
329 | 329 | |
330 | 330 | if (!$includeDeprecated) { |
331 | 331 | $values = array_filter($values, |
332 | - function (Field $field) { |
|
332 | + function(Field $field) { |
|
333 | 333 | return !$field->getIsDeprecated(); |
334 | 334 | }); |
335 | 335 | } |
@@ -342,7 +342,7 @@ discard block |
||
342 | 342 | ], |
343 | 343 | 'inputFields' => [ |
344 | 344 | 'type' => newList(newNonNull(__InputValue())), |
345 | - 'resolve' => function (TypeInterface $type): ?array { |
|
345 | + 'resolve' => function(TypeInterface $type): ?array { |
|
346 | 346 | return $type instanceof InputObjectType ? $type->getFields() : null; |
347 | 347 | }, |
348 | 348 | ], |
@@ -352,20 +352,20 @@ discard block |
||
352 | 352 | ]); |
353 | 353 | }, true/* $shared */); |
354 | 354 | |
355 | - $this->container->add(GraphQL::FIELD_INTROSPECTION, function () { |
|
355 | + $this->container->add(GraphQL::FIELD_INTROSPECTION, function() { |
|
356 | 356 | return newObjectType([ |
357 | 357 | 'name' => GraphQL::FIELD_INTROSPECTION, |
358 | 358 | 'isIntrospection' => true, |
359 | 359 | 'description' => |
360 | 360 | 'Object and Interface types are described by a list of Fields, each of ' . |
361 | 361 | 'which has a name, potentially a list of arguments, and a return type.', |
362 | - 'fields' => function () { |
|
362 | + 'fields' => function() { |
|
363 | 363 | return [ |
364 | 364 | 'name' => ['type' => newNonNull(String())], |
365 | 365 | 'description' => ['type' => String()], |
366 | 366 | 'args' => [ |
367 | 367 | 'type' => newNonNull(newList(newNonNull(__InputValue()))), |
368 | - 'resolve' => function (ArgumentsAwareInterface $directive |
|
368 | + 'resolve' => function(ArgumentsAwareInterface $directive |
|
369 | 369 | ): array { |
370 | 370 | return $directive->getArguments() ?? []; |
371 | 371 | }, |
@@ -378,7 +378,7 @@ discard block |
||
378 | 378 | ]); |
379 | 379 | }, true/* $shared */); |
380 | 380 | |
381 | - $this->container->add(GraphQL::INPUT_VALUE_INTROSPECTION, function () { |
|
381 | + $this->container->add(GraphQL::INPUT_VALUE_INTROSPECTION, function() { |
|
382 | 382 | return newObjectType([ |
383 | 383 | 'name' => GraphQL::INPUT_VALUE_INTROSPECTION, |
384 | 384 | 'isIntrospection' => true, |
@@ -386,7 +386,7 @@ discard block |
||
386 | 386 | 'Arguments provided to Fields or Directives and the input fields of an ' . |
387 | 387 | 'InputObject are represented as Input Values which describe their type ' . |
388 | 388 | 'and optionally a default value.', |
389 | - 'fields' => function () { |
|
389 | + 'fields' => function() { |
|
390 | 390 | return [ |
391 | 391 | 'name' => ['type' => newNonNull(String())], |
392 | 392 | 'description' => ['type' => String()], |
@@ -396,7 +396,7 @@ discard block |
||
396 | 396 | 'description' => |
397 | 397 | 'A GraphQL-formatted string representing the default value for this ' . |
398 | 398 | 'input value.', |
399 | - 'resolve' => function ($inputValue) { |
|
399 | + 'resolve' => function($inputValue) { |
|
400 | 400 | // TODO: Implement this when we have support for printing AST. |
401 | 401 | return null; |
402 | 402 | }, |
@@ -406,7 +406,7 @@ discard block |
||
406 | 406 | ]); |
407 | 407 | }, true/* $shared */); |
408 | 408 | |
409 | - $this->container->add(GraphQL::ENUM_VALUE_INTROSPECTION, function () { |
|
409 | + $this->container->add(GraphQL::ENUM_VALUE_INTROSPECTION, function() { |
|
410 | 410 | return newObjectType([ |
411 | 411 | 'name' => GraphQL::ENUM_VALUE_INTROSPECTION, |
412 | 412 | 'isIntrospection' => true, |
@@ -414,7 +414,7 @@ discard block |
||
414 | 414 | 'One possible value for a given Enum. Enum values are unique values, not ' . |
415 | 415 | 'a placeholder for a string or numeric value. However an Enum value is ' . |
416 | 416 | 'returned in a JSON response as a string.', |
417 | - 'fields' => function () { |
|
417 | + 'fields' => function() { |
|
418 | 418 | return [ |
419 | 419 | 'name' => ['type' => newNonNull(String())], |
420 | 420 | 'description' => ['type' => String()], |
@@ -425,7 +425,7 @@ discard block |
||
425 | 425 | ]); |
426 | 426 | }, true/* $shared */); |
427 | 427 | |
428 | - $this->container->add(GraphQL::TYPE_KIND_INTROSPECTION, function () { |
|
428 | + $this->container->add(GraphQL::TYPE_KIND_INTROSPECTION, function() { |
|
429 | 429 | return newEnumType([ |
430 | 430 | 'name' => GraphQL::TYPE_KIND_INTROSPECTION, |
431 | 431 | 'isIntrospection' => true, |
@@ -466,12 +466,12 @@ discard block |
||
466 | 466 | protected function registerMetaFields() |
467 | 467 | { |
468 | 468 | $this->container->add(GraphQL::SCHEMA_META_FIELD_DEFINITION, |
469 | - function ($__Schema) { |
|
469 | + function($__Schema) { |
|
470 | 470 | return new Field([ |
471 | 471 | 'name' => '__schema', |
472 | 472 | 'type' => newNonNull($__Schema), |
473 | 473 | 'description' => 'Access the current type schema of this server.', |
474 | - 'resolve' => function ( |
|
474 | + 'resolve' => function( |
|
475 | 475 | $source, |
476 | 476 | $args, |
477 | 477 | $context, |
@@ -484,7 +484,7 @@ discard block |
||
484 | 484 | ->withArgument(GraphQL::SCHEMA_INTROSPECTION); |
485 | 485 | |
486 | 486 | $this->container->add(GraphQL::TYPE_META_FIELD_DEFINITION, |
487 | - function ($__Type) { |
|
487 | + function($__Type) { |
|
488 | 488 | return new Field([ |
489 | 489 | 'name' => '__type', |
490 | 490 | 'type' => $__Type, |
@@ -492,7 +492,7 @@ discard block |
||
492 | 492 | 'args' => [ |
493 | 493 | 'name' => ['type' => newNonNull(String())], |
494 | 494 | ], |
495 | - 'resolve' => function ( |
|
495 | + 'resolve' => function( |
|
496 | 496 | $source, |
497 | 497 | $args, |
498 | 498 | $context, |
@@ -507,12 +507,12 @@ discard block |
||
507 | 507 | ->withArgument(GraphQL::TYPE_INTROSPECTION); |
508 | 508 | |
509 | 509 | $this->container->add(GraphQL::TYPE_NAME_META_FIELD_DEFINITION, |
510 | - function () { |
|
510 | + function() { |
|
511 | 511 | return new Field([ |
512 | 512 | 'name' => '__typename', |
513 | 513 | 'type' => newNonNull(String()), |
514 | 514 | 'description' => 'The name of the current Object type at runtime.', |
515 | - 'resolve' => function ( |
|
515 | + 'resolve' => function( |
|
516 | 516 | $source, |
517 | 517 | $args, |
518 | 518 | $context, |
@@ -59,8 +59,8 @@ discard block |
||
59 | 59 | function assertType($type) |
60 | 60 | { |
61 | 61 | invariant( |
62 | - $type instanceof TypeInterface, |
|
63 | - \sprintf('Expected %s to be a GraphQL type.', (string)$type) |
|
62 | + $type instanceof TypeInterface, |
|
63 | + \sprintf('Expected %s to be a GraphQL type.', (string)$type) |
|
64 | 64 | ); |
65 | 65 | } |
66 | 66 | |
@@ -72,8 +72,8 @@ discard block |
||
72 | 72 | function assertScalarType(TypeInterface $type) |
73 | 73 | { |
74 | 74 | invariant( |
75 | - $type instanceof ScalarType, |
|
76 | - \sprintf('Expected %s to be a GraphQL Scalar type.', (string)$type) |
|
75 | + $type instanceof ScalarType, |
|
76 | + \sprintf('Expected %s to be a GraphQL Scalar type.', (string)$type) |
|
77 | 77 | ); |
78 | 78 | } |
79 | 79 | |
@@ -85,8 +85,8 @@ discard block |
||
85 | 85 | function assertObjectType(TypeInterface $type) |
86 | 86 | { |
87 | 87 | invariant( |
88 | - $type instanceof ObjectType, |
|
89 | - \sprintf('Expected %s to be a GraphQL Object type.', (string)$type) |
|
88 | + $type instanceof ObjectType, |
|
89 | + \sprintf('Expected %s to be a GraphQL Object type.', (string)$type) |
|
90 | 90 | ); |
91 | 91 | } |
92 | 92 | |
@@ -98,8 +98,8 @@ discard block |
||
98 | 98 | function assertInterfaceType(TypeInterface $type) |
99 | 99 | { |
100 | 100 | invariant( |
101 | - $type instanceof InterfaceType, |
|
102 | - \sprintf('Expected %s to be a GraphQL Interface type.', (string)$type) |
|
101 | + $type instanceof InterfaceType, |
|
102 | + \sprintf('Expected %s to be a GraphQL Interface type.', (string)$type) |
|
103 | 103 | ); |
104 | 104 | } |
105 | 105 | |
@@ -111,8 +111,8 @@ discard block |
||
111 | 111 | function assertUnionType(TypeInterface $type) |
112 | 112 | { |
113 | 113 | invariant( |
114 | - $type instanceof UnionType, |
|
115 | - \sprintf('Expected %s to be a GraphQL Union type.', (string)$type) |
|
114 | + $type instanceof UnionType, |
|
115 | + \sprintf('Expected %s to be a GraphQL Union type.', (string)$type) |
|
116 | 116 | ); |
117 | 117 | } |
118 | 118 | |
@@ -124,8 +124,8 @@ discard block |
||
124 | 124 | function assertEnumType(TypeInterface $type) |
125 | 125 | { |
126 | 126 | invariant( |
127 | - $type instanceof EnumType, |
|
128 | - \sprintf('Expected %s to be a GraphQL Enum type.', (string)$type) |
|
127 | + $type instanceof EnumType, |
|
128 | + \sprintf('Expected %s to be a GraphQL Enum type.', (string)$type) |
|
129 | 129 | ); |
130 | 130 | } |
131 | 131 | |
@@ -137,8 +137,8 @@ discard block |
||
137 | 137 | function assertInputObjectType(TypeInterface $type) |
138 | 138 | { |
139 | 139 | invariant( |
140 | - $type instanceof InputObjectType, |
|
141 | - \sprintf('Expected %s to be a GraphQL InputObject type.', (string)$type) |
|
140 | + $type instanceof InputObjectType, |
|
141 | + \sprintf('Expected %s to be a GraphQL InputObject type.', (string)$type) |
|
142 | 142 | ); |
143 | 143 | } |
144 | 144 | |
@@ -150,8 +150,8 @@ discard block |
||
150 | 150 | function assertListType(TypeInterface $type) |
151 | 151 | { |
152 | 152 | invariant( |
153 | - $type instanceof ListType, |
|
154 | - \sprintf('Expected %s to be a GraphQL List type.', (string)$type) |
|
153 | + $type instanceof ListType, |
|
154 | + \sprintf('Expected %s to be a GraphQL List type.', (string)$type) |
|
155 | 155 | ); |
156 | 156 | } |
157 | 157 | |
@@ -163,8 +163,8 @@ discard block |
||
163 | 163 | function assertNonNullType(TypeInterface $type) |
164 | 164 | { |
165 | 165 | invariant( |
166 | - $type instanceof NonNullType, |
|
167 | - \sprintf('Expected %s to be a GraphQL NonNull type.', (string)$type) |
|
166 | + $type instanceof NonNullType, |
|
167 | + \sprintf('Expected %s to be a GraphQL NonNull type.', (string)$type) |
|
168 | 168 | ); |
169 | 169 | } |
170 | 170 | |
@@ -190,8 +190,8 @@ discard block |
||
190 | 190 | function assertInputType(TypeInterface $type) |
191 | 191 | { |
192 | 192 | invariant( |
193 | - isInputType($type), |
|
194 | - \sprintf('Expected %s to be a GraphQL input type.', (string)$type) |
|
193 | + isInputType($type), |
|
194 | + \sprintf('Expected %s to be a GraphQL input type.', (string)$type) |
|
195 | 195 | ); |
196 | 196 | } |
197 | 197 | |
@@ -217,8 +217,8 @@ discard block |
||
217 | 217 | function assertOutputType(TypeInterface $type) |
218 | 218 | { |
219 | 219 | invariant( |
220 | - isOutputType($type), |
|
221 | - \sprintf('Expected %s to be a GraphQL output type.', (string)$type) |
|
220 | + isOutputType($type), |
|
221 | + \sprintf('Expected %s to be a GraphQL output type.', (string)$type) |
|
222 | 222 | ); |
223 | 223 | } |
224 | 224 | |
@@ -230,8 +230,8 @@ discard block |
||
230 | 230 | function assertLeafType(TypeInterface $type) |
231 | 231 | { |
232 | 232 | invariant( |
233 | - $type instanceof LeafTypeInterface, |
|
234 | - \sprintf('Expected %s to be a GraphQL leaf type.', (string)$type) |
|
233 | + $type instanceof LeafTypeInterface, |
|
234 | + \sprintf('Expected %s to be a GraphQL leaf type.', (string)$type) |
|
235 | 235 | ); |
236 | 236 | } |
237 | 237 | |
@@ -243,8 +243,8 @@ discard block |
||
243 | 243 | function assertCompositeType(TypeInterface $type) |
244 | 244 | { |
245 | 245 | invariant( |
246 | - $type instanceof CompositeTypeInterface, |
|
247 | - \sprintf('Expected %s to be a GraphQL composite type.', (string)$type) |
|
246 | + $type instanceof CompositeTypeInterface, |
|
247 | + \sprintf('Expected %s to be a GraphQL composite type.', (string)$type) |
|
248 | 248 | ); |
249 | 249 | } |
250 | 250 | |
@@ -256,8 +256,8 @@ discard block |
||
256 | 256 | function assertAbstractType(TypeInterface $type) |
257 | 257 | { |
258 | 258 | invariant( |
259 | - $type instanceof AbstractTypeInterface, |
|
260 | - \sprintf('Expected %s to be a GraphQL abstract type.', (string)$type) |
|
259 | + $type instanceof AbstractTypeInterface, |
|
260 | + \sprintf('Expected %s to be a GraphQL abstract type.', (string)$type) |
|
261 | 261 | ); |
262 | 262 | } |
263 | 263 | |
@@ -269,8 +269,8 @@ discard block |
||
269 | 269 | function assertWrappingType(TypeInterface $type) |
270 | 270 | { |
271 | 271 | invariant( |
272 | - $type instanceof WrappingTypeInterface, |
|
273 | - \sprintf('Expected %s to be a GraphQL wrapping type.', (string)$type) |
|
272 | + $type instanceof WrappingTypeInterface, |
|
273 | + \sprintf('Expected %s to be a GraphQL wrapping type.', (string)$type) |
|
274 | 274 | ); |
275 | 275 | } |
276 | 276 | |
@@ -293,8 +293,8 @@ discard block |
||
293 | 293 | function assertNullableType(TypeInterface $type): TypeInterface |
294 | 294 | { |
295 | 295 | invariant( |
296 | - isNullableType($type), |
|
297 | - \sprintf('Expected %s to be a GraphQL nullable type.', (string)$type) |
|
296 | + isNullableType($type), |
|
297 | + \sprintf('Expected %s to be a GraphQL nullable type.', (string)$type) |
|
298 | 298 | ); |
299 | 299 | |
300 | 300 | return $type; |
@@ -322,8 +322,8 @@ discard block |
||
322 | 322 | function assertNamedType(TypeInterface $type) |
323 | 323 | { |
324 | 324 | invariant( |
325 | - $type instanceof NamedTypeInterface, |
|
326 | - \sprintf('Expected %s to be a GraphQL named type.', (string)$type) |
|
325 | + $type instanceof NamedTypeInterface, |
|
326 | + \sprintf('Expected %s to be a GraphQL named type.', (string)$type) |
|
327 | 327 | ); |
328 | 328 | } |
329 | 329 |
@@ -37,9 +37,9 @@ discard block |
||
37 | 37 | function specifiedDirectives(): array |
38 | 38 | { |
39 | 39 | return [ |
40 | - IncludeDirective(), |
|
41 | - SkipDirective(), |
|
42 | - DeprecatedDirective(), |
|
40 | + IncludeDirective(), |
|
41 | + SkipDirective(), |
|
42 | + DeprecatedDirective(), |
|
43 | 43 | ]; |
44 | 44 | } |
45 | 45 | |
@@ -51,9 +51,9 @@ discard block |
||
51 | 51 | function isSpecifiedDirective(DirectiveInterface $directive): bool |
52 | 52 | { |
53 | 53 | return arraySome( |
54 | - specifiedDirectives(), |
|
55 | - function (DirectiveInterface $specifiedDirective) use ($directive) { |
|
56 | - return $specifiedDirective->getName() === $directive->getName(); |
|
57 | - } |
|
54 | + specifiedDirectives(), |
|
55 | + function (DirectiveInterface $specifiedDirective) use ($directive) { |
|
56 | + return $specifiedDirective->getName() === $directive->getName(); |
|
57 | + } |
|
58 | 58 | ); |
59 | 59 | } |
@@ -52,7 +52,7 @@ |
||
52 | 52 | { |
53 | 53 | return arraySome( |
54 | 54 | specifiedDirectives(), |
55 | - function (DirectiveInterface $specifiedDirective) use ($directive) { |
|
55 | + function(DirectiveInterface $specifiedDirective) use ($directive) { |
|
56 | 56 | return $specifiedDirective->getName() === $directive->getName(); |
57 | 57 | } |
58 | 58 | ); |