@@ -40,9 +40,9 @@ discard block |
||
40 | 40 | * @param mixed $value |
41 | 41 | * @return self |
42 | 42 | */ |
43 | - public function to(string|array|callable $value): Bindings |
|
43 | + public function to(string | array | callable $value): Bindings |
|
44 | 44 | { |
45 | - if(isset($this->bindings[$this->activeKey])) { |
|
45 | + if (isset($this->bindings[$this->activeKey])) { |
|
46 | 46 | $this->bindings[$this->activeKey]['binding'] = $value; |
47 | 47 | } else { |
48 | 48 | $this->bindings[$this->activeKey] = ['binding' => $value, 'calls' => [], 'properties' => []]; |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | public function get(string $key): array |
60 | 60 | { |
61 | 61 | $binding = $this->bindings[$key]; |
62 | - if(!isset($binding['binding'])) { |
|
62 | + if (!isset($binding['binding'])) { |
|
63 | 63 | $binding['binding'] = $key; |
64 | 64 | } |
65 | 65 | return $binding; |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | */ |
94 | 94 | private function setArrayBinding(array $binding): void |
95 | 95 | { |
96 | - if(isset($binding[0])) { |
|
96 | + if (isset($binding[0])) { |
|
97 | 97 | $this->to($binding[0]); |
98 | 98 | } |
99 | 99 | |
@@ -107,9 +107,9 @@ discard block |
||
107 | 107 | */ |
108 | 108 | public function merge(array $bindings): void |
109 | 109 | { |
110 | - foreach($bindings as $key => $binding) { |
|
110 | + foreach ($bindings as $key => $binding) { |
|
111 | 111 | $this->activeKey = $key; |
112 | - if(is_array($binding)) { |
|
112 | + if (is_array($binding)) { |
|
113 | 113 | $this->setArrayBinding($binding); |
114 | 114 | } else { |
115 | 115 | $this->bindings[$key] = ['binding' => $binding, 'calls' => [], 'properties' => []]; |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | return $this; |
124 | 124 | } |
125 | 125 | |
126 | - public function with(string|array|callable $value): Bindings |
|
126 | + public function with(string | array | callable $value): Bindings |
|
127 | 127 | { |
128 | 128 | return $this->to($value); |
129 | 129 | } |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | } else if ($argumentValue === null) { |
164 | 164 | throw new exceptions\InjectionException("Could not resolve a value for {$argumentName} of {$method->getDeclaringClass()->getName()}{$method->getName()}"); |
165 | 165 | } |
166 | - $argumentValues[]=$argumentValue; |
|
166 | + $argumentValues[] = $argumentValue; |
|
167 | 167 | } else { |
168 | 168 | throw new exceptions\InjectionException("Could not resolve a value for {$argumentName} of {$method->getDeclaringClass()->getName()}{$method->getName()}"); |
169 | 169 | } |
@@ -190,8 +190,8 @@ discard block |
||
190 | 190 | private function injectAttributed(mixed $instance, \ReflectionClass $reflection): void |
191 | 191 | { |
192 | 192 | // Properties |
193 | - foreach($reflection->getProperties() as $property) { |
|
194 | - if (count($property->getAttributes(Inject::class)) == 0 ) { |
|
193 | + foreach ($reflection->getProperties() as $property) { |
|
194 | + if (count($property->getAttributes(Inject::class)) == 0) { |
|
195 | 195 | continue; |
196 | 196 | } |
197 | 197 | $type = $property->getType(); |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | $propertyValue = $this->bindings->has("$$name:$typeName") |
202 | 202 | ? $this->resolve($typeName, $name) |
203 | 203 | : $this->resolve($typeName); |
204 | - if($propertyValue === null) { |
|
204 | + if ($propertyValue === null) { |
|
205 | 205 | throw new exceptions\InjectionException("Failed to resolve a value for property."); |
206 | 206 | } |
207 | 207 | $property->setValue($instance, $propertyValue); |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | } |
212 | 212 | |
213 | 213 | // Methods |
214 | - foreach($reflection->getMethods() as $method) { |
|
214 | + foreach ($reflection->getMethods() as $method) { |
|
215 | 215 | if (count($method->getAttributes(Inject::class)) == 0) { |
216 | 216 | continue; |
217 | 217 | } |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | * @return mixed |
228 | 228 | * @throws exceptions\ResolutionException |
229 | 229 | */ |
230 | - private function getInstance(string|callable $class): mixed |
|
230 | + private function getInstance(string | callable $class): mixed |
|
231 | 231 | { |
232 | 232 | // If the class is a function call it as a factory. |
233 | 233 | if (is_callable($class)) { |