@@ -69,7 +69,8 @@ discard block |
||
| 69 | 69 | ->andReturn(['first' => ['foo' => 'bar'], 'second' => ['foo' => 'baz']]); |
| 70 | 70 | |
| 71 | 71 | [$schema, $errors] = $this->mapper->map( |
| 72 | - $filter = new class implements FilterInterface { |
|
| 72 | + $filter = new class implements FilterInterface |
|
| 73 | + { |
|
| 73 | 74 | #[Post] |
| 74 | 75 | public string $username; |
| 75 | 76 | |
@@ -165,7 +166,8 @@ discard block |
||
| 165 | 166 | ->andReturn(['first' => ['foo' => 'bar'], 'second' => ['foo' => 'baz']]); |
| 166 | 167 | |
| 167 | 168 | [$schema, $errors] = $this->mapper->map( |
| 168 | - $filter = new class implements FilterInterface { |
|
| 169 | + $filter = new class implements FilterInterface |
|
| 170 | + { |
|
| 169 | 171 | #[Post] |
| 170 | 172 | public string $username; |
| 171 | 173 | |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | |
| 27 | 27 | final class AttributeMapperTest extends BaseTestCase |
| 28 | 28 | { |
| 29 | - private m\LegacyMockInterface|m\MockInterface|FilterProviderInterface $provider; |
|
| 29 | + private m\LegacyMockInterface | m\MockInterface | FilterProviderInterface $provider; |
|
| 30 | 30 | private AttributeMapper $mapper; |
| 31 | 31 | |
| 32 | 32 | public function testInputAttribute(): void |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | ->andReturn(['first' => ['foo' => 'bar'], 'second' => ['foo' => 'baz']]); |
| 64 | 64 | |
| 65 | 65 | [$schema, $errors] = $this->mapper->map( |
| 66 | - $filter = new class implements FilterInterface { |
|
| 66 | + $filter = new class implements FilterInterface{ |
|
| 67 | 67 | #[Post] |
| 68 | 68 | public string $username; |
| 69 | 69 | |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | ->andReturn(['first' => ['foo' => 'bar'], 'second' => ['foo' => 'baz']]); |
| 160 | 160 | |
| 161 | 161 | [$schema, $errors] = $this->mapper->map( |
| 162 | - $filter = new class implements FilterInterface { |
|
| 162 | + $filter = new class implements FilterInterface{ |
|
| 163 | 163 | #[Post] |
| 164 | 164 | public string $username; |
| 165 | 165 | |
@@ -24,7 +24,7 @@ |
||
| 24 | 24 | |
| 25 | 25 | $bag = $parameters['filterBag']; |
| 26 | 26 | |
| 27 | - if ($bag->filter instanceof Filter) { |
|
| 27 | + if ($bag->filter instanceof Filter){ |
|
| 28 | 28 | $bag->filter->setData($bag->entity->toArray()); |
| 29 | 29 | } |
| 30 | 30 | |
@@ -24,7 +24,8 @@ |
||
| 24 | 24 | |
| 25 | 25 | $bag = $parameters['filterBag']; |
| 26 | 26 | |
| 27 | - if ($bag->filter instanceof Filter) { |
|
| 27 | + if ($bag->filter instanceof Filter) |
|
| 28 | + { |
|
| 28 | 29 | $bag->filter->setData($bag->entity->toArray()); |
| 29 | 30 | } |
| 30 | 31 | |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | */ |
| 17 | 17 | protected function getEventFromTypeDeclaration(\ReflectionMethod $method): array |
| 18 | 18 | { |
| 19 | - if ($method->getNumberOfParameters() > 1) { |
|
| 19 | + if ($method->getNumberOfParameters() > 1){ |
|
| 20 | 20 | throw $this->badClassMethod($method->class, $method->getName()); |
| 21 | 21 | } |
| 22 | 22 | $type = $method->getParameters()[0]->getType(); |
@@ -29,8 +29,8 @@ discard block |
||
| 29 | 29 | }; |
| 30 | 30 | |
| 31 | 31 | $result = []; |
| 32 | - foreach ($eventTypes as $type) { |
|
| 33 | - if ($type->isBuiltin()) { |
|
| 32 | + foreach ($eventTypes as $type){ |
|
| 33 | + if ($type->isBuiltin()){ |
|
| 34 | 34 | continue; |
| 35 | 35 | } |
| 36 | 36 | $result[] = $type->getName(); |
@@ -44,9 +44,9 @@ discard block |
||
| 44 | 44 | */ |
| 45 | 45 | protected function getMethod(string $class, string $name): \ReflectionMethod |
| 46 | 46 | { |
| 47 | - try { |
|
| 47 | + try{ |
|
| 48 | 48 | return new \ReflectionMethod($class, $name); |
| 49 | - } catch (\ReflectionException) { |
|
| 49 | + }catch (\ReflectionException){ |
|
| 50 | 50 | throw $this->badClassMethod($class, $name); |
| 51 | 51 | } |
| 52 | 52 | } |
@@ -16,7 +16,8 @@ discard block |
||
| 16 | 16 | */ |
| 17 | 17 | protected function getEventFromTypeDeclaration(\ReflectionMethod $method): array |
| 18 | 18 | { |
| 19 | - if ($method->getNumberOfParameters() > 1) { |
|
| 19 | + if ($method->getNumberOfParameters() > 1) |
|
| 20 | + { |
|
| 20 | 21 | throw $this->badClassMethod($method->class, $method->getName()); |
| 21 | 22 | } |
| 22 | 23 | $type = $method->getParameters()[0]->getType(); |
@@ -29,8 +30,10 @@ discard block |
||
| 29 | 30 | }; |
| 30 | 31 | |
| 31 | 32 | $result = []; |
| 32 | - foreach ($eventTypes as $type) { |
|
| 33 | - if ($type->isBuiltin()) { |
|
| 33 | + foreach ($eventTypes as $type) |
|
| 34 | + { |
|
| 35 | + if ($type->isBuiltin()) |
|
| 36 | + { |
|
| 34 | 37 | continue; |
| 35 | 38 | } |
| 36 | 39 | $result[] = $type->getName(); |
@@ -44,9 +47,12 @@ discard block |
||
| 44 | 47 | */ |
| 45 | 48 | protected function getMethod(string $class, string $name): \ReflectionMethod |
| 46 | 49 | { |
| 47 | - try { |
|
| 50 | + try |
|
| 51 | + { |
|
| 48 | 52 | return new \ReflectionMethod($class, $name); |
| 49 | - } catch (\ReflectionException) { |
|
| 53 | + } |
|
| 54 | + catch (\ReflectionException) |
|
| 55 | + { |
|
| 50 | 56 | throw $this->badClassMethod($class, $name); |
| 51 | 57 | } |
| 52 | 58 | } |
@@ -20,11 +20,11 @@ |
||
| 20 | 20 | |
| 21 | 21 | public function process(): void |
| 22 | 22 | { |
| 23 | - if ($this->processed) { |
|
| 23 | + if ($this->processed){ |
|
| 24 | 24 | return; |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | - foreach ($this->processors as $processor) { |
|
| 27 | + foreach ($this->processors as $processor){ |
|
| 28 | 28 | $processor->process(); |
| 29 | 29 | } |
| 30 | 30 | |
@@ -20,11 +20,13 @@ |
||
| 20 | 20 | |
| 21 | 21 | public function process(): void |
| 22 | 22 | { |
| 23 | - if ($this->processed) { |
|
| 23 | + if ($this->processed) |
|
| 24 | + { |
|
| 24 | 25 | return; |
| 25 | 26 | } |
| 26 | 27 | |
| 27 | - foreach ($this->processors as $processor) { |
|
| 28 | + foreach ($this->processors as $processor) |
|
| 29 | + { |
|
| 28 | 30 | $processor->process(); |
| 29 | 31 | } |
| 30 | 32 | |
@@ -11,5 +11,5 @@ |
||
| 11 | 11 | * @return \Closure(object $event): void |
| 12 | 12 | * @throws \BadMethodCallException |
| 13 | 13 | */ |
| 14 | - public function create(string|object $listener, string $method): \Closure; |
|
| 14 | + public function create(string | object $listener, string $method): \Closure; |
|
| 15 | 15 | } |
@@ -9,9 +9,9 @@ discard block |
||
| 9 | 9 | |
| 10 | 10 | final class AutowireListenerFactory implements ListenerFactoryInterface |
| 11 | 11 | { |
| 12 | - public function create(string|object $listener, string $method): \Closure |
|
| 12 | + public function create(string | object $listener, string $method): \Closure |
|
| 13 | 13 | { |
| 14 | - if ($this->listenerShouldBeAutowired($listener, $method)) { |
|
| 14 | + if ($this->listenerShouldBeAutowired($listener, $method)){ |
|
| 15 | 15 | return static function (object $event) use ($listener, $method): void { |
| 16 | 16 | ContainerScope::getContainer() |
| 17 | 17 | ->get(InvokerInterface::class) |
@@ -30,26 +30,26 @@ discard block |
||
| 30 | 30 | * |
| 31 | 31 | * @return TClass |
| 32 | 32 | */ |
| 33 | - private static function getListener(string|object $listener): object |
|
| 33 | + private static function getListener(string | object $listener): object |
|
| 34 | 34 | { |
| 35 | - if (\is_object($listener)) { |
|
| 35 | + if (\is_object($listener)){ |
|
| 36 | 36 | return $listener; |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | return ContainerScope::getContainer()->get($listener); |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | - private function listenerShouldBeAutowired(object|string $listener, string $method): bool |
|
| 42 | + private function listenerShouldBeAutowired(object | string $listener, string $method): bool |
|
| 43 | 43 | { |
| 44 | - if (!\is_object($listener) && !\class_exists($listener) && !\interface_exists($listener)) { |
|
| 44 | + if (!\is_object($listener) && !\class_exists($listener) && !\interface_exists($listener)){ |
|
| 45 | 45 | return true; |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | - try { |
|
| 48 | + try{ |
|
| 49 | 49 | $refMethod = new \ReflectionMethod($listener, $method); |
| 50 | 50 | |
| 51 | 51 | return $refMethod->getNumberOfParameters() > 1; |
| 52 | - } catch (\ReflectionException $e) { |
|
| 52 | + }catch (\ReflectionException $e){ |
|
| 53 | 53 | $listener = \is_object($listener) ? $listener::class : $listener; |
| 54 | 54 | |
| 55 | 55 | throw match (true) { |
@@ -11,7 +11,8 @@ discard block |
||
| 11 | 11 | { |
| 12 | 12 | public function create(string|object $listener, string $method): \Closure |
| 13 | 13 | { |
| 14 | - if ($this->listenerShouldBeAutowired($listener, $method)) { |
|
| 14 | + if ($this->listenerShouldBeAutowired($listener, $method)) |
|
| 15 | + { |
|
| 15 | 16 | return static function (object $event) use ($listener, $method): void { |
| 16 | 17 | ContainerScope::getContainer() |
| 17 | 18 | ->get(InvokerInterface::class) |
@@ -32,7 +33,8 @@ discard block |
||
| 32 | 33 | */ |
| 33 | 34 | private static function getListener(string|object $listener): object |
| 34 | 35 | { |
| 35 | - if (\is_object($listener)) { |
|
| 36 | + if (\is_object($listener)) |
|
| 37 | + { |
|
| 36 | 38 | return $listener; |
| 37 | 39 | } |
| 38 | 40 | |
@@ -41,15 +43,19 @@ discard block |
||
| 41 | 43 | |
| 42 | 44 | private function listenerShouldBeAutowired(object|string $listener, string $method): bool |
| 43 | 45 | { |
| 44 | - if (!\is_object($listener) && !\class_exists($listener) && !\interface_exists($listener)) { |
|
| 46 | + if (!\is_object($listener) && !\class_exists($listener) && !\interface_exists($listener)) |
|
| 47 | + { |
|
| 45 | 48 | return true; |
| 46 | 49 | } |
| 47 | 50 | |
| 48 | - try { |
|
| 51 | + try |
|
| 52 | + { |
|
| 49 | 53 | $refMethod = new \ReflectionMethod($listener, $method); |
| 50 | 54 | |
| 51 | 55 | return $refMethod->getNumberOfParameters() > 1; |
| 52 | - } catch (\ReflectionException $e) { |
|
| 56 | + } |
|
| 57 | + catch (\ReflectionException $e) |
|
| 58 | + { |
|
| 53 | 59 | $listener = \is_object($listener) ? $listener::class : $listener; |
| 54 | 60 | |
| 55 | 61 | throw match (true) { |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | public function testIterate(): void |
| 26 | 26 | { |
| 27 | 27 | $out = ''; |
| 28 | - foreach ($this->buffer('abc') as $n) { |
|
| 28 | + foreach ($this->buffer('abc') as $n){ |
|
| 29 | 29 | $out .= $n->char; |
| 30 | 30 | } |
| 31 | 31 | |
@@ -149,14 +149,14 @@ discard block |
||
| 149 | 149 | |
| 150 | 150 | private function generate(StreamInterface $src) |
| 151 | 151 | { |
| 152 | - while (!$src->isEOI()) { |
|
| 152 | + while (!$src->isEOI()){ |
|
| 153 | 153 | yield new Byte($src->getOffset(), $src->peak()); |
| 154 | 154 | } |
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | private function generateToken(StreamInterface $src): \Generator |
| 158 | 158 | { |
| 159 | - while (!$src->isEOI()) { |
|
| 159 | + while (!$src->isEOI()){ |
|
| 160 | 160 | yield new Token(0, null, $src->peak()); |
| 161 | 161 | } |
| 162 | 162 | } |
@@ -25,7 +25,8 @@ discard block |
||
| 25 | 25 | public function testIterate(): void |
| 26 | 26 | { |
| 27 | 27 | $out = ''; |
| 28 | - foreach ($this->buffer('abc') as $n) { |
|
| 28 | + foreach ($this->buffer('abc') as $n) |
|
| 29 | + { |
|
| 29 | 30 | $out .= $n->char; |
| 30 | 31 | } |
| 31 | 32 | |
@@ -149,14 +150,16 @@ discard block |
||
| 149 | 150 | |
| 150 | 151 | private function generate(StreamInterface $src) |
| 151 | 152 | { |
| 152 | - while (!$src->isEOI()) { |
|
| 153 | + while (!$src->isEOI()) |
|
| 154 | + { |
|
| 153 | 155 | yield new Byte($src->getOffset(), $src->peak()); |
| 154 | 156 | } |
| 155 | 157 | } |
| 156 | 158 | |
| 157 | 159 | private function generateToken(StreamInterface $src): \Generator |
| 158 | 160 | { |
| 159 | - while (!$src->isEOI()) { |
|
| 161 | + while (!$src->isEOI()) |
|
| 162 | + { |
|
| 160 | 163 | yield new Token(0, null, $src->peak()); |
| 161 | 164 | } |
| 162 | 165 | } |
@@ -33,9 +33,12 @@ |
||
| 33 | 33 | |
| 34 | 34 | public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface |
| 35 | 35 | { |
| 36 | - try { |
|
| 36 | + try |
|
| 37 | + { |
|
| 37 | 38 | return $handler->handle($request); |
| 38 | - } catch (ValidationException $e) { |
|
| 39 | + } |
|
| 40 | + catch (ValidationException $e) |
|
| 41 | + { |
|
| 39 | 42 | return $this->renderErrors->render($e->errors, $e->context); |
| 40 | 43 | } |
| 41 | 44 | } |
@@ -27,15 +27,15 @@ |
||
| 27 | 27 | public function __construct( |
| 28 | 28 | ContainerInterface $container, |
| 29 | 29 | ?ErrorsRendererInterface $renderErrors = null, |
| 30 | - ) { |
|
| 30 | + ){ |
|
| 31 | 31 | $this->renderErrors = $renderErrors ?? $container->get(JsonErrorsRenderer::class); |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface |
| 35 | 35 | { |
| 36 | - try { |
|
| 36 | + try{ |
|
| 37 | 37 | return $handler->handle($request); |
| 38 | - } catch (ValidationException $e) { |
|
| 38 | + }catch (ValidationException $e){ |
|
| 39 | 39 | return $this->renderErrors->render($e->errors, $e->context); |
| 40 | 40 | } |
| 41 | 41 | } |
@@ -107,14 +107,14 @@ discard block |
||
| 107 | 107 | * @param non-empty-string $name |
| 108 | 108 | * @param non-empty-string|array<non-empty-string> $value |
| 109 | 109 | */ |
| 110 | - public function withHeader(string $name, string|array $value): self |
|
| 110 | + public function withHeader(string $name, string | array $value): self |
|
| 111 | 111 | { |
| 112 | 112 | $value = \is_iterable($value) ? $value : [$value]; |
| 113 | 113 | |
| 114 | 114 | $self = clone $this; |
| 115 | 115 | $self->headers[$name] = []; |
| 116 | 116 | |
| 117 | - foreach ($value as $item) { |
|
| 117 | + foreach ($value as $item){ |
|
| 118 | 118 | $self->headers[$name][] = $item; |
| 119 | 119 | } |
| 120 | 120 | |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | * @param non-empty-string $name |
| 126 | 126 | * @param non-empty-string|array<non-empty-string> $value |
| 127 | 127 | */ |
| 128 | - public function withAddedHeader(string $name, string|array $value): self |
|
| 128 | + public function withAddedHeader(string $name, string | array $value): self |
|
| 129 | 129 | { |
| 130 | 130 | /** @var iterable<non-empty-string> $value */ |
| 131 | 131 | $value = \is_iterable($value) ? $value : [$value]; |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | /** @var array<non-empty-string> $headers */ |
| 134 | 134 | $headers = $this->headers[$name] ?? []; |
| 135 | 135 | |
| 136 | - foreach ($value as $item) { |
|
| 136 | + foreach ($value as $item){ |
|
| 137 | 137 | $headers[] = $item; |
| 138 | 138 | } |
| 139 | 139 | |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | */ |
| 146 | 146 | public function withoutHeader(string $name): self |
| 147 | 147 | { |
| 148 | - if (!isset($this->headers[$name])) { |
|
| 148 | + if (!isset($this->headers[$name])){ |
|
| 149 | 149 | return $this; |
| 150 | 150 | } |
| 151 | 151 | |
@@ -114,7 +114,8 @@ discard block |
||
| 114 | 114 | $self = clone $this; |
| 115 | 115 | $self->headers[$name] = []; |
| 116 | 116 | |
| 117 | - foreach ($value as $item) { |
|
| 117 | + foreach ($value as $item) |
|
| 118 | + { |
|
| 118 | 119 | $self->headers[$name][] = $item; |
| 119 | 120 | } |
| 120 | 121 | |
@@ -133,7 +134,8 @@ discard block |
||
| 133 | 134 | /** @var array<non-empty-string> $headers */ |
| 134 | 135 | $headers = $this->headers[$name] ?? []; |
| 135 | 136 | |
| 136 | - foreach ($value as $item) { |
|
| 137 | + foreach ($value as $item) |
|
| 138 | + { |
|
| 137 | 139 | $headers[] = $item; |
| 138 | 140 | } |
| 139 | 141 | |
@@ -145,7 +147,8 @@ discard block |
||
| 145 | 147 | */ |
| 146 | 148 | public function withoutHeader(string $name): self |
| 147 | 149 | { |
| 148 | - if (!isset($this->headers[$name])) { |
|
| 150 | + if (!isset($this->headers[$name])) |
|
| 151 | + { |
|
| 149 | 152 | return $this; |
| 150 | 153 | } |
| 151 | 154 | |