@@ -42,12 +42,12 @@ |
||
| 42 | 42 | protected function compile(Template $document): string |
| 43 | 43 | { |
| 44 | 44 | $compiler = new Compiler(); |
| 45 | - foreach (static::RENDERS as $renderer) { |
|
| 45 | + foreach (static::RENDERS as $renderer){ |
|
| 46 | 46 | $compiler->addRenderer(new $renderer()); |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | $directiveGroup = new DirectiveGroup(); |
| 50 | - foreach (static::DIRECTIVES as $directive) { |
|
| 50 | + foreach (static::DIRECTIVES as $directive){ |
|
| 51 | 51 | $directiveGroup->addDirective(new $directive()); |
| 52 | 52 | } |
| 53 | 53 | |
@@ -42,12 +42,14 @@ |
||
| 42 | 42 | protected function compile(Template $document): string |
| 43 | 43 | { |
| 44 | 44 | $compiler = new Compiler(); |
| 45 | - foreach (static::RENDERS as $renderer) { |
|
| 45 | + foreach (static::RENDERS as $renderer) |
|
| 46 | + { |
|
| 46 | 47 | $compiler->addRenderer(new $renderer()); |
| 47 | 48 | } |
| 48 | 49 | |
| 49 | 50 | $directiveGroup = new DirectiveGroup(); |
| 50 | - foreach (static::DIRECTIVES as $directive) { |
|
| 51 | + foreach (static::DIRECTIVES as $directive) |
|
| 52 | + { |
|
| 51 | 53 | $directiveGroup->addDirective(new $directive()); |
| 52 | 54 | } |
| 53 | 55 | |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | protected function compile(Template $document): string |
| 35 | 35 | { |
| 36 | 36 | $compiler = new Compiler(); |
| 37 | - foreach (static::RENDERS as $renderer) { |
|
| 37 | + foreach (static::RENDERS as $renderer){ |
|
| 38 | 38 | $compiler->addRenderer(new $renderer()); |
| 39 | 39 | } |
| 40 | 40 | |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | { |
| 50 | 50 | $parser = new Parser(); |
| 51 | 51 | |
| 52 | - foreach (static::GRAMMARS as $grammar => $syntax) { |
|
| 52 | + foreach (static::GRAMMARS as $grammar => $syntax){ |
|
| 53 | 53 | $parser->addSyntax(new $grammar(), new $syntax()); |
| 54 | 54 | } |
| 55 | 55 | |
@@ -34,7 +34,8 @@ discard block |
||
| 34 | 34 | protected function compile(Template $document): string |
| 35 | 35 | { |
| 36 | 36 | $compiler = new Compiler(); |
| 37 | - foreach (static::RENDERS as $renderer) { |
|
| 37 | + foreach (static::RENDERS as $renderer) |
|
| 38 | + { |
|
| 38 | 39 | $compiler->addRenderer(new $renderer()); |
| 39 | 40 | } |
| 40 | 41 | |
@@ -49,7 +50,8 @@ discard block |
||
| 49 | 50 | { |
| 50 | 51 | $parser = new Parser(); |
| 51 | 52 | |
| 52 | - foreach (static::GRAMMARS as $grammar => $syntax) { |
|
| 53 | + foreach (static::GRAMMARS as $grammar => $syntax) |
|
| 54 | + { |
|
| 53 | 55 | $parser->addSyntax(new $grammar(), new $syntax()); |
| 54 | 56 | } |
| 55 | 57 | |
@@ -9,7 +9,7 @@ |
||
| 9 | 9 | |
| 10 | 10 | abstract class AttributeTestCase extends m\Adapter\Phpunit\MockeryTestCase |
| 11 | 11 | { |
| 12 | - protected m\LegacyMockInterface|m\MockInterface|InputInterface $input; |
|
| 12 | + protected m\LegacyMockInterface | m\MockInterface | InputInterface $input; |
|
| 13 | 13 | protected string $baz; |
| 14 | 14 | |
| 15 | 15 | protected function setUp(): void |
@@ -56,12 +56,14 @@ |
||
| 56 | 56 | */ |
| 57 | 57 | public function match(Request $request): ?static |
| 58 | 58 | { |
| 59 | - if (!\in_array(\strtoupper($request->getMethod()), $this->getVerbs(), true)) { |
|
| 59 | + if (!\in_array(\strtoupper($request->getMethod()), $this->getVerbs(), true)) |
|
| 60 | + { |
|
| 60 | 61 | return null; |
| 61 | 62 | } |
| 62 | 63 | |
| 63 | 64 | $matches = $this->uriHandler->match($request->getUri(), $this->defaults); |
| 64 | - if ($matches === null) { |
|
| 65 | + if ($matches === null) |
|
| 66 | + { |
|
| 65 | 67 | return null; |
| 66 | 68 | } |
| 67 | 69 | |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | public function __construct( |
| 32 | 32 | protected string $pattern, |
| 33 | 33 | array $defaults = [], |
| 34 | - ) { |
|
| 34 | + ){ |
|
| 35 | 35 | $this->defaults = $defaults; |
| 36 | 36 | } |
| 37 | 37 | |
@@ -56,12 +56,12 @@ discard block |
||
| 56 | 56 | */ |
| 57 | 57 | public function match(Request $request): ?static |
| 58 | 58 | { |
| 59 | - if (!\in_array(\strtoupper($request->getMethod()), $this->getVerbs(), true)) { |
|
| 59 | + if (!\in_array(\strtoupper($request->getMethod()), $this->getVerbs(), true)){ |
|
| 60 | 60 | return null; |
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | $matches = $this->uriHandler->match($request->getUri(), $this->defaults); |
| 64 | - if ($matches === null) { |
|
| 64 | + if ($matches === null){ |
|
| 65 | 65 | return null; |
| 66 | 66 | } |
| 67 | 67 | |
@@ -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 | |
@@ -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 | } |