@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | */ |
38 | 38 | public static function getInstance() |
39 | 39 | { |
40 | - if( is_null( static::$instance )) { |
|
40 | + if( is_null( static::$instance ) ) { |
|
41 | 41 | static::$instance = new static; |
42 | 42 | } |
43 | 43 | |
@@ -68,14 +68,14 @@ discard block |
||
68 | 68 | */ |
69 | 69 | public function make( $abstract ) |
70 | 70 | { |
71 | - $service = isset( $this->services[$abstract] ) |
|
71 | + $service = isset($this->services[$abstract]) |
|
72 | 72 | ? $this->services[$abstract] |
73 | 73 | : $this->addNamespace( $abstract ); |
74 | 74 | |
75 | - if( is_callable( $service )) { |
|
75 | + if( is_callable( $service ) ) { |
|
76 | 76 | return call_user_func_array( $service, [$this] ); |
77 | 77 | } |
78 | - if( is_object( $service )) { |
|
78 | + if( is_object( $service ) ) { |
|
79 | 79 | return $service; |
80 | 80 | } |
81 | 81 | |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | */ |
93 | 93 | public function singleton( $abstract, $concrete ) |
94 | 94 | { |
95 | - $this->bind( $abstract, $this->make( $concrete )); |
|
95 | + $this->bind( $abstract, $this->make( $concrete ) ); |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | /** |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | */ |
105 | 105 | public function __get( $item ) |
106 | 106 | { |
107 | - return isset( $this->bucket[$item] ) |
|
107 | + return isset($this->bucket[$item]) |
|
108 | 108 | ? $this->bucket[$item] |
109 | 109 | : null; |
110 | 110 | } |
@@ -141,8 +141,8 @@ discard block |
||
141 | 141 | */ |
142 | 142 | protected function addNamespace( $abstract ) |
143 | 143 | { |
144 | - if( strpos( $abstract, __NAMESPACE__ ) === false && !class_exists( $abstract )) { |
|
145 | - $abstract = __NAMESPACE__ . "\\$abstract"; |
|
144 | + if( strpos( $abstract, __NAMESPACE__ ) === false && !class_exists( $abstract ) ) { |
|
145 | + $abstract = __NAMESPACE__."\\$abstract"; |
|
146 | 146 | } |
147 | 147 | |
148 | 148 | return $abstract; |
@@ -152,9 +152,9 @@ discard block |
||
152 | 152 | * @param \ReflectionParameter $parameter |
153 | 153 | * @return null|\ReflectionClass|\ReflectionNamedType|\ReflectionType |
154 | 154 | */ |
155 | - protected function getClass($parameter) |
|
155 | + protected function getClass( $parameter ) |
|
156 | 156 | { |
157 | - if (version_compare(phpversion(), '8', '<')) { |
|
157 | + if( version_compare( phpversion(), '8', '<' ) ) { |
|
158 | 158 | return $parameter->getClass(); // @compat PHP < 8 |
159 | 159 | } |
160 | 160 | return $parameter->getType(); |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | return $this->notInstantiable( $concrete ); |
196 | 196 | } |
197 | 197 | |
198 | - if( is_null(( $constructor = $reflector->getConstructor() ))) { |
|
198 | + if( is_null( ($constructor = $reflector->getConstructor()) ) ) { |
|
199 | 199 | return new $concrete; |
200 | 200 | } |
201 | 201 | |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | protected function resolveClass( ReflectionParameter $parameter ) |
214 | 214 | { |
215 | 215 | try { |
216 | - return $this->make( $this->getClass($parameter)->getName() ); |
|
216 | + return $this->make( $this->getClass( $parameter )->getName() ); |
|
217 | 217 | } |
218 | 218 | catch( Exception $e ) { |
219 | 219 | if( $parameter->isOptional() ) { |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | |
235 | 235 | foreach( $dependencies as $dependency ) { |
236 | 236 | // If the class is null, the dependency is a string or some other primitive type |
237 | - $results[] = !is_null( $class = $this->getClass($dependency) ) |
|
237 | + $results[] = !is_null( $class = $this->getClass( $dependency ) ) |
|
238 | 238 | ? $this->resolveClass( $dependency ) |
239 | 239 | : null; |
240 | 240 | } |