@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | */ |
27 | 27 | public function match($container, $item): bool |
28 | 28 | { |
29 | - return ! \is_iterable($container) && $item instanceof TypeDefinition; |
|
29 | + return !\is_iterable($container) && $item instanceof TypeDefinition; |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | /** |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | { |
40 | 40 | \assert($container instanceof TypeDefinition || $container === null); |
41 | 41 | |
42 | - if (! $this->isEmpty($container) && ! $this->isSameType($container, $definition)) { |
|
42 | + if (!$this->isEmpty($container) && !$this->isSameType($container, $definition)) { |
|
43 | 43 | $error = \sprintf(static::REDEFINITION_ERROR, $definition); |
44 | 44 | throw new TypeConflictException($error, $this->getCallStack()); |
45 | 45 | } |
@@ -31,7 +31,7 @@ |
||
31 | 31 | */ |
32 | 32 | protected function getDefaultMatcher(): \Closure |
33 | 33 | { |
34 | - return function (Uniqueness\UniquenessValidator $validator, $container, $item): bool { |
|
34 | + return function(Uniqueness\UniquenessValidator $validator, $container, $item): bool { |
|
35 | 35 | return $validator->match($container, $item); |
36 | 36 | }; |
37 | 37 | } |
@@ -98,7 +98,7 @@ |
||
98 | 98 | */ |
99 | 99 | public function add(string $factory, string $group = null): Factory |
100 | 100 | { |
101 | - if (! \is_subclass_of($factory, Factory::class)) { |
|
101 | + if (!\is_subclass_of($factory, Factory::class)) { |
|
102 | 102 | $error = \sprintf('%s must be instance of %s', $factory, Factory::class); |
103 | 103 | throw new \InvalidArgumentException($error); |
104 | 104 | } |
@@ -45,7 +45,7 @@ |
||
45 | 45 | */ |
46 | 46 | protected function getDefaultMatcher(): \Closure |
47 | 47 | { |
48 | - return function (Inheritance\InheritanceValidator $validator, TypeDefinition $a, TypeDefinition $b): bool { |
|
48 | + return function(Inheritance\InheritanceValidator $validator, TypeDefinition $a, TypeDefinition $b): bool { |
|
49 | 49 | return $validator->match($a, $b); |
50 | 50 | }; |
51 | 51 | } |
@@ -35,7 +35,7 @@ |
||
35 | 35 | */ |
36 | 36 | protected function getDefaultMatcher(): \Closure |
37 | 37 | { |
38 | - return function (Definitions\DefinitionValidator $validator, Definition $definition): bool { |
|
38 | + return function(Definitions\DefinitionValidator $validator, Definition $definition): bool { |
|
39 | 39 | return $validator->match($definition); |
40 | 40 | }; |
41 | 41 | } |
@@ -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? |
@@ -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 { |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | */ |
72 | 72 | public function getNumberOfRequiredArguments(): int |
73 | 73 | { |
74 | - return (int)\array_reduce($this->arguments, [$this, 'requiredArgumentsCounter'], 0); |
|
74 | + return (int) \array_reduce($this->arguments, [$this, 'requiredArgumentsCounter'], 0); |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | /** |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | */ |
80 | 80 | public function getNumberOfOptionalArguments(): int |
81 | 81 | { |
82 | - return (int)\array_reduce($this->arguments, [$this, 'optionalArgumentsCounter'], 0); |
|
82 | + return (int) \array_reduce($this->arguments, [$this, 'optionalArgumentsCounter'], 0); |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | /** |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | */ |
90 | 90 | private function optionalArgumentsCounter(int $carry, ArgumentDefinition $argument): int |
91 | 91 | { |
92 | - return $carry + (int)$argument->hasDefaultValue(); |
|
92 | + return $carry + (int) $argument->hasDefaultValue(); |
|
93 | 93 | } |
94 | 94 | |
95 | 95 | /** |
@@ -99,6 +99,6 @@ discard block |
||
99 | 99 | */ |
100 | 100 | private function requiredArgumentsCounter(int $carry, ArgumentDefinition $argument): int |
101 | 101 | { |
102 | - return $carry + (int)! $argument->hasDefaultValue(); |
|
102 | + return $carry + (int) !$argument->hasDefaultValue(); |
|
103 | 103 | } |
104 | 104 | } |
@@ -31,7 +31,7 @@ |
||
31 | 31 | */ |
32 | 32 | public function getValue(): string |
33 | 33 | { |
34 | - return (string)$this->name; |
|
34 | + return (string) $this->name; |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | /** |