@@ -24,7 +24,6 @@ |
||
24 | 24 | use Railt\SDL\Compiler\Ast\Value\NullValueNode; |
25 | 25 | use Railt\SDL\Compiler\Ast\Value\ValueInterface; |
26 | 26 | use Railt\SDL\Compiler\Ast\Value\ValueNode; |
27 | -use Railt\SDL\Exception\SemanticException; |
|
28 | 27 | use Railt\SDL\Exception\TypeConflictException; |
29 | 28 | |
30 | 29 | /** |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | /** |
105 | 105 | * @validation <name: [Type] = Value> |
106 | 106 | */ |
107 | - if (! ($value instanceof ListValueNode)) { |
|
107 | + if (!($value instanceof ListValueNode)) { |
|
108 | 108 | $error = 'Value of %s should be a List, but %s given'; |
109 | 109 | throw (new TypeConflictException(\sprintf($error, $type, $value->toString())))->throwsIn($type->getFile(), |
110 | 110 | $value->getOffset()); |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | /** |
165 | 165 | * @validation <name: InputType = Value> |
166 | 166 | */ |
167 | - if (! ($value instanceof InputValueNode)) { |
|
167 | + if (!($value instanceof InputValueNode)) { |
|
168 | 168 | $error = 'Value of %s should be a %s, but %s given'; |
169 | 169 | throw (new TypeConflictException(\sprintf($error, $type, $type->getDefinition(), |
170 | 170 | $value->toString())))->throwsIn($type->getFile(), $value->getOffset()); |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | /** |
187 | 187 | * @validation <name: InputType = {nonExistentField: Value}> |
188 | 188 | */ |
189 | - if (! $definition->hasField($name)) { |
|
189 | + if (!$definition->hasField($name)) { |
|
190 | 190 | $error = 'Input field "%s" does not provided by %s, but %s given'; |
191 | 191 | throw (new TypeConflictException(\sprintf($error, $name, $type->getDefinition(), |
192 | 192 | $value->toString())))->throwsIn($type->getFile(), $value->getOffset()); |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | /** |
210 | 210 | * @validation <name: Enum = "NotEnumValue"> |
211 | 211 | */ |
212 | - if (! ($value instanceof ConstantValueNode)) { |
|
212 | + if (!($value instanceof ConstantValueNode)) { |
|
213 | 213 | $error = 'Value of %s can be one of %s value, but %s given'; |
214 | 214 | throw (new TypeConflictException(\sprintf($error, $type, $type->getDefinition(), $value->toString()))) |
215 | 215 | ->throwsIn($type->getFile(), $value->getOffset()); |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | /** |
224 | 224 | * @validation <name: Enum = NonExistentValue> |
225 | 225 | */ |
226 | - if (! $definition->hasValue($name)) { |
|
226 | + if (!$definition->hasValue($name)) { |
|
227 | 227 | $error = 'Enum %s does not provide value %s'; |
228 | 228 | throw (new TypeConflictException(\sprintf($error, $type->getDefinition(), $value->toString()))) |
229 | 229 | ->throwsIn($type->getFile(), $value->getOffset()); |
@@ -12,7 +12,6 @@ |
||
12 | 12 | use Railt\Reflection\Contracts\Definition; |
13 | 13 | use Railt\Reflection\Contracts\Definition\InputDefinition; |
14 | 14 | use Railt\Reflection\Contracts\Invocation\InputInvocation; |
15 | -use Railt\Reflection\Contracts\Invocation\TypeInvocation; |
|
16 | 15 | use Railt\SDL\Exception\SemanticException; |
17 | 16 | use Railt\SDL\Exception\TypeConflictException; |
18 | 17 |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | $stack = clone $this->stack; |
78 | 78 | |
79 | 79 | foreach ($stack as $i) { |
80 | - if ((string)$i === (string)$definition) { |
|
80 | + if ((string) $i === (string) $definition) { |
|
81 | 81 | return true; |
82 | 82 | } |
83 | 83 | } |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | foreach ($definition->getFields() as $field) { |
116 | 116 | $argument = $input->getArgument($field->getName()); |
117 | 117 | |
118 | - if ($argument === null && $field->isNonNull() && ! $field->hasDefaultValue()) { |
|
118 | + if ($argument === null && $field->isNonNull() && !$field->hasDefaultValue()) { |
|
119 | 119 | $error = \sprintf('Missing value for required argument %s', $field); |
120 | 120 | throw (new TypeConflictException($error))->throwsIn($input->getFile(), $input->getLine(), |
121 | 121 | $input->getColumn()); |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | |
99 | 99 | /** |
100 | 100 | * @param mixed $value |
101 | - * @return iterable|TypeDefinition[] |
|
101 | + * @return \Generator |
|
102 | 102 | * @throws \Railt\Reflection\Exception\TypeNotFoundException |
103 | 103 | */ |
104 | 104 | public function resolveType($value): iterable |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | /** |
139 | 139 | * @param TypeDefinition $type |
140 | 140 | * @param \Closure $filter |
141 | - * @return \Generator|TypeDefinition[] |
|
141 | + * @return \Generator |
|
142 | 142 | */ |
143 | 143 | private function inheritedBy(TypeDefinition $type, \Closure $filter): \Traversable |
144 | 144 | { |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | */ |
122 | 122 | private function getFilter(): \Closure |
123 | 123 | { |
124 | - return function (TypeDefinition $resolved): bool { |
|
124 | + return function(TypeDefinition $resolved): bool { |
|
125 | 125 | return $this->shouldBreak($resolved); |
126 | 126 | }; |
127 | 127 | } |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | */ |
133 | 133 | private function shouldBreak(TypeDefinition $resolved): bool |
134 | 134 | { |
135 | - return ! isset($this->breakpoints[$resolved->getName()]); |
|
135 | + return !isset($this->breakpoints[$resolved->getName()]); |
|
136 | 136 | } |
137 | 137 | |
138 | 138 | /** |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | yield $type; |
146 | 146 | |
147 | 147 | foreach ($type->inheritedBy() as $child) { |
148 | - if (! $filter($child)) { |
|
148 | + if (!$filter($child)) { |
|
149 | 149 | continue; |
150 | 150 | } |
151 | 151 |
@@ -73,7 +73,7 @@ |
||
73 | 73 | $location = new DirectiveLocation($directive, $name); |
74 | 74 | $location->withOffset($ast->getOffset()); |
75 | 75 | |
76 | - if (! \in_array($name, $locations, true)) { |
|
76 | + if (!\in_array($name, $locations, true)) { |
|
77 | 77 | $error = \sprintf('Invalid directive location %s, only one of {%s} allowed', |
78 | 78 | $location, \implode(', ', $locations)); |
79 | 79 | throw (new TypeConflictException($error))->throwsIn($directive->getFile(), $ast->getOffset()); |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | $directive = new Invocation($parent->getDocument(), $rule->getDirectiveName()); |
34 | 34 | $directive->withOffset($rule->getOffset()); |
35 | 35 | |
36 | - $this->when->resolving(function () use ($rule, $directive): void { |
|
36 | + $this->when->resolving(function() use ($rule, $directive): void { |
|
37 | 37 | $definition = $this->loadDefinition($directive, $rule); |
38 | 38 | |
39 | 39 | $this->buildArguments($directive, $definition, $rule); |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | /** @var DirectiveDefinition $definition */ |
56 | 56 | $definition = $directive->getDefinition(); |
57 | 57 | |
58 | - if (! ($definition instanceof Definition\DirectiveDefinition)) { |
|
58 | + if (!($definition instanceof Definition\DirectiveDefinition)) { |
|
59 | 59 | $error = '%s should be a Directive, but %s given'; |
60 | 60 | throw (new TypeConflictException(\sprintf($error, $directive, |
61 | 61 | $definition)))->throwsIn($directive->getFile(), $rule->getOffset()); |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | continue; |
102 | 102 | } |
103 | 103 | |
104 | - if (! $argument->hasDefaultValue()) { |
|
104 | + if (!$argument->hasDefaultValue()) { |
|
105 | 105 | $error = 'Missing value for required argument %s of %s'; |
106 | 106 | throw (new TypeConflictException(\sprintf($error, $argument, |
107 | 107 | $directive)))->throwsIn($directive->getFile(), $directive->getLine(), $directive->getColumn()); |
@@ -37,7 +37,7 @@ |
||
37 | 37 | $value->withOffset($rule->getOffset()); |
38 | 38 | $value->withDescription($rule->getDescription()); |
39 | 39 | |
40 | - $this->when->runtime(function () use ($rule, $value): void { |
|
40 | + $this->when->runtime(function() use ($rule, $value): void { |
|
41 | 41 | if ($hint = $rule->getTypeHint()) { |
42 | 42 | $virtualTypeHint = $this->virtualTypeHint($value, $hint); |
43 | 43 |
@@ -68,7 +68,8 @@ |
||
68 | 68 | */ |
69 | 69 | private function virtualTypeHint(EnumValueDefinition $value, TypeHintNode $ast): TypeHint |
70 | 70 | { |
71 | - $virtual = new class($value->getDocument(), $value->getName()) extends TypeHint { |
|
71 | + $virtual = new class($value->getDocument(), $value->getName()) extends TypeHint |
|
72 | + { |
|
72 | 73 | /** |
73 | 74 | * @var string |
74 | 75 | */ |
@@ -51,7 +51,7 @@ |
||
51 | 51 | ]); |
52 | 52 | }); |
53 | 53 | |
54 | - $this->when->runtime(function () use ($rule, $field): void { |
|
54 | + $this->when->runtime(function() use ($rule, $field): void { |
|
55 | 55 | foreach ($rule->getDirectives() as $ast) { |
56 | 56 | $field->withDirective($this->dependent($ast, $field)); |
57 | 57 | } |
@@ -44,7 +44,7 @@ |
||
44 | 44 | $this->shouldBeTypeOf($field, $field->getDefinition(), [ |
45 | 45 | Type::SCALAR, |
46 | 46 | Type::OBJECT, |
47 | - Type::INTERFACE, |
|
47 | + Type::interface, |
|
48 | 48 | Type::UNION, |
49 | 49 | Type::ENUM, |
50 | 50 | Type::ANY, |
@@ -44,7 +44,7 @@ |
||
44 | 44 | ]); |
45 | 45 | }); |
46 | 46 | |
47 | - $this->when->runtime(function () use ($rule, $field): void { |
|
47 | + $this->when->runtime(function() use ($rule, $field): void { |
|
48 | 48 | if ($default = $rule->getDefaultValue()) { |
49 | 49 | $field->withDefaultValue($this->valueOf($field, $default)); |
50 | 50 | } |
@@ -44,10 +44,10 @@ |
||
44 | 44 | ]); |
45 | 45 | }); |
46 | 46 | |
47 | - $this->when->runtime(function () use ($rule, $argument): void { |
|
47 | + $this->when->runtime(function() use ($rule, $argument): void { |
|
48 | 48 | if ($default = $rule->getDefaultValue()) { |
49 | 49 | $argument->withDefaultValue($this->valueOf($argument, $default)); |
50 | - } elseif (! $argument->isNonNull()) { |
|
50 | + } elseif (!$argument->isNonNull()) { |
|
51 | 51 | $argument->withDefaultValue(null); |
52 | 52 | } |
53 | 53 |