@@ -1,6 +1,6 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -declare(strict_types=1); |
|
| 3 | +declare(strict_types = 1); |
|
| 4 | 4 | |
| 5 | 5 | namespace Stratadox\Di; |
| 6 | 6 | |
@@ -85,16 +85,24 @@ |
||
| 85 | 85 | /** @throws ServiceNotFound */ |
| 86 | 86 | private function mustKnowAbout(string $theService) : void |
| 87 | 87 | { |
| 88 | - if ($this->has($theService)) return; |
|
| 88 | + if ($this->has($theService)) { |
|
| 89 | + return; |
|
| 90 | + } |
|
| 89 | 91 | throw ServiceNotFound::noServiceNamed($theService); |
| 90 | 92 | } |
| 91 | 93 | |
| 92 | 94 | /** @throws InvalidServiceDefinition */ |
| 93 | 95 | private function typeMustCheckOut(string $serviceName, $service, string $requiredType) : void |
| 94 | 96 | { |
| 95 | - if (empty($requiredType)) return; |
|
| 96 | - if (gettype($service) === $requiredType) return; |
|
| 97 | - if ($service instanceof $requiredType) return; |
|
| 97 | + if (empty($requiredType)) { |
|
| 98 | + return; |
|
| 99 | + } |
|
| 100 | + if (gettype($service) === $requiredType) { |
|
| 101 | + return; |
|
| 102 | + } |
|
| 103 | + if ($service instanceof $requiredType) { |
|
| 104 | + return; |
|
| 105 | + } |
|
| 98 | 106 | throw InvalidServiceType::serviceIsNotOfType($serviceName, $requiredType); |
| 99 | 107 | } |
| 100 | 108 | } |
@@ -1,6 +1,6 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -declare(strict_types=1); |
|
| 3 | +declare(strict_types = 1); |
|
| 4 | 4 | |
| 5 | 5 | namespace Stratadox\Di\Exception; |
| 6 | 6 | |
@@ -1,6 +1,6 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -declare(strict_types=1); |
|
| 3 | +declare(strict_types = 1); |
|
| 4 | 4 | |
| 5 | 5 | namespace Stratadox\Di; |
| 6 | 6 | |
@@ -1,6 +1,6 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -declare(strict_types=1); |
|
| 3 | +declare(strict_types = 1); |
|
| 4 | 4 | |
| 5 | 5 | namespace Stratadox\Di; |
| 6 | 6 | |
@@ -1,6 +1,6 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -declare(strict_types=1); |
|
| 3 | +declare(strict_types = 1); |
|
| 4 | 4 | |
| 5 | 5 | namespace Stratadox\Di\Exception; |
| 6 | 6 | |
@@ -1,6 +1,6 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -declare(strict_types=1); |
|
| 3 | +declare(strict_types = 1); |
|
| 4 | 4 | |
| 5 | 5 | namespace Stratadox\Di\Exception; |
| 6 | 6 | |
@@ -1,6 +1,6 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -declare(strict_types=1); |
|
| 3 | +declare(strict_types = 1); |
|
| 4 | 4 | |
| 5 | 5 | namespace Stratadox\Di\Exception; |
| 6 | 6 | |
@@ -1,6 +1,6 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -declare(strict_types=1); |
|
| 3 | +declare(strict_types = 1); |
|
| 4 | 4 | |
| 5 | 5 | namespace Stratadox\Di\Exception; |
| 6 | 6 | |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -declare(strict_types=1); |
|
| 3 | +declare(strict_types = 1); |
|
| 4 | 4 | |
| 5 | 5 | namespace Stratadox\Di; |
| 6 | 6 | |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | { |
| 54 | 54 | $class = $this->links[$service]; |
| 55 | 55 | $this->resolveClass($class); |
| 56 | - $this->container->set($service, function () use ($class) { |
|
| 56 | + $this->container->set($service, function() use ($class) { |
|
| 57 | 57 | return $this->container->get($class); |
| 58 | 58 | }); |
| 59 | 59 | } |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | } |
| 71 | 71 | } |
| 72 | 72 | $this->container->set($service, |
| 73 | - function () use ($service, $dependencies) { |
|
| 73 | + function() use ($service, $dependencies) { |
|
| 74 | 74 | $parameters = []; |
| 75 | 75 | foreach ($dependencies as $dependency) { |
| 76 | 76 | $parameters[] = $this->container->get($dependency); |