@@ -212,7 +212,8 @@ |
||
| 212 | 212 | list($class, $param, $sub) = $pi; |
| 213 | 213 | |
| 214 | 214 | // First, loop through $args and see if each value can match the current parameter based on type hint |
| 215 | - if (!empty($args)) { // This if statement actually gives a ~10% speed increase when $args isn't set |
|
| 215 | + if (!empty($args)) { |
|
| 216 | +// This if statement actually gives a ~10% speed increase when $args isn't set |
|
| 216 | 217 | foreach ($args as $i => $arg) { |
| 217 | 218 | if ($class !== null |
| 218 | 219 | && ($arg instanceof $class || ($arg === null && $param->allowsNull())) |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | // When $rule['call'] is set, wrap the closure in another closure which calls the required methods after constructing the object. |
| 106 | 106 | // By putting this in a closure, the loop is never executed unless call is actually set. |
| 107 | 107 | if (isset($rule['call'])) { |
| 108 | - $closure = function (array $args, array $share) use ($closure, $class, $rule) { |
|
| 108 | + $closure = function(array $args, array $share) use ($closure, $class, $rule) { |
|
| 109 | 109 | // Construct the object using the original closure |
| 110 | 110 | $object = $closure($args, $share); |
| 111 | 111 | |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | |
| 143 | 143 | // Get a closure based on the type of object being created: shared, normal, or constructorless |
| 144 | 144 | if (isset($rule['shared']) && $rule['shared'] === true) { |
| 145 | - return function (array $args, array $share) use ($name, $class, $constructor, $params) { |
|
| 145 | + return function(array $args, array $share) use ($name, $class, $constructor, $params) { |
|
| 146 | 146 | if ($constructor) { |
| 147 | 147 | try { |
| 148 | 148 | // Shared instance: create without calling constructor (and write to \$name and $name, see issue #68) |
@@ -164,12 +164,12 @@ discard block |
||
| 164 | 164 | |
| 165 | 165 | if ($params) { |
| 166 | 166 | // This class has depenencies, call the $params closure to generate them based on $args and $share |
| 167 | - return function (array $args, array $share) use ($class, $params) { |
|
| 167 | + return function(array $args, array $share) use ($class, $params) { |
|
| 168 | 168 | return $class->newInstanceArgs($params($args, $share)); |
| 169 | 169 | }; |
| 170 | 170 | } |
| 171 | 171 | |
| 172 | - return function () use ($class) { |
|
| 172 | + return function() use ($class) { |
|
| 173 | 173 | // No constructor arguments, just instantiate the class |
| 174 | 174 | return new $class->name(); |
| 175 | 175 | }; |
@@ -194,7 +194,7 @@ discard block |
||
| 194 | 194 | } |
| 195 | 195 | |
| 196 | 196 | // Return a closure that uses the cached information to generate the arguments for the method |
| 197 | - return function (array $args, array $share = []) use ($paramInfo, $rule) { |
|
| 197 | + return function(array $args, array $share = []) use ($paramInfo, $rule) { |
|
| 198 | 198 | // Now merge all the possible parameters: user-defined in the rule via constructParams, |
| 199 | 199 | // shared instances, and the $args argument from $dice->create() |
| 200 | 200 | if (!empty($share) || isset($rule['constructParams'])) { |