1 | <?php |
||
13 | class RequestController implements ContainerInjectionInterface { |
||
14 | |||
15 | /** |
||
16 | * The query processor. |
||
17 | * |
||
18 | * @var \Drupal\graphql\GraphQL\Execution\QueryProcessor |
||
19 | */ |
||
20 | protected $processor; |
||
21 | |||
22 | /** |
||
23 | * The service configuration parameters. |
||
24 | * |
||
25 | * @var array |
||
26 | */ |
||
27 | protected $parameters; |
||
28 | |||
29 | /** |
||
30 | * {@inheritdoc} |
||
31 | */ |
||
32 | public static function create(ContainerInterface $container) { |
||
38 | |||
39 | /** |
||
40 | * RequestController constructor. |
||
41 | * |
||
42 | * @param \Drupal\graphql\GraphQL\Execution\QueryProcessor $processor |
||
43 | * The query processor. |
||
44 | * @param array $parameters |
||
45 | * The service configuration parameters. |
||
46 | */ |
||
47 | public function __construct(QueryProcessor $processor, array $parameters) { |
||
51 | |||
52 | /** |
||
53 | * Handles graphql requests. |
||
54 | * |
||
55 | * @param string $schema |
||
56 | * The name of the schema. |
||
57 | * @param \GraphQL\Server\OperationParams|\GraphQL\Server\OperationParams[] $operations |
||
58 | * The graphql operation(s) to execute. |
||
59 | * |
||
60 | * @return \Drupal\Core\Cache\CacheableJsonResponse |
||
61 | * The JSON formatted response. |
||
62 | */ |
||
63 | public function handleRequest($schema, $operations) { |
||
73 | |||
74 | /** |
||
75 | * @param $schema |
||
76 | * @param $operations |
||
77 | * @param array $globals |
||
78 | * |
||
79 | * @return \Drupal\Core\Cache\CacheableJsonResponse |
||
80 | */ |
||
81 | protected function handleSingle($schema, $operations, $globals) { |
||
90 | |||
91 | /** |
||
92 | * @param $schema |
||
93 | * @param $operations |
||
94 | * @param array $globals |
||
95 | * |
||
96 | * @return \Drupal\Core\Cache\CacheableJsonResponse |
||
97 | */ |
||
98 | protected function handleBatch($schema, $operations, $globals) { |
||
113 | |||
114 | protected function logErrors($result, $globals) { |
||
121 | } |
||
122 | |||
123 |
There are different options of fixing this problem.
If you want to be on the safe side, you can add an additional type-check:
If you are sure that the expression is traversable, you might want to add a doc comment cast to improve IDE auto-completion and static analysis:
Mark the issue as a false-positive: Just hover the remove button, in the top-right corner of this issue for more options.