@@ -13,6 +13,9 @@ |
||
| 13 | 13 | |
| 14 | 14 | trait ResolvableObjectTrait { |
| 15 | 15 | |
| 16 | + /** |
|
| 17 | + * @param string|boolean $value |
|
| 18 | + */ |
|
| 16 | 19 | public function resolve($value, array $args, ResolveInfo $info) |
| 17 | 20 | { |
| 18 | 21 | if ($this->resolveFunctionCache === null) { |
@@ -13,34 +13,34 @@ |
||
| 13 | 13 | |
| 14 | 14 | trait ResolvableObjectTrait { |
| 15 | 15 | |
| 16 | - public function resolve($value, array $args, ResolveInfo $info) |
|
| 17 | - { |
|
| 16 | + public function resolve($value, array $args, ResolveInfo $info) |
|
| 17 | + { |
|
| 18 | 18 | if ($this->resolveFunctionCache === null) { |
| 19 | - $this->resolveFunctionCache = $this->getConfig()->getResolveFunction(); |
|
| 19 | + $this->resolveFunctionCache = $this->getConfig()->getResolveFunction(); |
|
| 20 | 20 | |
| 21 | - if (!$this->resolveFunctionCache) { |
|
| 21 | + if (!$this->resolveFunctionCache) { |
|
| 22 | 22 | $this->resolveFunctionCache = false; |
| 23 | - } |
|
| 23 | + } |
|
| 24 | 24 | } |
| 25 | 25 | if ($this->resolveFunctionCache) { |
| 26 | - $resolveFunction = $this->resolveFunctionCache; |
|
| 26 | + $resolveFunction = $this->resolveFunctionCache; |
|
| 27 | 27 | |
| 28 | - return $resolveFunction($value, $args, $info); |
|
| 28 | + return $resolveFunction($value, $args, $info); |
|
| 29 | 29 | } else { |
| 30 | - if (is_array($value) && array_key_exists($this->getName(), $value)) { |
|
| 30 | + if (is_array($value) && array_key_exists($this->getName(), $value)) { |
|
| 31 | 31 | return $value[$this->getName()]; |
| 32 | - } elseif (is_object($value)) { |
|
| 32 | + } elseif (is_object($value)) { |
|
| 33 | 33 | return TypeService::getPropertyValue($value, $this->getName()); |
| 34 | - } elseif ($this->getType()->getNamedType()->getKind() == TypeMap::KIND_SCALAR) { |
|
| 34 | + } elseif ($this->getType()->getNamedType()->getKind() == TypeMap::KIND_SCALAR) { |
|
| 35 | 35 | return null; |
| 36 | - } else { |
|
| 36 | + } else { |
|
| 37 | 37 | throw new \Exception(sprintf('Property "%s" not found in resolve result', $this->getName())); |
| 38 | - } |
|
| 38 | + } |
|
| 39 | + } |
|
| 39 | 40 | } |
| 40 | - } |
|
| 41 | 41 | |
| 42 | 42 | |
| 43 | - public function getResolveFunction() { |
|
| 43 | + public function getResolveFunction() { |
|
| 44 | 44 | return $this->getConfig()->getResolveFunction(); |
| 45 | - } |
|
| 45 | + } |
|
| 46 | 46 | } |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | } |
| 105 | 105 | |
| 106 | 106 | /** |
| 107 | - * @param Query|Field $query |
|
| 107 | + * @param Query $query |
|
| 108 | 108 | * @param AbstractObjectType $currentLevelSchema |
| 109 | 109 | * @return array|bool|mixed |
| 110 | 110 | */ |
@@ -236,6 +236,9 @@ discard block |
||
| 236 | 236 | return $value; |
| 237 | 237 | } |
| 238 | 238 | |
| 239 | + /** |
|
| 240 | + * @param FieldInterface $field |
|
| 241 | + */ |
|
| 239 | 242 | protected function createResolveInfo($field, $fields) |
| 240 | 243 | { |
| 241 | 244 | return new ResolveInfo($field, $fields, $this->executionContext); |
@@ -284,7 +287,7 @@ discard block |
||
| 284 | 287 | } |
| 285 | 288 | |
| 286 | 289 | /** |
| 287 | - * @param $query Query|FragmentInterface |
|
| 290 | + * @param Query $query Query|FragmentInterface |
|
| 288 | 291 | * @param $queryType AbstractObjectType|TypeInterface|Field|AbstractType |
| 289 | 292 | * @param $resolvedValue mixed |
| 290 | 293 | * @param $value array |
@@ -462,7 +465,7 @@ discard block |
||
| 462 | 465 | * Fragments (anonymous and named), and Fields. The core of the function is simple: recurse until we hit the base |
| 463 | 466 | * case of a Field and yield that back up to the visitor up in `doVisit`. |
| 464 | 467 | * |
| 465 | - * @param Query|Field|FragmentInterface $queryNode |
|
| 468 | + * @param Query $queryNode |
|
| 466 | 469 | * @param FieldInterface $currentLevelAST |
| 467 | 470 | * |
| 468 | 471 | * @return \Generator |