@@ -17,9 +17,9 @@ |
||
| 17 | 17 | * @param non-empty-string $name |
| 18 | 18 | * @param non-empty-string|\Stringable $pattern |
| 19 | 19 | */ |
| 20 | - public function register(string $name, string|\Stringable $pattern): void |
|
| 20 | + public function register(string $name, string | \Stringable $pattern): void |
|
| 21 | 21 | { |
| 22 | - $pattern = (string) $pattern; |
|
| 22 | + $pattern = (string)$pattern; |
|
| 23 | 23 | \assert($pattern !== ''); |
| 24 | 24 | $this->patterns[$name] = $pattern; |
| 25 | 25 | } |
@@ -44,7 +44,8 @@ |
||
| 44 | 44 | */ |
| 45 | 45 | protected function resolveController(array $matches): string |
| 46 | 46 | { |
| 47 | - if (\preg_match('/[^a-z_0-9\-]/i', $matches['controller'])) { |
|
| 47 | + if (\preg_match('/[^a-z_0-9\-]/i', $matches['controller'])) |
|
| 48 | + { |
|
| 48 | 49 | throw new TargetException('Invalid namespace target, controller name not allowed.'); |
| 49 | 50 | } |
| 50 | 51 | |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | string $namespace, |
| 27 | 27 | string $postfix = 'Controller', |
| 28 | 28 | int $options = 0, |
| 29 | - ) { |
|
| 29 | + ){ |
|
| 30 | 30 | $this->namespace = \rtrim($namespace, '\\'); |
| 31 | 31 | $this->postfix = \ucfirst($postfix); |
| 32 | 32 | |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | */ |
| 45 | 45 | protected function resolveController(array $matches): string |
| 46 | 46 | { |
| 47 | - if (\preg_match('/[^a-z_0-9\-]/i', $matches['controller'])) { |
|
| 47 | + if (\preg_match('/[^a-z_0-9\-]/i', $matches['controller'])){ |
|
| 48 | 48 | throw new TargetException('Invalid namespace target, controller name not allowed.'); |
| 49 | 49 | } |
| 50 | 50 | |
@@ -29,11 +29,11 @@ |
||
| 29 | 29 | return $id; |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | - public function defaultInt(string|int $id = 1): string |
|
| 32 | + public function defaultInt(string | int $id = 1): string |
|
| 33 | 33 | { |
| 34 | 34 | $result = \is_int($id) ? 'int: ' : 'string: '; |
| 35 | 35 | |
| 36 | - return $result . $id; |
|
| 36 | + return $result.$id; |
|
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | public function echo(): void |
@@ -18,7 +18,7 @@ |
||
| 18 | 18 | */ |
| 19 | 19 | public function __construct( |
| 20 | 20 | public readonly \Closure $inflector, |
| 21 | - ) { |
|
| 21 | + ){ |
|
| 22 | 22 | $this->parametersCount = (new \ReflectionFunction($inflector))->getNumberOfParameters(); |
| 23 | 23 | } |
| 24 | 24 | |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | public function __construct( |
| 19 | 19 | callable $callable, |
| 20 | 20 | public readonly bool $singleton = false, |
| 21 | - ) { |
|
| 21 | + ){ |
|
| 22 | 22 | $this->factory = $callable(...); |
| 23 | 23 | $this->parametersCount = (new \ReflectionFunction($this->factory))->getNumberOfParameters(); |
| 24 | 24 | /** @psalm-suppress TypeDoesNotContainType */ |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | \is_object($callable[0]) ? $callable[0]::class : $callable[0], |
| 30 | 30 | $callable[1], |
| 31 | 31 | ), |
| 32 | - \is_object($callable) && $callable::class !== \Closure::class => 'object ' . $callable::class, |
|
| 32 | + \is_object($callable) && $callable::class !== \Closure::class => 'object '.$callable::class, |
|
| 33 | 33 | default => null, |
| 34 | 34 | }; |
| 35 | 35 | } |
@@ -43,9 +43,12 @@ discard block |
||
| 43 | 43 | $this->requested[$node->name->name] = $node->name->name; |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | - if ($node instanceof Node\Stmt\Property) { |
|
| 47 | - foreach ($node->props as $prop) { |
|
| 48 | - if ($prop instanceof Node\Stmt\PropertyProperty) { |
|
| 46 | + if ($node instanceof Node\Stmt\Property) |
|
| 47 | + { |
|
| 48 | + foreach ($node->props as $prop) |
|
| 49 | + { |
|
| 50 | + if ($prop instanceof Node\Stmt\PropertyProperty) |
|
| 51 | + { |
|
| 49 | 52 | $this->properties[$prop->name->name] = $prop->name->name; |
| 50 | 53 | } |
| 51 | 54 | } |
@@ -56,7 +59,8 @@ discard block |
||
| 56 | 59 | |
| 57 | 60 | private function promotedProperties(Node $node): void |
| 58 | 61 | { |
| 59 | - if (!$node instanceof Node\Param || !$node->var instanceof Node\Expr\Variable) { |
|
| 62 | + if (!$node instanceof Node\Param || !$node->var instanceof Node\Expr\Variable) |
|
| 63 | + { |
|
| 60 | 64 | return; |
| 61 | 65 | } |
| 62 | 66 | |
@@ -38,13 +38,13 @@ discard block |
||
| 38 | 38 | $node->var instanceof Node\Expr\Variable && |
| 39 | 39 | $node->var->name === 'this' && |
| 40 | 40 | $node->name instanceof Node\Identifier |
| 41 | - ) { |
|
| 41 | + ){ |
|
| 42 | 42 | $this->requested[$node->name->name] = $node->name->name; |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | - if ($node instanceof Node\Stmt\Property) { |
|
| 46 | - foreach ($node->props as $prop) { |
|
| 47 | - if ($prop instanceof Node\Stmt\PropertyProperty) { |
|
| 45 | + if ($node instanceof Node\Stmt\Property){ |
|
| 46 | + foreach ($node->props as $prop){ |
|
| 47 | + if ($prop instanceof Node\Stmt\PropertyProperty){ |
|
| 48 | 48 | $this->properties[$prop->name->name] = $prop->name->name; |
| 49 | 49 | } |
| 50 | 50 | } |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | |
| 56 | 56 | private function promotedProperties(Node $node): void |
| 57 | 57 | { |
| 58 | - if (!$node instanceof Node\Param || !$node->var instanceof Node\Expr\Variable) { |
|
| 58 | + if (!$node instanceof Node\Param || !$node->var instanceof Node\Expr\Variable){ |
|
| 59 | 59 | return; |
| 60 | 60 | } |
| 61 | 61 | |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | $node->flags & Node\Stmt\Class_::MODIFIER_PUBLIC || |
| 64 | 64 | $node->flags & Node\Stmt\Class_::MODIFIER_PROTECTED || |
| 65 | 65 | $node->flags & Node\Stmt\Class_::MODIFIER_PRIVATE |
| 66 | - ) { |
|
| 66 | + ){ |
|
| 67 | 67 | $this->properties[$node->var->name] = $node->var->name; |
| 68 | 68 | } |
| 69 | 69 | } |
@@ -16,5 +16,5 @@ |
||
| 16 | 16 | * |
| 17 | 17 | * @return \ReflectionEnum[] |
| 18 | 18 | */ |
| 19 | - public function getScopedEnums(string $scope, object|string|null $target = null): array; |
|
| 19 | + public function getScopedEnums(string $scope, object | string | null $target = null): array; |
|
| 20 | 20 | } |
@@ -16,7 +16,7 @@ |
||
| 16 | 16 | */ |
| 17 | 17 | public function invoke(TokenizationListenerInterface $listener, iterable $classes): void |
| 18 | 18 | { |
| 19 | - foreach ($classes as $class) { |
|
| 19 | + foreach ($classes as $class){ |
|
| 20 | 20 | $listener->listen($class); |
| 21 | 21 | } |
| 22 | 22 | } |
@@ -16,7 +16,8 @@ |
||
| 16 | 16 | */ |
| 17 | 17 | public function invoke(TokenizationListenerInterface $listener, iterable $classes): void |
| 18 | 18 | { |
| 19 | - foreach ($classes as $class) { |
|
| 19 | + foreach ($classes as $class) |
|
| 20 | + { |
|
| 20 | 21 | $listener->listen($class); |
| 21 | 22 | } |
| 22 | 23 | } |
@@ -17,5 +17,5 @@ |
||
| 17 | 17 | * results. |
| 18 | 18 | * @return \ReflectionClass[] |
| 19 | 19 | */ |
| 20 | - public function getScopedInterfaces(string $scope, string|null $target = null): array; |
|
| 20 | + public function getScopedInterfaces(string $scope, string | null $target = null): array; |
|
| 21 | 21 | } |