We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
| 1 | <?php |
||
| 21 | class Executor |
||
| 22 | { |
||
| 23 | const PROMISE_ADAPTER_SERVICE_ID = 'overblog_graphql.promise_adapter'; |
||
| 24 | |||
| 25 | /** @var Schema[] */ |
||
| 26 | private $schemas; |
||
| 27 | |||
| 28 | /** @var EventDispatcherInterface|null */ |
||
| 29 | private $dispatcher; |
||
| 30 | |||
| 31 | /** @var ExecutorInterface */ |
||
| 32 | private $executor; |
||
| 33 | |||
| 34 | /** @var PromiseAdapter */ |
||
| 35 | private $promiseAdapter; |
||
| 36 | |||
| 37 | /** @var callable|null */ |
||
| 38 | private $defaultFieldResolver; |
||
| 39 | |||
| 40 | 77 | public function __construct( |
|
| 41 | ExecutorInterface $executor, |
||
| 42 | EventDispatcherInterface $dispatcher, |
||
| 43 | PromiseAdapter $promiseAdapter, |
||
| 44 | callable $defaultFieldResolver = null |
||
| 45 | ) { |
||
| 46 | 77 | $this->executor = $executor; |
|
| 47 | 77 | $this->dispatcher = $dispatcher; |
|
| 48 | 77 | $this->promiseAdapter = $promiseAdapter; |
|
| 49 | 77 | $this->defaultFieldResolver = $defaultFieldResolver; |
|
| 50 | 77 | } |
|
| 51 | |||
| 52 | 2 | public function setExecutor(ExecutorInterface $executor) |
|
| 53 | { |
||
| 54 | 2 | $this->executor = $executor; |
|
| 55 | |||
| 56 | 2 | return $this; |
|
| 57 | } |
||
| 58 | |||
| 59 | 1 | public function setPromiseAdapter(PromiseAdapter $promiseAdapter) |
|
| 60 | { |
||
| 61 | 1 | $this->promiseAdapter = $promiseAdapter; |
|
| 62 | |||
| 63 | 1 | return $this; |
|
| 64 | } |
||
| 65 | |||
| 66 | /** |
||
| 67 | * @param string $name |
||
| 68 | * @param Schema $schema |
||
| 69 | * |
||
| 70 | * @return $this |
||
| 71 | */ |
||
| 72 | 69 | public function addSchema($name, Schema $schema) |
|
| 78 | |||
| 79 | /** |
||
| 80 | * @param string|null $name |
||
| 81 | * |
||
| 82 | * @return Schema |
||
| 83 | */ |
||
| 84 | 65 | public function getSchema($name = null) |
|
| 101 | |||
| 102 | 73 | public function setMaxQueryDepth($maxQueryDepth) |
|
| 108 | |||
| 109 | 73 | public function setMaxQueryComplexity($maxQueryComplexity) |
|
| 115 | |||
| 116 | /** |
||
| 117 | * @param null|string $schemaName |
||
| 118 | * @param array $request |
||
| 119 | * @param null|array|\ArrayObject|object $rootValue |
||
| 120 | * |
||
| 121 | * @return ExecutionResult |
||
| 122 | */ |
||
| 123 | 63 | public function execute($schemaName, array $request, $rootValue = null) |
|
| 124 | { |
||
| 125 | 63 | $executorArgumentsEvent = $this->preExecute( |
|
| 126 | 63 | $this->getSchema($schemaName), |
|
| 127 | 62 | isset($request[ParserInterface::PARAM_QUERY]) ? $request[ParserInterface::PARAM_QUERY] : null, |
|
| 128 | 62 | new \ArrayObject(), |
|
| 129 | 62 | $rootValue, |
|
| 130 | 62 | $request[ParserInterface::PARAM_VARIABLES], |
|
| 131 | 62 | isset($request[ParserInterface::PARAM_OPERATION_NAME]) ? $request[ParserInterface::PARAM_OPERATION_NAME] : null |
|
| 132 | ); |
||
| 133 | |||
| 134 | 61 | $result = $this->executor->execute( |
|
| 135 | 61 | $executorArgumentsEvent->getSchema(), |
|
| 136 | 61 | $executorArgumentsEvent->getRequestString(), |
|
| 137 | 61 | $executorArgumentsEvent->getRootValue(), |
|
| 138 | 61 | $executorArgumentsEvent->getContextValue(), |
|
|
|
|||
| 139 | 61 | $executorArgumentsEvent->getVariableValue(), |
|
| 140 | 61 | $executorArgumentsEvent->getOperationName() |
|
| 141 | ); |
||
| 142 | |||
| 143 | 61 | $result = $this->postExecute($result); |
|
| 144 | |||
| 145 | 59 | return $result; |
|
| 146 | } |
||
| 147 | |||
| 148 | /** |
||
| 149 | * @param Schema $schema |
||
| 150 | * @param string $requestString |
||
| 151 | * @param \ArrayObject $contextValue |
||
| 152 | * @param mixed $rootValue |
||
| 153 | * @param array|null $variableValue |
||
| 154 | * @param string|null $operationName |
||
| 155 | * |
||
| 156 | * @return ExecutorArgumentsEvent |
||
| 157 | */ |
||
| 158 | 62 | private function preExecute( |
|
| 159 | Schema $schema, |
||
| 160 | $requestString, |
||
| 161 | \ArrayObject $contextValue, |
||
| 162 | $rootValue = null, |
||
| 163 | array $variableValue = null, |
||
| 164 | $operationName = null |
||
| 165 | ) { |
||
| 166 | 62 | $this->checkPromiseAdapter(); |
|
| 167 | |||
| 168 | 61 | $this->executor->setPromiseAdapter($this->promiseAdapter); |
|
| 169 | // this is needed when not using only generated types |
||
| 170 | 61 | if ($this->defaultFieldResolver) { |
|
| 171 | 59 | $this->executor->setDefaultFieldResolver($this->defaultFieldResolver); |
|
| 172 | } |
||
| 173 | 61 | $this->dispatcher->dispatch(Events::EXECUTOR_CONTEXT, new ExecutorContextEvent($contextValue)); |
|
| 174 | |||
| 175 | 61 | return $this->dispatcher->dispatch( |
|
| 176 | 61 | Events::PRE_EXECUTOR, |
|
| 177 | 61 | ExecutorArgumentsEvent::create($schema, $requestString, $contextValue, $rootValue, $variableValue, $operationName) |
|
| 178 | ); |
||
| 179 | } |
||
| 180 | |||
| 181 | /** |
||
| 182 | * @param ExecutionResult|Promise $result |
||
| 183 | * |
||
| 184 | * @return ExecutionResult |
||
| 185 | */ |
||
| 186 | 61 | private function postExecute($result) |
|
| 196 | |||
| 197 | 62 | private function checkPromiseAdapter() |
|
| 209 | |||
| 210 | 61 | private function checkExecutionResult($result) |
|
| 218 | } |
||
| 219 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: