@@ -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 |
@@ -32,13 +32,13 @@ |
||
32 | 32 | * @param non-empty-string $name |
33 | 33 | * @param non-empty-string|array<non-empty-string> $value |
34 | 34 | */ |
35 | - public function withHeader(string $name, string|array $value): self; |
|
35 | + public function withHeader(string $name, string | array $value): self; |
|
36 | 36 | |
37 | 37 | /** |
38 | 38 | * @param non-empty-string $name |
39 | 39 | * @param non-empty-string|array<non-empty-string> $value |
40 | 40 | */ |
41 | - public function withAddedHeader(string $name, string|array $value): self; |
|
41 | + public function withAddedHeader(string $name, string | array $value): self; |
|
42 | 42 | |
43 | 43 | /** |
44 | 44 | * @param non-empty-string $name |
@@ -87,7 +87,7 @@ |
||
87 | 87 | $factory->shouldReceive('make')->andReturnUsing(function (string $name): QueueInterface { |
88 | 88 | $result = ['sync' => $this->defaultQueue, 'test' => $this->testQueue][$name] ?? null; |
89 | 89 | |
90 | - if ($result === null) { |
|
90 | + if ($result === null){ |
|
91 | 91 | throw new NotFoundException(); |
92 | 92 | } |
93 | 93 | return $result; |
@@ -87,7 +87,8 @@ |
||
87 | 87 | $factory->shouldReceive('make')->andReturnUsing(function (string $name): QueueInterface { |
88 | 88 | $result = ['sync' => $this->defaultQueue, 'test' => $this->testQueue][$name] ?? null; |
89 | 89 | |
90 | - if ($result === null) { |
|
90 | + if ($result === null) |
|
91 | + { |
|
91 | 92 | throw new NotFoundException(); |
92 | 93 | } |
93 | 94 | return $result; |
@@ -30,9 +30,9 @@ |
||
30 | 30 | \preg_replace_callback( |
31 | 31 | $this->pattern, |
32 | 32 | static function (array $matches) use ($context) { |
33 | - try { |
|
33 | + try{ |
|
34 | 34 | return $context->resolveValue($matches['name']) ?? $matches['default'] ?? null; |
35 | - } catch (ContextException $e) { |
|
35 | + }catch (ContextException $e){ |
|
36 | 36 | return $matches['default'] ?? throw $e; |
37 | 37 | } |
38 | 38 | }, |
@@ -29,10 +29,14 @@ |
||
29 | 29 | return $source->withCode( |
30 | 30 | \preg_replace_callback( |
31 | 31 | $this->pattern, |
32 | - static function (array $matches) use ($context) { |
|
33 | - try { |
|
32 | + static function (array $matches) use ($context) |
|
33 | + { |
|
34 | + try |
|
35 | + { |
|
34 | 36 | return $context->resolveValue($matches['name']) ?? $matches['default'] ?? null; |
35 | - } catch (ContextException $e) { |
|
37 | + } |
|
38 | + catch (ContextException $e) |
|
39 | + { |
|
36 | 40 | return $matches['default'] ?? throw $e; |
37 | 41 | } |
38 | 42 | }, |
@@ -69,8 +69,8 @@ |
||
69 | 69 | protected function getSource(string $path): ViewSource |
70 | 70 | { |
71 | 71 | $loader = new ViewLoader([ |
72 | - 'default' => __DIR__ . '/fixtures/default', |
|
73 | - 'other' => __DIR__ . '/fixtures/other', |
|
72 | + 'default' => __DIR__.'/fixtures/default', |
|
73 | + 'other' => __DIR__.'/fixtures/other', |
|
74 | 74 | ]); |
75 | 75 | |
76 | 76 | return $loader->withExtension('php')->load($path); |
@@ -8,7 +8,7 @@ |
||
8 | 8 | * @param non-empty-string $name |
9 | 9 | * @param non-empty-string|\Stringable $pattern |
10 | 10 | */ |
11 | - public function register(string $name, string|\Stringable $pattern): void; |
|
11 | + public function register(string $name, string | \Stringable $pattern): void; |
|
12 | 12 | |
13 | 13 | /** |
14 | 14 | * @return array<non-empty-string, non-empty-string> |
@@ -72,7 +72,7 @@ |
||
72 | 72 | { |
73 | 73 | $param = PromotedParameter::fromElement($this->element->addPromotedParameter($name)); |
74 | 74 | |
75 | - if (\func_num_args() > 1) { |
|
75 | + if (\func_num_args() > 1){ |
|
76 | 76 | $param->setDefaultValue($defaultValue); |
77 | 77 | } |
78 | 78 |
@@ -72,7 +72,8 @@ |
||
72 | 72 | { |
73 | 73 | $param = PromotedParameter::fromElement($this->element->addPromotedParameter($name)); |
74 | 74 | |
75 | - if (\func_num_args() > 1) { |
|
75 | + if (\func_num_args() > 1) |
|
76 | + { |
|
76 | 77 | $param->setDefaultValue($defaultValue); |
77 | 78 | } |
78 | 79 |