@@ -28,6 +28,9 @@ discard block |
||
| 28 | 28 | */ |
| 29 | 29 | private $directiveList; |
| 30 | 30 | |
| 31 | + /** |
|
| 32 | + * @param \Youshido\GraphQL\Schema\AbstractSchema $contextObject |
|
| 33 | + */ |
|
| 31 | 34 | public function __construct(array $configData, $contextObject = null, $finalClass = false) |
| 32 | 35 | { |
| 33 | 36 | $this->typesList = new SchemaTypesList(); |
@@ -88,7 +91,7 @@ discard block |
||
| 88 | 91 | } |
| 89 | 92 | |
| 90 | 93 | /** |
| 91 | - * @param $query AbstractObjectType |
|
| 94 | + * @param ObjectType $query AbstractObjectType |
|
| 92 | 95 | * |
| 93 | 96 | * @return SchemaConfig |
| 94 | 97 | */ |
@@ -21,7 +21,6 @@ discard block |
||
| 21 | 21 | |
| 22 | 22 | /** |
| 23 | 23 | * @param string $name |
| 24 | - * @param ValueInterface $value |
|
| 25 | 24 | * @param Location $location |
| 26 | 25 | */ |
| 27 | 26 | public function __construct($name, array $arguments, Location $location) |
@@ -33,7 +32,7 @@ discard block |
||
| 33 | 32 | } |
| 34 | 33 | |
| 35 | 34 | /** |
| 36 | - * @return mixed |
|
| 35 | + * @return string |
|
| 37 | 36 | */ |
| 38 | 37 | public function getName() |
| 39 | 38 | { |
@@ -10,9 +10,7 @@ |
||
| 10 | 10 | |
| 11 | 11 | |
| 12 | 12 | use Youshido\GraphQL\Config\Schema\SchemaConfig; |
| 13 | -use Youshido\GraphQL\Type\Object\ObjectType; |
|
| 14 | 13 | use Youshido\GraphQL\Type\SchemaTypesList; |
| 15 | -use Youshido\GraphQL\Type\TypeInterface; |
|
| 16 | 14 | use Youshido\GraphQL\Type\SchemaDirectivesList; |
| 17 | 15 | |
| 18 | 16 | abstract class AbstractSchema |
@@ -41,7 +41,9 @@ discard block |
||
| 41 | 41 | public function addDirective(DirectiveInterface $directive) |
| 42 | 42 | { |
| 43 | 43 | $directiveName = $this->getDirectiveName($directive); |
| 44 | - if ($this->isDirectiveNameRegistered($directiveName)) return $this; |
|
| 44 | + if ($this->isDirectiveNameRegistered($directiveName)) { |
|
| 45 | + return $this; |
|
| 46 | + } |
|
| 45 | 47 | |
| 46 | 48 | $this->directivesList[$directiveName] = $directive; |
| 47 | 49 | |
@@ -50,7 +52,9 @@ discard block |
||
| 50 | 52 | |
| 51 | 53 | private function getDirectiveName($directive) |
| 52 | 54 | { |
| 53 | - if (is_string($directive)) return $directive; |
|
| 55 | + if (is_string($directive)) { |
|
| 56 | + return $directive; |
|
| 57 | + } |
|
| 54 | 58 | if (is_object($directive) && $directive instanceof DirectiveInterface) { |
| 55 | 59 | return $directive->getName(); |
| 56 | 60 | } |
@@ -60,7 +60,7 @@ |
||
| 60 | 60 | |
| 61 | 61 | public function getValidationError($value = null) |
| 62 | 62 | { |
| 63 | - $allowedValues = array_map(function (array $value) { |
|
| 63 | + $allowedValues = array_map(function(array $value) { |
|
| 64 | 64 | return sprintf('%s (%s)', $value['name'], $value['value']); |
| 65 | 65 | }, $this->getConfig()->get('values')); |
| 66 | 66 | return sprintf('Value must be one of the allowed ones: %s', implode(', ', $allowedValues)); |
@@ -59,7 +59,7 @@ |
||
| 59 | 59 | 'type' => new NonNullType(new ListType(new NonNullType(new InputValueType()))), |
| 60 | 60 | 'resolve' => [$this, 'resolveArgs'], |
| 61 | 61 | ]) |
| 62 | - ->addField('locations',[ |
|
| 62 | + ->addField('locations', [ |
|
| 63 | 63 | 'type' => new NonNullType(new ListType(new NonNullType(new DirectiveLocationType()))), |
| 64 | 64 | 'resolve' => [$this, 'resolveLocations'], |
| 65 | 65 | ]); |
@@ -18,7 +18,9 @@ |
||
| 18 | 18 | |
| 19 | 19 | public function buildDirectives() |
| 20 | 20 | { |
| 21 | - if ($this->_isDirectivesBuilt) return true; |
|
| 21 | + if ($this->_isDirectivesBuilt) { |
|
| 22 | + return true; |
|
| 23 | + } |
|
| 22 | 24 | |
| 23 | 25 | if (!empty($this->data['directives'])) { |
| 24 | 26 | $this->addDirectives($this->data['directives']); |
@@ -253,9 +253,9 @@ |
||
| 253 | 253 | $value = substr($this->source, $start, $this->pos - $start); |
| 254 | 254 | |
| 255 | 255 | if (strpos($value, '.') === false) { |
| 256 | - $value = (int) $value; |
|
| 256 | + $value = (int)$value; |
|
| 257 | 257 | } else { |
| 258 | - $value = (float) $value; |
|
| 258 | + $value = (float)$value; |
|
| 259 | 259 | } |
| 260 | 260 | |
| 261 | 261 | return new Token(Token::TYPE_NUMBER, $this->getLine(), $this->getColumn(), $value); |
@@ -235,7 +235,7 @@ discard block |
||
| 235 | 235 | |
| 236 | 236 | protected function findVariable($name) |
| 237 | 237 | { |
| 238 | - foreach ((array) $this->data['variables'] as $variable) { |
|
| 238 | + foreach ((array)$this->data['variables'] as $variable) { |
|
| 239 | 239 | /** @var $variable Variable */ |
| 240 | 240 | if ($variable->getName() === $name) { |
| 241 | 241 | return $variable; |
@@ -478,7 +478,7 @@ discard block |
||
| 478 | 478 | |
| 479 | 479 | protected function matchMulti($types) |
| 480 | 480 | { |
| 481 | - foreach ((array) $types as $type) { |
|
| 481 | + foreach ((array)$types as $type) { |
|
| 482 | 482 | if ($this->peek()->getType() === $type) { |
| 483 | 483 | return true; |
| 484 | 484 | } |