@@ -243,7 +243,7 @@ |
||
| 243 | 243 | } |
| 244 | 244 | |
| 245 | 245 | //variadic functions will only have one argument. To account for those, append any remaining arguments to the list |
| 246 | - return array_merge($parameters, $args); |
|
| 246 | + return array_merge($parameters, $args); |
|
| 247 | 247 | }; |
| 248 | 248 | } |
| 249 | 249 | |
@@ -15,9 +15,9 @@ discard block |
||
| 15 | 15 | |
| 16 | 16 | class Dice |
| 17 | 17 | { |
| 18 | - private $rules = []; // Rules which have been set using addRule() |
|
| 19 | - private $cache = []; // A cache of closures based on class name so each class is only reflected once |
|
| 20 | - private $instances = []; // Stores any instances marked as 'shared' so create() can return the same instance |
|
| 18 | + private $rules = []; // Rules which have been set using addRule() |
|
| 19 | + private $cache = []; // A cache of closures based on class name so each class is only reflected once |
|
| 20 | + private $instances = []; // Stores any instances marked as 'shared' so create() can return the same instance |
|
| 21 | 21 | |
| 22 | 22 | /** |
| 23 | 23 | * Constructor which allows setting a default ruleset to apply to all objects. |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | |
| 98 | 98 | //If there are shared instances, create them and merge them with shared instances higher up the object graph |
| 99 | 99 | if (isset($rule['shareInstances'])) { |
| 100 | - $closure = function(array $args, array $share) use ($closure, $rule) { |
|
| 100 | + $closure = function (array $args, array $share) use ($closure, $rule) { |
|
| 101 | 101 | return $closure($args, array_merge($args, $share, array_map([$this, 'create'], $rule['shareInstances']))); |
| 102 | 102 | }; |
| 103 | 103 | } |
@@ -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())) |
@@ -25,7 +25,7 @@ |
||
| 25 | 25 | |
| 26 | 26 | $map = json_decode($json, true); |
| 27 | 27 | if (!is_array($map)) { |
| 28 | - throw new \Exception('Could not decode json: ' . json_last_error_msg()); |
|
| 28 | + throw new \Exception('Could not decode json: '.json_last_error_msg()); |
|
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | if (isset($map['rules'])) { |