@@ -38,17 +38,17 @@ discard block |
||
| 38 | 38 | */ |
| 39 | 39 | public function instantiate(\ReflectionClass $attr, array $arguments, string $context): object |
| 40 | 40 | { |
| 41 | - if ($this->isNamedArgumentsSupported()) { |
|
| 42 | - try { |
|
| 41 | + if ($this->isNamedArgumentsSupported()){ |
|
| 42 | + try{ |
|
| 43 | 43 | return $attr->newInstanceArgs($arguments); |
| 44 | - } catch (\Throwable $e) { |
|
| 44 | + }catch (\Throwable $e){ |
|
| 45 | 45 | throw Exception::withLocation($e, $attr->getFileName(), $attr->getStartLine()); |
| 46 | 46 | } |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | $constructor = $this->getConstructor($attr); |
| 50 | 50 | |
| 51 | - if ($constructor === null) { |
|
| 51 | + if ($constructor === null){ |
|
| 52 | 52 | return $attr->newInstanceWithoutConstructor(); |
| 53 | 53 | } |
| 54 | 54 | |
@@ -76,16 +76,16 @@ discard block |
||
| 76 | 76 | { |
| 77 | 77 | $passed = []; |
| 78 | 78 | |
| 79 | - try { |
|
| 80 | - foreach ($constructor->getParameters() as $parameter) { |
|
| 79 | + try{ |
|
| 80 | + foreach ($constructor->getParameters() as $parameter){ |
|
| 81 | 81 | $passed[] = $this->resolveParameter($ctx, $parameter, $arguments); |
| 82 | 82 | } |
| 83 | 83 | |
| 84 | - if (\count($arguments)) { |
|
| 84 | + if (\count($arguments)){ |
|
| 85 | 85 | $message = \sprintf(self::ERROR_UNKNOWN_ARGUMENT, \array_key_first($arguments)); |
| 86 | 86 | throw new \BadMethodCallException($message); |
| 87 | 87 | } |
| 88 | - } catch (\Throwable $e) { |
|
| 88 | + }catch (\Throwable $e){ |
|
| 89 | 89 | throw Exception::withLocation($e, $constructor->getFileName(), $constructor->getStartLine()); |
| 90 | 90 | } |
| 91 | 91 | |
@@ -101,19 +101,19 @@ discard block |
||
| 101 | 101 | */ |
| 102 | 102 | private function resolveParameter(\ReflectionClass $ctx, \ReflectionParameter $param, array &$arguments) |
| 103 | 103 | { |
| 104 | - switch (true) { |
|
| 104 | + switch (true){ |
|
| 105 | 105 | case \array_key_exists($param->getName(), $arguments): |
| 106 | - try { |
|
| 106 | + try{ |
|
| 107 | 107 | return $arguments[$param->getName()]; |
| 108 | - } finally { |
|
| 108 | + }finally{ |
|
| 109 | 109 | unset($arguments[$param->getName()]); |
| 110 | 110 | } |
| 111 | 111 | // no actual falling through |
| 112 | 112 | |
| 113 | 113 | case \array_key_exists($param->getPosition(), $arguments): |
| 114 | - try { |
|
| 114 | + try{ |
|
| 115 | 115 | return $arguments[$param->getPosition()]; |
| 116 | - } finally { |
|
| 116 | + }finally{ |
|
| 117 | 117 | unset($arguments[$param->getPosition()]); |
| 118 | 118 | } |
| 119 | 119 | // no actual falling through |