@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | */ |
124 | 124 | private function toFloat(LeafInterface $ast): float |
125 | 125 | { |
126 | - return (float)$ast->getValue(); |
|
126 | + return (float) $ast->getValue(); |
|
127 | 127 | } |
128 | 128 | |
129 | 129 | /** |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | */ |
133 | 133 | private function toInt(LeafInterface $ast): int |
134 | 134 | { |
135 | - return (int)$ast->getValue(); |
|
135 | + return (int) $ast->getValue(); |
|
136 | 136 | } |
137 | 137 | |
138 | 138 | /** |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | return \substr($ast->getValue(), 3, -3); |
169 | 169 | } |
170 | 170 | |
171 | - return (string)$ast->getValue(); |
|
171 | + return (string) $ast->getValue(); |
|
172 | 172 | } |
173 | 173 | |
174 | 174 | /** |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | // TODO Probably may be escaped by backslash like "\\u0000" |
202 | 202 | $pattern = '/\\\\u([0-9a-fA-F]{4})/'; |
203 | 203 | |
204 | - $callee = function (array $matches): string { |
|
204 | + $callee = function(array $matches): string { |
|
205 | 205 | [$char, $code] = [$matches[0], $matches[1]]; |
206 | 206 | |
207 | 207 | try { |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | */ |
66 | 66 | protected function onCompile(NodeInterface $ast): bool |
67 | 67 | { |
68 | - $key = (string)$ast->getChild(0)->getChild(0)->getValue(); |
|
68 | + $key = (string) $ast->getChild(0)->getChild(0)->getValue(); |
|
69 | 69 | $value = $ast->getChild(1)->getChild(0); |
70 | 70 | |
71 | 71 | $this->arguments[$key] = $this->parseValue($value, $this->parentType, \array_merge($this->path, [$key])); |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | */ |
98 | 98 | public function getTypeDefinition(): ?TypeDefinition |
99 | 99 | { |
100 | - $reduce = function (?InputDefinition $carry, $item): ?TypeDefinition { |
|
100 | + $reduce = function(?InputDefinition $carry, $item): ?TypeDefinition { |
|
101 | 101 | /** @var ArgumentDefinition|null $argument */ |
102 | 102 | $argument = $carry->getArgument($item); |
103 | 103 | // TODO $argument can be null. Add validation? |
@@ -56,7 +56,7 @@ |
||
56 | 56 | /** @var ArgumentDefinition|null $argument */ |
57 | 57 | $argument = $definition->getArgument($name); |
58 | 58 | |
59 | - if (! $argument) { |
|
59 | + if (!$argument) { |
|
60 | 60 | $this->getCompiler()->getCallStack()->push($definition); |
61 | 61 | |
62 | 62 | $error = \sprintf('Argument %s not defined in %s', $name, $definition); |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | { |
60 | 60 | $type = DocumentBuilder::AST_TYPE_MAPPING[$ast->getName()] ?? null; |
61 | 61 | |
62 | - if ($type !== null && ! ($type instanceof ExtendDefinition)) { |
|
62 | + if ($type !== null && !($type instanceof ExtendDefinition)) { |
|
63 | 63 | /** @var Compilable $virtualType */ |
64 | 64 | $virtualType = new $type($ast, $this->getDocument()); |
65 | 65 | |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | continue; |
135 | 135 | } |
136 | 136 | |
137 | - $callee = function () use ($extendField): void { |
|
137 | + $callee = function() use ($extendField): void { |
|
138 | 138 | /** @var BaseFieldsContainer $this */ |
139 | 139 | $this->fields[$extendField->getName()] = $extendField; |
140 | 140 | }; |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | private function dataFieldExtender(): \Closure |
150 | 150 | { |
151 | 151 | /** @var FieldDefinition|BaseField $field */ |
152 | - return function (FieldDefinition $field): void { |
|
152 | + return function(FieldDefinition $field): void { |
|
153 | 153 | /** @var BaseField $this */ |
154 | 154 | |
155 | 155 | // Extend type |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | continue; |
192 | 192 | } |
193 | 193 | |
194 | - $callee = function () use ($extendArgument): void { |
|
194 | + $callee = function() use ($extendArgument): void { |
|
195 | 195 | /** @var BaseArgumentsContainer $this */ |
196 | 196 | $this->arguments[$extendArgument->getName()] = $extendArgument; |
197 | 197 | }; |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | private function dataArgumentExtender(): \Closure |
207 | 207 | { |
208 | 208 | /** @var ArgumentDefinition|BaseArgument $argument */ |
209 | - return function (ArgumentDefinition $argument): void { |
|
209 | + return function(ArgumentDefinition $argument): void { |
|
210 | 210 | /** @var BaseArgument $this */ |
211 | 211 | |
212 | 212 | // Extend type |
@@ -241,7 +241,7 @@ discard block |
||
241 | 241 | continue; |
242 | 242 | } |
243 | 243 | |
244 | - $callee = function () use ($extendDirective): void { |
|
244 | + $callee = function() use ($extendDirective): void { |
|
245 | 245 | /** @var BaseArgumentsContainer $this */ |
246 | 246 | $this->arguments[$extendDirective->getName()] = $extendDirective; |
247 | 247 | }; |
@@ -170,7 +170,7 @@ |
||
170 | 170 | |
171 | 171 | // Collect sibling methods |
172 | 172 | foreach (\class_uses_recursive(static::class) as $sibling) { |
173 | - $method = 'compile' . \class_basename($sibling); |
|
173 | + $method = 'compile'.\class_basename($sibling); |
|
174 | 174 | |
175 | 175 | if (\method_exists($sibling, $method)) { |
176 | 176 | $this->siblingActions[] = $method; |
@@ -51,7 +51,7 @@ |
||
51 | 51 | */ |
52 | 52 | public function register(TypeDefinition $type, bool $force = false): Dictionary |
53 | 53 | { |
54 | - if (! $force && $this->has($type->getName())) { |
|
54 | + if (!$force && $this->has($type->getName())) { |
|
55 | 55 | $error = \sprintf( |
56 | 56 | 'Can not declare %s, because the name %s already in use', |
57 | 57 | $this->typeToString($type), |
@@ -43,7 +43,7 @@ |
||
43 | 43 | */ |
44 | 44 | public function addValidator(string $item): self |
45 | 45 | { |
46 | - if (! \is_subclass_of($item, ValidatorInterface::class)) { |
|
46 | + if (!\is_subclass_of($item, ValidatorInterface::class)) { |
|
47 | 47 | $error = \sprintf('%s must be instance of %s', $item, ValidatorInterface::class); |
48 | 48 | throw new \InvalidArgumentException($error); |
49 | 49 | } |
@@ -51,7 +51,7 @@ |
||
51 | 51 | /** @var DirectiveDefinition $definition */ |
52 | 52 | $definition = $directive->getTypeDefinition(); |
53 | 53 | |
54 | - if (! $definition->isAllowedFor($directive->getParent())) { |
|
54 | + if (!$definition->isAllowedFor($directive->getParent())) { |
|
55 | 55 | $error = \vsprintf('Trying to define directive %s on %s, but only %s locations allowed.', [ |
56 | 56 | $directive, |
57 | 57 | $directive->getParent(), |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | |
72 | 72 | $this->getCallStack()->push($type); |
73 | 73 | |
74 | - if (! ($type instanceof Inputable)) { |
|
74 | + if (!($type instanceof Inputable)) { |
|
75 | 75 | $error = \sprintf('%s must be type of Scalar, Enum or Input', $type); |
76 | 76 | throw new TypeConflictException($error, $this->getCallStack()); |
77 | 77 | } |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | */ |
94 | 94 | private function validateSingleArgument(ArgumentDefinition $arg, Inputable $type, $value): void |
95 | 95 | { |
96 | - if (! $type->isCompatible($value)) { |
|
96 | + if (!$type->isCompatible($value)) { |
|
97 | 97 | $error = \vsprintf('The argument %s of %s contain non compatible value %s', [ |
98 | 98 | $arg->getName(), |
99 | 99 | $type, |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | */ |
113 | 113 | private function validateListArguments(ArgumentDefinition $arg, Inputable $type, $value): void |
114 | 114 | { |
115 | - if (! \is_iterable($value)) { |
|
115 | + if (!\is_iterable($value)) { |
|
116 | 116 | $error = \vsprintf('The argument %s of %s should contain list value, but %s given', [ |
117 | 117 | $arg->getName(), |
118 | 118 | $type, |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | */ |
136 | 136 | private function validateMissingArgument(HasPassedArguments $invocation, ArgumentDefinition $argument): void |
137 | 137 | { |
138 | - if (! $invocation->hasPassedArgument($argument->getName())) { |
|
138 | + if (!$invocation->hasPassedArgument($argument->getName())) { |
|
139 | 139 | $error = \sprintf('Required argument "%s" of %s not specified', $argument, $argument->getParent()); |
140 | 140 | |
141 | 141 | throw new TypeConflictException($error, $this->getCallStack()); |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | */ |
151 | 151 | private function validateArgumentExisting(HasArguments $container, string $argument): void |
152 | 152 | { |
153 | - if (! $container->hasArgument($argument)) { |
|
153 | + if (!$container->hasArgument($argument)) { |
|
154 | 154 | $error = \sprintf('In the %s there is no specified argument "%s"', $container, $argument); |
155 | 155 | |
156 | 156 | throw new TypeConflictException($error, $this->getCallStack()); |