@@ -20,8 +20,8 @@ discard block |
||
20 | 20 | class ScalarValidator extends BaseInheritanceValidator |
21 | 21 | { |
22 | 22 | /** |
23 | - * @param AllowsTypeIndication|TypeDefinition $child |
|
24 | - * @param AllowsTypeIndication|TypeDefinition $parent |
|
23 | + * @param TypeDefinition $child |
|
24 | + * @param TypeDefinition $parent |
|
25 | 25 | * @return bool |
26 | 26 | */ |
27 | 27 | public function match(TypeDefinition $child, TypeDefinition $parent): bool |
@@ -31,8 +31,8 @@ discard block |
||
31 | 31 | } |
32 | 32 | |
33 | 33 | /** |
34 | - * @param AllowsTypeIndication|TypeDefinition $child |
|
35 | - * @param AllowsTypeIndication|TypeDefinition $parent |
|
34 | + * @param TypeDefinition $child |
|
35 | + * @param TypeDefinition $parent |
|
36 | 36 | * @return void |
37 | 37 | * @throws TypeConflictException |
38 | 38 | */ |
@@ -46,8 +46,8 @@ discard block |
||
46 | 46 | } |
47 | 47 | |
48 | 48 | /** |
49 | - * @param AllowsTypeIndication|TypeDefinition $child |
|
50 | - * @param AllowsTypeIndication|TypeDefinition $parent |
|
49 | + * @param TypeDefinition $child |
|
50 | + * @param TypeDefinition $parent |
|
51 | 51 | * @return void |
52 | 52 | * @throws TypeConflictException |
53 | 53 | */ |
@@ -60,8 +60,8 @@ discard block |
||
60 | 60 | } |
61 | 61 | |
62 | 62 | /** |
63 | - * @param AllowsTypeIndication|TypeDefinition $child |
|
64 | - * @param AllowsTypeIndication|TypeDefinition $parent |
|
63 | + * @param TypeDefinition $child |
|
64 | + * @param TypeDefinition $parent |
|
65 | 65 | * @return void |
66 | 66 | * @throws TypeConflictException |
67 | 67 | */ |
@@ -75,8 +75,8 @@ discard block |
||
75 | 75 | } |
76 | 76 | |
77 | 77 | /** |
78 | - * @param AllowsTypeIndication|TypeDefinition $child |
|
79 | - * @param AllowsTypeIndication|TypeDefinition $parent |
|
78 | + * @param TypeDefinition $child |
|
79 | + * @param TypeDefinition $parent |
|
80 | 80 | * @return void |
81 | 81 | * @throws TypeConflictException |
82 | 82 | */ |
@@ -90,8 +90,8 @@ discard block |
||
90 | 90 | } |
91 | 91 | |
92 | 92 | /** |
93 | - * @param AllowsTypeIndication|TypeDefinition $child |
|
94 | - * @param AllowsTypeIndication|TypeDefinition $parent |
|
93 | + * @param TypeDefinition $child |
|
94 | + * @param TypeDefinition $parent |
|
95 | 95 | * @return void |
96 | 96 | * @throws TypeConflictException |
97 | 97 | */ |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | { |
70 | 70 | $parentType = $parent->getTypeDefinition(); |
71 | 71 | |
72 | - if (! ($child->getTypeDefinition() instanceof $parentType)) { |
|
72 | + if (!($child->getTypeDefinition() instanceof $parentType)) { |
|
73 | 73 | $this->throwScalarIncompatibilityException($child, $parent); |
74 | 74 | } |
75 | 75 | } |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | { |
85 | 85 | $childType = $child->getTypeDefinition(); |
86 | 86 | |
87 | - if (! ($parent->getTypeDefinition() instanceof $childType)) { |
|
87 | + if (!($parent->getTypeDefinition() instanceof $childType)) { |
|
88 | 88 | $this->throwScalarIncompatibilityException($child, $parent); |
89 | 89 | } |
90 | 90 | } |
@@ -21,8 +21,8 @@ discard block |
||
21 | 21 | class UnionValidator extends BaseInheritanceValidator |
22 | 22 | { |
23 | 23 | /** |
24 | - * @param AllowsTypeIndication|TypeDefinition $child |
|
25 | - * @param AllowsTypeIndication|TypeDefinition $parent |
|
24 | + * @param TypeDefinition $child |
|
25 | + * @param TypeDefinition $parent |
|
26 | 26 | * @return bool |
27 | 27 | */ |
28 | 28 | public function match(TypeDefinition $child, TypeDefinition $parent): bool |
@@ -32,8 +32,8 @@ discard block |
||
32 | 32 | } |
33 | 33 | |
34 | 34 | /** |
35 | - * @param AllowsTypeIndication|TypeDefinition $child |
|
36 | - * @param AllowsTypeIndication|TypeDefinition $parent |
|
35 | + * @param TypeDefinition $child |
|
36 | + * @param TypeDefinition $parent |
|
37 | 37 | * @return void |
38 | 38 | * @throws TypeConflictException |
39 | 39 | */ |
@@ -49,8 +49,8 @@ discard block |
||
49 | 49 | } |
50 | 50 | |
51 | 51 | /** |
52 | - * @param AllowsTypeIndication|TypeDefinition $child |
|
53 | - * @param AllowsTypeIndication|TypeDefinition $parent |
|
52 | + * @param TypeDefinition $child |
|
53 | + * @param TypeDefinition $parent |
|
54 | 54 | * @return bool |
55 | 55 | */ |
56 | 56 | private function isUnionContainsChild(TypeDefinition $child, TypeDefinition $parent): bool |
@@ -90,7 +90,7 @@ |
||
90 | 90 | */ |
91 | 91 | private function validateUnionContainsChild(TypeDefinition $child, TypeDefinition $parent): void |
92 | 92 | { |
93 | - if (! $this->isUnionContainsChild($child, $parent)) { |
|
93 | + if (!$this->isUnionContainsChild($child, $parent)) { |
|
94 | 94 | $this->throwIncompatibleTypes($child, $parent); |
95 | 95 | } |
96 | 96 | } |
@@ -20,8 +20,8 @@ discard block |
||
20 | 20 | class WrapperValidator extends BaseInheritanceValidator |
21 | 21 | { |
22 | 22 | /** |
23 | - * @param AllowsTypeIndication|TypeDefinition $child |
|
24 | - * @param AllowsTypeIndication|TypeDefinition $parent |
|
23 | + * @param TypeDefinition $child |
|
24 | + * @param TypeDefinition $parent |
|
25 | 25 | * @return bool |
26 | 26 | */ |
27 | 27 | public function match(TypeDefinition $child, TypeDefinition $parent): bool |
@@ -31,8 +31,8 @@ discard block |
||
31 | 31 | } |
32 | 32 | |
33 | 33 | /** |
34 | - * @param AllowsTypeIndication|TypeDefinition $child |
|
35 | - * @param AllowsTypeIndication|TypeDefinition $parent |
|
34 | + * @param TypeDefinition $child |
|
35 | + * @param TypeDefinition $parent |
|
36 | 36 | * @return void |
37 | 37 | * @throws \Railt\SDL\Exceptions\TypeConflictException |
38 | 38 | * @throws \OutOfBoundsException |
@@ -124,8 +124,8 @@ discard block |
||
124 | 124 | } |
125 | 125 | |
126 | 126 | /** |
127 | - * @param AllowsTypeIndication|DependentDefinition $child |
|
128 | - * @param AllowsTypeIndication|DependentDefinition $parent |
|
127 | + * @param AllowsTypeIndication $child |
|
128 | + * @param AllowsTypeIndication $parent |
|
129 | 129 | * @return void |
130 | 130 | * @throws TypeConflictException |
131 | 131 | */ |
@@ -145,8 +145,8 @@ discard block |
||
145 | 145 | } |
146 | 146 | |
147 | 147 | /** |
148 | - * @param AllowsTypeIndication|DependentDefinition $child |
|
149 | - * @param AllowsTypeIndication|DependentDefinition $parent |
|
148 | + * @param AllowsTypeIndication $child |
|
149 | + * @param AllowsTypeIndication $parent |
|
150 | 150 | * @return void |
151 | 151 | * @throws \Railt\SDL\Exceptions\TypeConflictException |
152 | 152 | */ |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | */ |
88 | 88 | private function validateListDirectRedefinition(AllowsTypeIndication $child, AllowsTypeIndication $parent): void |
89 | 89 | { |
90 | - $isBrokenDirectRedefinition = $parent->isList() && ! $child->isList(); |
|
90 | + $isBrokenDirectRedefinition = $parent->isList() && !$child->isList(); |
|
91 | 91 | |
92 | 92 | if ($isBrokenDirectRedefinition) { |
93 | 93 | $error = \sprintf('The %s cannot be overridden by non-list, but %s given', $parent, $child); |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | */ |
116 | 116 | private function validateListInverseRedefinition(AllowsTypeIndication $child, AllowsTypeIndication $parent): void |
117 | 117 | { |
118 | - $isBrokenInverseRedefinition = ! $parent->isList() && $child->isList(); |
|
118 | + $isBrokenInverseRedefinition = !$parent->isList() && $child->isList(); |
|
119 | 119 | |
120 | 120 | if ($isBrokenInverseRedefinition) { |
121 | 121 | $error = \sprintf('The %s cannot be overridden by list, but %s given', $parent, $child); |
@@ -131,10 +131,10 @@ discard block |
||
131 | 131 | */ |
132 | 132 | private function validatePostconditionalInheritance(AllowsTypeIndication $child, AllowsTypeIndication $parent): void |
133 | 133 | { |
134 | - $invalidWrapperInheritance = $parent->isNonNull() && ! $child->isNonNull(); |
|
134 | + $invalidWrapperInheritance = $parent->isNonNull() && !$child->isNonNull(); |
|
135 | 135 | |
136 | 136 | $invalidListWrapperInheritance = $this->isSameWrapperList($child, $parent) && |
137 | - $parent->isListOfNonNulls() && ! $child->isListOfNonNulls(); |
|
137 | + $parent->isListOfNonNulls() && !$child->isListOfNonNulls(); |
|
138 | 138 | |
139 | 139 | if ($invalidWrapperInheritance || $invalidListWrapperInheritance) { |
140 | 140 | $error = '%s postcondition of %s can not be weakened by %s of %s'; |
@@ -152,10 +152,10 @@ discard block |
||
152 | 152 | */ |
153 | 153 | private function validatePreconditionalInheritance(AllowsTypeIndication $child, AllowsTypeIndication $parent): void |
154 | 154 | { |
155 | - $invalidWrapperInheritance = ! $parent->isNonNull() && $child->isNonNull(); |
|
155 | + $invalidWrapperInheritance = !$parent->isNonNull() && $child->isNonNull(); |
|
156 | 156 | |
157 | 157 | $invalidListWrapperInheritance = $this->isSameWrapperList($child, $parent) && |
158 | - ! $parent->isListOfNonNulls() && $child->isListOfNonNulls(); |
|
158 | + !$parent->isListOfNonNulls() && $child->isListOfNonNulls(); |
|
159 | 159 | |
160 | 160 | if ($invalidWrapperInheritance || $invalidListWrapperInheritance) { |
161 | 161 | $error = '%s precondition of %s can not be strengthened by %s of %s'; |
@@ -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); |
@@ -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 | } |
@@ -55,6 +55,7 @@ |
||
55 | 55 | |
56 | 56 | /** |
57 | 57 | * @param array ...$args |
58 | + * @param \Railt\SDL\Contracts\Definitions\Definition $args |
|
58 | 59 | * @return void |
59 | 60 | * @internal Delegate |
60 | 61 | */ |
@@ -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()); |