@@ -82,16 +82,24 @@ |
||
| 82 | 82 | /** @throws ServiceNotFound */ |
| 83 | 83 | private function mustKnowAbout(string $theService) |
| 84 | 84 | { |
| 85 | - if ($this->has($theService)) return; |
|
| 85 | + if ($this->has($theService)) { |
|
| 86 | + return; |
|
| 87 | + } |
|
| 86 | 88 | throw ServiceNotFound::noServiceNamed($theService); |
| 87 | 89 | } |
| 88 | 90 | |
| 89 | 91 | /** @throws InvalidServiceDefinition */ |
| 90 | 92 | private function typeMustCheckOut(string $serviceName, $service, string $requiredType) |
| 91 | 93 | { |
| 92 | - if (empty($requiredType)) return; |
|
| 93 | - if (gettype($service) === $requiredType) return; |
|
| 94 | - if ($service instanceof $requiredType) return; |
|
| 94 | + if (empty($requiredType)) { |
|
| 95 | + return; |
|
| 96 | + } |
|
| 97 | + if (gettype($service) === $requiredType) { |
|
| 98 | + return; |
|
| 99 | + } |
|
| 100 | + if ($service instanceof $requiredType) { |
|
| 101 | + return; |
|
| 102 | + } |
|
| 95 | 103 | throw InvalidServiceType::serviceIsNotOfType($serviceName, $requiredType); |
| 96 | 104 | } |
| 97 | 105 | } |