@@ -55,9 +55,9 @@ discard block |
||
55 | 55 | * @param mixed $value |
56 | 56 | * @return self |
57 | 57 | */ |
58 | - public function to(string|array|callable $value): Bindings |
|
58 | + public function to(string | array | callable $value): Bindings |
|
59 | 59 | { |
60 | - if(isset($this->bindings[$this->activeKey])) { |
|
60 | + if (isset($this->bindings[$this->activeKey])) { |
|
61 | 61 | $this->bindings[$this->activeKey]['binding'] = $value; |
62 | 62 | } else { |
63 | 63 | $this->bindings[$this->activeKey] = ['binding' => $value, 'calls' => [], 'properties' => []]; |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | public function get(string $key): array |
75 | 75 | { |
76 | 76 | $binding = $this->bindings[$key]; |
77 | - if(!isset($binding['binding'])) { |
|
77 | + if (!isset($binding['binding'])) { |
|
78 | 78 | $binding['binding'] = $key; |
79 | 79 | } |
80 | 80 | return $binding; |
@@ -108,16 +108,16 @@ discard block |
||
108 | 108 | */ |
109 | 109 | private function setArrayBinding(array $binding): void |
110 | 110 | { |
111 | - if(isset($binding[0])) { |
|
111 | + if (isset($binding[0])) { |
|
112 | 112 | $this->to($binding[0]); |
113 | 113 | } |
114 | 114 | |
115 | - if(isset($binding['calls'])){ |
|
116 | - foreach($binding['calls'] as $key => $call) { |
|
117 | - if(is_string($call)) { |
|
115 | + if (isset($binding['calls'])) { |
|
116 | + foreach ($binding['calls'] as $key => $call) { |
|
117 | + if (is_string($call)) { |
|
118 | 118 | $method = $call; |
119 | 119 | $parameters = []; |
120 | - } else if(is_array($call)) { |
|
120 | + } else if (is_array($call)) { |
|
121 | 121 | $method = $key; |
122 | 122 | $parameters = $call; |
123 | 123 | } |
@@ -137,9 +137,9 @@ discard block |
||
137 | 137 | */ |
138 | 138 | public function merge(array $bindings): void |
139 | 139 | { |
140 | - foreach($bindings as $key => $binding) { |
|
140 | + foreach ($bindings as $key => $binding) { |
|
141 | 141 | $this->activeKey = $key; |
142 | - if(is_array($binding)) { |
|
142 | + if (is_array($binding)) { |
|
143 | 143 | $this->setArrayBinding($binding); |
144 | 144 | } else { |
145 | 145 | $this->bindings[$key] = ['binding' => $binding, 'calls' => [], 'properties' => []]; |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | return $this; |
154 | 154 | } |
155 | 155 | |
156 | - public function with(string|array|callable $value): Bindings |
|
156 | + public function with(string | array | callable $value): Bindings |
|
157 | 157 | { |
158 | 158 | return $this->to($value); |
159 | 159 | } |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | $instance = $this->getInstance($resolvedClass['binding']); |
119 | 119 | } |
120 | 120 | |
121 | - foreach($resolvedClass['calls'] ?? [] as $call) { |
|
121 | + foreach ($resolvedClass['calls'] ?? [] as $call) { |
|
122 | 122 | $method = new \ReflectionMethod($instance, $call[0]); |
123 | 123 | $method->invokeArgs($instance, $this->getMethodArguments($method, $call[1])); |
124 | 124 | } |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | } else if ($argumentValue === null) { |
171 | 171 | throw new exceptions\InjectionException("Could not resolve a value for {$argumentName} of type {$className} for {$method->getDeclaringClass()->getName()}{$method->getName()}"); |
172 | 172 | } |
173 | - $argumentValues[]=$argumentValue; |
|
173 | + $argumentValues[] = $argumentValue; |
|
174 | 174 | } else { |
175 | 175 | throw new exceptions\InjectionException("Could not resolve a value for {$argumentName} of type {$type} for {$method->getDeclaringClass()->getName()}{$method->getName()}"); |
176 | 176 | } |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | * @return mixed |
203 | 203 | * @throws exceptions\ResolutionException |
204 | 204 | */ |
205 | - private function getInstance(string|callable $class): mixed |
|
205 | + private function getInstance(string | callable $class): mixed |
|
206 | 206 | { |
207 | 207 | // If the class is a function call it as a factory. |
208 | 208 | if (is_callable($class)) { |