@@ -37,13 +37,13 @@ |
||
37 | 37 | $interface->withField($this->dependent($ast, $interface)); |
38 | 38 | } |
39 | 39 | |
40 | - $this->when->runtime(function () use ($rule, $interface): void { |
|
40 | + $this->when->runtime(function() use ($rule, $interface): void { |
|
41 | 41 | foreach ($rule->getDirectives() as $ast) { |
42 | 42 | $interface->withDirective($this->dependent($ast, $interface)); |
43 | 43 | } |
44 | 44 | }); |
45 | 45 | |
46 | - $this->when->resolving(function () use ($rule, $interface): void { |
|
46 | + $this->when->resolving(function() use ($rule, $interface): void { |
|
47 | 47 | foreach ($rule->getImplementations() as $child) { |
48 | 48 | $interface->withInterface($child->getTypeName()); |
49 | 49 | } |
@@ -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 |