We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 8d6d00d + 230b32c commit d93f4e8Copy full SHA for d93f4e8
More/ServiceLocator/ServiceLocator.php
@@ -40,24 +40,7 @@ public function get(string $class): Service
40
return $this->instantiated[$class];
41
}
42
43
- $args = $this->services[$class];
44
-
45
- switch (count($args)) {
46
- case 0:
47
- $object = new $class();
48
- break;
49
- case 1:
50
- $object = new $class($args[0]);
51
52
- case 2:
53
- $object = new $class($args[0], $args[1]);
54
55
- case 3:
56
- $object = new $class($args[0], $args[1], $args[2]);
57
58
- default:
59
- throw new OutOfRangeException('Too many arguments given');
60
- }
+ $object = new $class(...$this->services[$class]);
61
62
if (!$object instanceof Service) {
63
throw new InvalidArgumentException('Could not register service: is no instance of Service');
0 commit comments