@@ -16,10 +16,10 @@ |
||
| 16 | 16 | public function __construct( |
| 17 | 17 | protected \ReflectionParameter $parameter, |
| 18 | 18 | protected \ReflectionFunctionAbstract $context |
| 19 | - ) { |
|
| 19 | + ){ |
|
| 20 | 20 | $name = $context->getName(); |
| 21 | - if ($context instanceof \ReflectionMethod) { |
|
| 22 | - $name = $context->class . '::' . $name; |
|
| 21 | + if ($context instanceof \ReflectionMethod){ |
|
| 22 | + $name = $context->class.'::'.$name; |
|
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | parent::__construct(\sprintf("Unable to resolve '%s' argument in '%s'", $parameter->name, $name)); |
@@ -18,7 +18,8 @@ |
||
| 18 | 18 | protected \ReflectionFunctionAbstract $context |
| 19 | 19 | ) { |
| 20 | 20 | $name = $context->getName(); |
| 21 | - if ($context instanceof \ReflectionMethod) { |
|
| 21 | + if ($context instanceof \ReflectionMethod) |
|
| 22 | + { |
|
| 22 | 23 | $name = $context->class . '::' . $name; |
| 23 | 24 | } |
| 24 | 25 | |
@@ -13,7 +13,7 @@ |
||
| 13 | 13 | public function __construct( |
| 14 | 14 | \ReflectionFunctionAbstract $reflection, |
| 15 | 15 | private readonly string $parameter |
| 16 | - ) { |
|
| 16 | + ){ |
|
| 17 | 17 | $pattern = "Unknown named parameter `{$parameter}` `%s` %s."; |
| 18 | 18 | parent::__construct($this->renderFunctionAndParameter($reflection, $pattern)); |
| 19 | 19 | } |
@@ -13,7 +13,7 @@ |
||
| 13 | 13 | public function __construct( |
| 14 | 14 | \ReflectionFunctionAbstract $reflection, |
| 15 | 15 | private readonly string $parameter |
| 16 | - ) { |
|
| 16 | + ){ |
|
| 17 | 17 | $pattern = "Unable to resolve required argument `{$parameter}` when resolving `%s` %s."; |
| 18 | 18 | parent::__construct($this->renderFunctionAndParameter($reflection, $pattern)); |
| 19 | 19 | } |
@@ -13,13 +13,13 @@ |
||
| 13 | 13 | public function __construct( |
| 14 | 14 | \ReflectionFunctionAbstract $reflection, |
| 15 | 15 | private readonly int $position |
| 16 | - ) { |
|
| 16 | + ){ |
|
| 17 | 17 | $pattern = 'Cannot use positional argument after named argument `%s` %s.'; |
| 18 | 18 | parent::__construct($this->renderFunctionAndParameter($reflection, $pattern)); |
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | public function getParameter(): string |
| 22 | 22 | { |
| 23 | - return '#' . $this->position; |
|
| 23 | + return '#'.$this->position; |
|
| 24 | 24 | } |
| 25 | 25 | } |
@@ -12,7 +12,7 @@ |
||
| 12 | 12 | { |
| 13 | 13 | $message = 'An argument resolved with wrong type: '; |
| 14 | 14 | parent::__construct( |
| 15 | - $message . $error->getMessage(), |
|
| 15 | + $message.$error->getMessage(), |
|
| 16 | 16 | $error->getCode(), |
| 17 | 17 | $error |
| 18 | 18 | ); |
@@ -13,7 +13,7 @@ |
||
| 13 | 13 | public function __construct( |
| 14 | 14 | \ReflectionFunctionAbstract $reflection, |
| 15 | 15 | private readonly string $parameter |
| 16 | - ) { |
|
| 16 | + ){ |
|
| 17 | 17 | $pattern = "Missing required argument for the `{$parameter}` parameter for `%s` %s."; |
| 18 | 18 | parent::__construct($this->renderFunctionAndParameter($reflection, $pattern)); |
| 19 | 19 | } |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | $line = $reflection->getStartLine(); |
| 32 | 32 | |
| 33 | 33 | $fileAndLine = ''; |
| 34 | - if (!empty($fileName)) { |
|
| 34 | + if (!empty($fileName)){ |
|
| 35 | 35 | $fileAndLine = "in \"$fileName\" at line $line"; |
| 36 | 36 | } |
| 37 | 37 | |
@@ -42,23 +42,23 @@ discard block |
||
| 42 | 42 | { |
| 43 | 43 | $closureParameters = []; |
| 44 | 44 | |
| 45 | - foreach ($reflection->getParameters() as $parameter) { |
|
| 45 | + foreach ($reflection->getParameters() as $parameter){ |
|
| 46 | 46 | /** @var ReflectionNamedType|ReflectionUnionType|null $type */ |
| 47 | 47 | $type = $parameter->getType(); |
| 48 | 48 | $parameterString = \sprintf( |
| 49 | 49 | '%s %s%s$%s', |
| 50 | 50 | // type |
| 51 | - (string) $type, |
|
| 51 | + (string)$type, |
|
| 52 | 52 | // reference |
| 53 | 53 | $parameter->isPassedByReference() ? '&' : '', |
| 54 | 54 | // variadic |
| 55 | 55 | $parameter->isVariadic() ? '...' : '', |
| 56 | 56 | $parameter->getName(), |
| 57 | 57 | ); |
| 58 | - if ($parameter->isDefaultValueAvailable()) { |
|
| 58 | + if ($parameter->isDefaultValueAvailable()){ |
|
| 59 | 59 | $default = $parameter->getDefaultValue(); |
| 60 | - $parameterString .= ' = ' . match (true) { |
|
| 61 | - \is_object($default) => 'new ' . $default::class . '(...)', |
|
| 60 | + $parameterString .= ' = '.match (true) { |
|
| 61 | + \is_object($default) => 'new '.$default::class.'(...)', |
|
| 62 | 62 | $parameter->isDefaultValueConstant() => $parameter->getDefaultValueConstantName(), |
| 63 | 63 | default => \var_export($default, true), |
| 64 | 64 | }; |
@@ -66,6 +66,6 @@ discard block |
||
| 66 | 66 | $closureParameters[] = \ltrim($parameterString); |
| 67 | 67 | } |
| 68 | 68 | $static = $reflection->isStatic() ? 'static ' : ''; |
| 69 | - return "{$static}function (" . \implode(', ', $closureParameters) . ')'; |
|
| 69 | + return "{$static}function (".\implode(', ', $closureParameters).')'; |
|
| 70 | 70 | } |
| 71 | 71 | } |
@@ -31,7 +31,8 @@ discard block |
||
| 31 | 31 | $line = $reflection->getStartLine(); |
| 32 | 32 | |
| 33 | 33 | $fileAndLine = ''; |
| 34 | - if (!empty($fileName)) { |
|
| 34 | + if (!empty($fileName)) |
|
| 35 | + { |
|
| 35 | 36 | $fileAndLine = "in \"$fileName\" at line $line"; |
| 36 | 37 | } |
| 37 | 38 | |
@@ -42,7 +43,8 @@ discard block |
||
| 42 | 43 | { |
| 43 | 44 | $closureParameters = []; |
| 44 | 45 | |
| 45 | - foreach ($reflection->getParameters() as $parameter) { |
|
| 46 | + foreach ($reflection->getParameters() as $parameter) |
|
| 47 | + { |
|
| 46 | 48 | /** @var ReflectionNamedType|ReflectionUnionType|null $type */ |
| 47 | 49 | $type = $parameter->getType(); |
| 48 | 50 | $parameterString = \sprintf( |
@@ -55,7 +57,8 @@ discard block |
||
| 55 | 57 | $parameter->isVariadic() ? '...' : '', |
| 56 | 58 | $parameter->getName(), |
| 57 | 59 | ); |
| 58 | - if ($parameter->isDefaultValueAvailable()) { |
|
| 60 | + if ($parameter->isDefaultValueAvailable()) |
|
| 61 | + { |
|
| 59 | 62 | $default = $parameter->getDefaultValue(); |
| 60 | 63 | $parameterString .= ' = ' . match (true) { |
| 61 | 64 | \is_object($default) => 'new ' . $default::class . '(...)', |
@@ -16,8 +16,8 @@ |
||
| 16 | 16 | public function resolveAlias(string $alias): string |
| 17 | 17 | { |
| 18 | 18 | $antiCircleReference = []; |
| 19 | - while (isset($this->config, $this->config['aliases'][$alias]) && \is_string($alias)) { |
|
| 20 | - if (\in_array($alias, $antiCircleReference, true)) { |
|
| 19 | + while (isset($this->config, $this->config['aliases'][$alias]) && \is_string($alias)){ |
|
| 20 | + if (\in_array($alias, $antiCircleReference, true)){ |
|
| 21 | 21 | throw new ContainerException(\sprintf('Circle reference detected for alias `%s`.', $alias)); |
| 22 | 22 | } |
| 23 | 23 | $antiCircleReference[] = $alias; |
@@ -16,8 +16,10 @@ |
||
| 16 | 16 | public function resolveAlias(string $alias): string |
| 17 | 17 | { |
| 18 | 18 | $antiCircleReference = []; |
| 19 | - while (isset($this->config, $this->config['aliases'][$alias]) && \is_string($alias)) { |
|
| 20 | - if (\in_array($alias, $antiCircleReference, true)) { |
|
| 19 | + while (isset($this->config, $this->config['aliases'][$alias]) && \is_string($alias)) |
|
| 20 | + { |
|
| 21 | + if (\in_array($alias, $antiCircleReference, true)) |
|
| 22 | + { |
|
| 21 | 23 | throw new ContainerException(\sprintf('Circle reference detected for alias `%s`.', $alias)); |
| 22 | 24 | } |
| 23 | 25 | $antiCircleReference[] = $alias; |
@@ -23,5 +23,5 @@ |
||
| 23 | 23 | * |
| 24 | 24 | * @throws NotCallableException |
| 25 | 25 | */ |
| 26 | - public function invoke(array|callable|string $target, array $parameters = []): mixed; |
|
| 26 | + public function invoke(array | callable | string $target, array $parameters = []): mixed; |
|
| 27 | 27 | } |