@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | * |
213 | 213 | * @param string $nid The normalized ID of the container item. |
214 | 214 | * @param array $rule The resolved rule for the ID. |
215 | - * @return callable Returns a function that when called will create a new instance of the class. |
|
215 | + * @return \Closure Returns a function that when called will create a new instance of the class. |
|
216 | 216 | * @throws NotFoundException No entry was found for this identifier. |
217 | 217 | */ |
218 | 218 | private function makeFactory($nid, array $rule) { |
@@ -356,7 +356,7 @@ discard block |
||
356 | 356 | * @param array $defaultArgs The default arguments from {@link Container::makeDefaultArgs()}. |
357 | 357 | * @param array $args The arguments passed into a creation. |
358 | 358 | * @param mixed $instance An object instance if the arguments are being resolved on an already constructed object. |
359 | - * @return array Returns an array suitable to be applied to a function call. |
|
359 | + * @return null|callable Returns an array suitable to be applied to a function call. |
|
360 | 360 | */ |
361 | 361 | private function resolveArgs(array $defaultArgs, array $args, $instance = null) { |
362 | 362 | $args = array_change_key_case($args); |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | */ |
24 | 24 | public function __construct() { |
25 | 25 | $this->rules = ['*' => ['inherit' => true, 'constructorArgs' => []]]; |
26 | - $this->currentRule =& $this->rules['*']; |
|
26 | + $this->currentRule = & $this->rules['*']; |
|
27 | 27 | $this->instances = []; |
28 | 28 | $this->factories = []; |
29 | 29 | } |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | * @return $this |
45 | 45 | */ |
46 | 46 | public function defaultRule() { |
47 | - $this->currentRule =& $this->rules['*']; |
|
47 | + $this->currentRule = & $this->rules['*']; |
|
48 | 48 | return $this; |
49 | 49 | } |
50 | 50 | |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | if (!isset($this->rules[$id])) { |
61 | 61 | $this->rules[$id] = []; |
62 | 62 | } |
63 | - $this->currentRule =& $this->rules[$id]; |
|
63 | + $this->currentRule = & $this->rules[$id]; |
|
64 | 64 | return $this; |
65 | 65 | } |
66 | 66 | |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | $interfaces = class_implements($nid); |
192 | 192 | foreach ($interfaces as $interface) { |
193 | 193 | if (!empty($this->rules[$interface]['calls']) |
194 | - && (!isset($this->rules[$interface]['inherit'])|| $this->rules[$interface]['inherit'] !== false)) { |
|
194 | + && (!isset($this->rules[$interface]['inherit']) || $this->rules[$interface]['inherit'] !== false)) { |
|
195 | 195 | |
196 | 196 | $rule['calls'] = array_merge( |
197 | 197 | isset($rule['calls']) ? $rule['calls'] : [], |
@@ -226,11 +226,11 @@ discard block |
||
226 | 226 | if ($constructor && $constructor->getNumberOfParameters() > 0) { |
227 | 227 | $constructorArgs = $this->makeDefaultArgs($constructor, $rule['constructorArgs'], $rule); |
228 | 228 | |
229 | - $factory = function ($args) use ($class, $constructorArgs) { |
|
229 | + $factory = function($args) use ($class, $constructorArgs) { |
|
230 | 230 | return $class->newInstanceArgs($this->resolveArgs($constructorArgs, $args)); |
231 | 231 | }; |
232 | 232 | } else { |
233 | - $factory = function () use ($className) { |
|
233 | + $factory = function() use ($className) { |
|
234 | 234 | return new $className; |
235 | 235 | }; |
236 | 236 | } |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | } |
248 | 248 | |
249 | 249 | // Wrap the factory in one that makes the calls. |
250 | - $factory = function ($args) use ($factory, $calls) { |
|
250 | + $factory = function($args) use ($factory, $calls) { |
|
251 | 251 | $instance = $factory($args); |
252 | 252 | |
253 | 253 | foreach ($calls as $call) { |
@@ -27,6 +27,9 @@ |
||
27 | 27 | return $this->name; |
28 | 28 | } |
29 | 29 | |
30 | + /** |
|
31 | + * @param string $name |
|
32 | + */ |
|
30 | 33 | public function setName($name) { |
31 | 34 | $this->name = $name; |
32 | 35 | } |