@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | */ |
19 | 19 | public function __construct( |
20 | 20 | public readonly ?string $key = null, |
21 | - ) { |
|
21 | + ){ |
|
22 | 22 | } |
23 | 23 | |
24 | 24 | /** |
@@ -31,6 +31,6 @@ discard block |
||
31 | 31 | |
32 | 32 | public function getSchema(\ReflectionProperty $property): string |
33 | 33 | { |
34 | - return 'data:' . $this->getKey($property); |
|
34 | + return 'data:'.$this->getKey($property); |
|
35 | 35 | } |
36 | 36 | } |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | */ |
20 | 20 | public function __construct( |
21 | 21 | public readonly ?string $key = null, |
22 | - ) { |
|
22 | + ){ |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | /** |
@@ -32,6 +32,6 @@ discard block |
||
32 | 32 | |
33 | 33 | public function getSchema(\ReflectionProperty $property): string |
34 | 34 | { |
35 | - return 'file:' . $this->getKey($property); |
|
35 | + return 'file:'.$this->getKey($property); |
|
36 | 36 | } |
37 | 37 | } |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | */ |
19 | 19 | public function __construct( |
20 | 20 | public readonly ?string $key = null, |
21 | - ) { |
|
21 | + ){ |
|
22 | 22 | } |
23 | 23 | |
24 | 24 | /** |
@@ -31,6 +31,6 @@ discard block |
||
31 | 31 | |
32 | 32 | public function getSchema(\ReflectionProperty $property): string |
33 | 33 | { |
34 | - return 'post:' . $this->getKey($property); |
|
34 | + return 'post:'.$this->getKey($property); |
|
35 | 35 | } |
36 | 36 | } |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | */ |
19 | 19 | public function __construct( |
20 | 20 | public readonly ?string $key = null, |
21 | - ) { |
|
21 | + ){ |
|
22 | 22 | } |
23 | 23 | |
24 | 24 | /** |
@@ -31,6 +31,6 @@ discard block |
||
31 | 31 | |
32 | 32 | public function getSchema(\ReflectionProperty $property): string |
33 | 33 | { |
34 | - return 'query:' . $this->getKey($property); |
|
34 | + return 'query:'.$this->getKey($property); |
|
35 | 35 | } |
36 | 36 | } |
@@ -15,7 +15,7 @@ |
||
15 | 15 | { |
16 | 16 | public function __construct( |
17 | 17 | public readonly bool $softMatch = false |
18 | - ) { |
|
18 | + ){ |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | /** |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | */ |
19 | 19 | public function __construct( |
20 | 20 | public readonly ?string $key = null, |
21 | - ) { |
|
21 | + ){ |
|
22 | 22 | } |
23 | 23 | |
24 | 24 | /** |
@@ -31,6 +31,6 @@ discard block |
||
31 | 31 | |
32 | 32 | public function getSchema(\ReflectionProperty $property): string |
33 | 33 | { |
34 | - return 'cookie:' . $this->getKey($property); |
|
34 | + return 'cookie:'.$this->getKey($property); |
|
35 | 35 | } |
36 | 36 | } |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | */ |
19 | 19 | public function __construct( |
20 | 20 | public readonly ?string $key = null, |
21 | - ) { |
|
21 | + ){ |
|
22 | 22 | } |
23 | 23 | |
24 | 24 | /** |
@@ -31,6 +31,6 @@ discard block |
||
31 | 31 | |
32 | 32 | public function getSchema(\ReflectionProperty $property): string |
33 | 33 | { |
34 | - return 'input:' . $this->getKey($property); |
|
34 | + return 'input:'.$this->getKey($property); |
|
35 | 35 | } |
36 | 36 | } |
@@ -9,7 +9,7 @@ |
||
9 | 9 | public function __construct( |
10 | 10 | public readonly array $errors, |
11 | 11 | public readonly mixed $context = null |
12 | - ) { |
|
12 | + ){ |
|
13 | 13 | parent::__construct('The given data was invalid.', 422); |
14 | 14 | } |
15 | 15 | } |
@@ -17,8 +17,10 @@ discard block |
||
17 | 17 | { |
18 | 18 | // De-mapping |
19 | 19 | $mapped = []; |
20 | - foreach ($errors as $field => $message) { |
|
21 | - if (!isset($this->schema[$field])) { |
|
20 | + foreach ($errors as $field => $message) |
|
21 | + { |
|
22 | + if (!isset($this->schema[$field])) |
|
23 | + { |
|
22 | 24 | $mapped[$field] = $message; |
23 | 25 | continue; |
24 | 26 | } |
@@ -36,14 +38,16 @@ discard block |
||
36 | 38 | */ |
37 | 39 | private function mount(array &$array, string $path, mixed $message): void |
38 | 40 | { |
39 | - if ($path === '.') { |
|
41 | + if ($path === '.') |
|
42 | + { |
|
40 | 43 | throw new SchemaException( |
41 | 44 | \sprintf('Unable to mount error `%s` to `%s` (root path is forbidden)', $message, $path) |
42 | 45 | ); |
43 | 46 | } |
44 | 47 | |
45 | 48 | $step = \explode('.', $path); |
46 | - while ($name = \array_shift($step)) { |
|
49 | + while ($name = \array_shift($step)) |
|
50 | + { |
|
47 | 51 | $array = &$array[$name]; |
48 | 52 | } |
49 | 53 |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | { |
11 | 11 | public function __construct( |
12 | 12 | private readonly array $schema |
13 | - ) { |
|
13 | + ){ |
|
14 | 14 | } |
15 | 15 | |
16 | 16 | /** |
@@ -21,8 +21,8 @@ discard block |
||
21 | 21 | { |
22 | 22 | // De-mapping |
23 | 23 | $mapped = []; |
24 | - foreach ($errors as $field => $message) { |
|
25 | - if (!isset($this->schema[$field])) { |
|
24 | + foreach ($errors as $field => $message){ |
|
25 | + if (!isset($this->schema[$field])){ |
|
26 | 26 | $mapped[$field] = $message; |
27 | 27 | continue; |
28 | 28 | } |
@@ -40,14 +40,14 @@ discard block |
||
40 | 40 | */ |
41 | 41 | private function mount(array &$array, string $path, mixed $message): void |
42 | 42 | { |
43 | - if ($path === '.') { |
|
43 | + if ($path === '.'){ |
|
44 | 44 | throw new SchemaException( |
45 | 45 | \sprintf('Unable to mount error `%s` to `%s` (root path is forbidden)', $message, $path) |
46 | 46 | ); |
47 | 47 | } |
48 | 48 | |
49 | 49 | $step = \explode('.', $path); |
50 | - while ($name = \array_shift($step)) { |
|
50 | + while ($name = \array_shift($step)){ |
|
51 | 51 | $array = &$array[$name]; |
52 | 52 | } |
53 | 53 |