@@ -21,8 +21,8 @@ discard block |
||
21 | 21 | class InterfaceValidator 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 | */ |
@@ -53,8 +53,8 @@ discard block |
||
53 | 53 | } |
54 | 54 | |
55 | 55 | /** |
56 | - * @param AllowsTypeIndication|TypeDefinition $child |
|
57 | - * @param AllowsTypeIndication|TypeDefinition $parent |
|
56 | + * @param TypeDefinition $child |
|
57 | + * @param TypeDefinition $parent |
|
58 | 58 | * @return void |
59 | 59 | * @throws TypeConflictException |
60 | 60 | */ |
@@ -63,7 +63,7 @@ |
||
63 | 63 | /** @var ObjectDefinition $object */ |
64 | 64 | $object = $child->getTypeDefinition(); |
65 | 65 | |
66 | - if (! $object->hasInterface($parent->getTypeDefinition()->getName())) { |
|
66 | + if (!$object->hasInterface($parent->getTypeDefinition()->getName())) { |
|
67 | 67 | $error = \vsprintf('%s in %s definition must be instance of %s', [ |
68 | 68 | $object, $child, |
69 | 69 | $parent->getTypeDefinition(), |
@@ -20,8 +20,8 @@ discard block |
||
20 | 20 | class ObjectValidator 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 | */ |
@@ -40,7 +40,7 @@ |
||
40 | 40 | { |
41 | 41 | \assert($parent->getTypeDefinition() instanceof ObjectDefinition); |
42 | 42 | |
43 | - if (! $this->isEqualType($child, $parent)) { |
|
43 | + if (!$this->isEqualType($child, $parent)) { |
|
44 | 44 | $this->throwIncompatibleTypes($child, $parent); |
45 | 45 | } |
46 | 46 | } |
@@ -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'; |
@@ -46,7 +46,7 @@ |
||
46 | 46 | private static $syntaxNonNull = '%s!'; |
47 | 47 | |
48 | 48 | /** |
49 | - * @param AllowsTypeIndication|Definition $type |
|
49 | + * @param Definition $type |
|
50 | 50 | * @return string |
51 | 51 | */ |
52 | 52 | protected function typeToString(Definition $type): string |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | */ |
106 | 106 | protected function valueWithType($value): string |
107 | 107 | { |
108 | - return \mb_strtolower(\gettype($value)) . ' ' . $this->valueToString($value); |
|
108 | + return \mb_strtolower(\gettype($value)).' '.$this->valueToString($value); |
|
109 | 109 | } |
110 | 110 | |
111 | 111 | /** |
@@ -164,6 +164,6 @@ discard block |
||
164 | 164 | return $result; |
165 | 165 | } |
166 | 166 | |
167 | - return (string)$result; |
|
167 | + return (string) $result; |
|
168 | 168 | } |
169 | 169 | } |
@@ -28,7 +28,7 @@ |
||
28 | 28 | */ |
29 | 29 | public function __construct(Definition $definition) |
30 | 30 | { |
31 | - $this->definition = $definition; |
|
31 | + $this->definition = $definition; |
|
32 | 32 | |
33 | 33 | $this->file = $definition->getFileName(); |
34 | 34 | $this->line = $definition->getDeclarationLine(); |
@@ -27,8 +27,8 @@ discard block |
||
27 | 27 | { |
28 | 28 | $this->trace = $trace; |
29 | 29 | |
30 | - $this->file = (string)($trace['file'] ?? 'php://input'); |
|
31 | - $this->line = (int)($trace['line'] ?? 0); |
|
30 | + $this->file = (string) ($trace['file'] ?? 'php://input'); |
|
31 | + $this->line = (int) ($trace['line'] ?? 0); |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | /** |
@@ -54,16 +54,16 @@ discard block |
||
54 | 54 | $result = $trace['function']; |
55 | 55 | |
56 | 56 | if (\array_key_exists('class', $trace)) { |
57 | - $result = $trace['class'] . $trace['type'] . $result; |
|
57 | + $result = $trace['class'].$trace['type'].$result; |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | $arguments = []; |
61 | 61 | |
62 | - foreach ((array)($trace['args'] ?? []) as $argument) { |
|
62 | + foreach ((array) ($trace['args'] ?? []) as $argument) { |
|
63 | 63 | $arguments[] = $this->valueToString($argument); |
64 | 64 | } |
65 | 65 | |
66 | - return $result . '(' . \implode(', ', $arguments) . ')'; |
|
66 | + return $result.'('.\implode(', ', $arguments).')'; |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | /** |
@@ -104,10 +104,10 @@ discard block |
||
104 | 104 | $body = \implode(', ', $parts); |
105 | 105 | |
106 | 106 | if (\is_object($iterator)) { |
107 | - return $this->objectToString($iterator) . '<' . $body . '>'; |
|
107 | + return $this->objectToString($iterator).'<'.$body.'>'; |
|
108 | 108 | } |
109 | 109 | |
110 | - return '[' . $body . ']'; |
|
110 | + return '['.$body.']'; |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | /** |
@@ -50,7 +50,7 @@ |
||
50 | 50 | Compiler::load(File::fromPathname(self::SCHEMA_SDL_GRAMMAR)) |
51 | 51 | ->setClassName('BaseParser') |
52 | 52 | ->setNamespace('Railt\\SDL\\Parser') |
53 | - ->saveTo(__DIR__ . '/../Parser'); |
|
53 | + ->saveTo(__DIR__.'/../Parser'); |
|
54 | 54 | |
55 | 55 | $out->writeln('<info>OK</info>'); |
56 | 56 | } |