Passed
Push — master ( 41e710...91ffae )
by Aleksei
06:19 queued 21s
created
src/Http/src/Exception/InputException.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -7,4 +7,4 @@
 block discarded – undo
7 7
 /**
8 8
  * Exceptions in input manager.
9 9
  */
10
-class InputException extends HttpException {}
10
+class InputException extends HttpException{}
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -7,4 +7,6 @@
 block discarded – undo
7 7
 /**
8 8
  * Exceptions in input manager.
9 9
  */
10
-class InputException extends HttpException {}
10
+class InputException extends HttpException
11
+{
12
+}
Please login to merge, or discard this patch.
src/Http/src/Exception/PipelineException.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -4,4 +4,4 @@
 block discarded – undo
4 4
 
5 5
 namespace Spiral\Http\Exception;
6 6
 
7
-class PipelineException extends HttpException {}
7
+class PipelineException extends HttpException{}
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -4,4 +4,6 @@
 block discarded – undo
4 4
 
5 5
 namespace Spiral\Http\Exception;
6 6
 
7
-class PipelineException extends HttpException {}
7
+class PipelineException extends HttpException
8
+{
9
+}
Please login to merge, or discard this patch.
src/Http/src/Exception/DotNotFoundException.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -7,4 +7,4 @@
 block discarded – undo
7 7
 /**
8 8
  * Raised when element can not be found using dot notation.
9 9
  */
10
-class DotNotFoundException extends \RuntimeException {}
10
+class DotNotFoundException extends \RuntimeException{}
Please login to merge, or discard this patch.
src/Http/src/Exception/ResponseException.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -7,4 +7,4 @@
 block discarded – undo
7 7
 /**
8 8
  * Responder exceptions such as unability to generate response.
9 9
  */
10
-class ResponseException extends HttpException {}
10
+class ResponseException extends HttpException{}
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -7,4 +7,6 @@
 block discarded – undo
7 7
 /**
8 8
  * Responder exceptions such as unability to generate response.
9 9
  */
10
-class ResponseException extends HttpException {}
10
+class ResponseException extends HttpException
11
+{
12
+}
Please login to merge, or discard this patch.
src/Http/src/Exception/HttpException.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -4,4 +4,4 @@
 block discarded – undo
4 4
 
5 5
 namespace Spiral\Http\Exception;
6 6
 
7
-class HttpException extends \RuntimeException {}
7
+class HttpException extends \RuntimeException{}
Please login to merge, or discard this patch.
src/Http/src/Request/InputBag.php 2 patches
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -18,8 +18,8 @@  discard block
 block discarded – undo
18 18
 {
19 19
     public function __construct(
20 20
         private readonly array $data,
21
-        private readonly int|string $prefix = '',
22
-    ) {}
21
+        private readonly int | string $prefix = '',
22
+    ){}
23 23
 
24 24
     public function count(): int
25 25
     {
@@ -28,9 +28,9 @@  discard block
 block discarded – undo
28 28
 
29 29
     public function all(): array
30 30
     {
31
-        try {
31
+        try{
32 32
             return $this->dotGet('');
33
-        } catch (DotNotFoundException) {
33
+        }catch (DotNotFoundException){
34 34
             return [];
35 35
         }
36 36
     }
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
     public function fetch(array $keys, bool $fill = false, mixed $filler = null): array
50 50
     {
51 51
         $result = \array_intersect_key($this->all(), \array_flip($keys));
52
-        if (!$fill) {
52
+        if (!$fill){
53 53
             return $result;
54 54
         }
55 55
 
@@ -59,11 +59,11 @@  discard block
 block discarded – undo
59 59
     /**
60 60
      * Check if field presented (can be empty) by it's name. Dot notation allowed.
61 61
      */
62
-    public function has(int|string $name): bool
62
+    public function has(int | string $name): bool
63 63
     {
64
-        try {
64
+        try{
65 65
             $this->dotGet($name);
66
-        } catch (DotNotFoundException) {
66
+        }catch (DotNotFoundException){
67 67
             return false;
68 68
         }
69 69
 
@@ -72,9 +72,9 @@  discard block
 block discarded – undo
72 72
 
73 73
     public function offsetExists(mixed $offset): bool
74 74
     {
75
-        try {
75
+        try{
76 76
             return !\is_null($this->dotGet($offset));
77
-        } catch (DotNotFoundException) {
77
+        }catch (DotNotFoundException){
78 78
             return false;
79 79
         }
80 80
     }
@@ -87,11 +87,11 @@  discard block
 block discarded – undo
87 87
     /**
88 88
      * Get property or return default value. Dot notation allowed.
89 89
      */
90
-    public function get(int|string $name, mixed $default = null): mixed
90
+    public function get(int | string $name, mixed $default = null): mixed
91 91
     {
92
-        try {
92
+        try{
93 93
             return $this->dotGet($name);
94
-        } catch (DotNotFoundException) {
94
+        }catch (DotNotFoundException){
95 95
             return $default;
96 96
         }
97 97
     }
@@ -122,20 +122,20 @@  discard block
 block discarded – undo
122 122
      *
123 123
      * @throws DotNotFoundException
124 124
      */
125
-    private function dotGet(int|string $name): mixed
125
+    private function dotGet(int | string $name): mixed
126 126
     {
127 127
         $data = $this->data;
128 128
 
129 129
         //Generating path relative to a given name and prefix
130
-        $path = (empty($this->prefix) ? '' : $this->prefix . '.') . $name;
131
-        if (empty($path)) {
130
+        $path = (empty($this->prefix) ? '' : $this->prefix.'.').$name;
131
+        if (empty($path)){
132 132
             return $data;
133 133
         }
134 134
 
135 135
         $path = \explode('.', \rtrim($path, '.'));
136 136
 
137
-        foreach ($path as $step) {
138
-            if (!\is_array($data) || !\array_key_exists($step, $data)) {
137
+        foreach ($path as $step){
138
+            if (!\is_array($data) || !\array_key_exists($step, $data)){
139 139
                 throw new DotNotFoundException(\sprintf("Unable to find requested element '%s'.", $name));
140 140
             }
141 141
 
Please login to merge, or discard this patch.
Braces   +30 added lines, -13 removed lines patch added patch discarded remove patch
@@ -19,7 +19,8 @@  discard block
 block discarded – undo
19 19
     public function __construct(
20 20
         private readonly array $data,
21 21
         private readonly int|string $prefix = '',
22
-    ) {}
22
+    ) {
23
+}
23 24
 
24 25
     public function count(): int
25 26
     {
@@ -28,9 +29,12 @@  discard block
 block discarded – undo
28 29
 
29 30
     public function all(): array
30 31
     {
31
-        try {
32
+        try
33
+        {
32 34
             return $this->dotGet('');
33
-        } catch (DotNotFoundException) {
35
+        }
36
+        catch (DotNotFoundException)
37
+        {
34 38
             return [];
35 39
         }
36 40
     }
@@ -49,7 +53,8 @@  discard block
 block discarded – undo
49 53
     public function fetch(array $keys, bool $fill = false, mixed $filler = null): array
50 54
     {
51 55
         $result = \array_intersect_key($this->all(), \array_flip($keys));
52
-        if (!$fill) {
56
+        if (!$fill)
57
+        {
53 58
             return $result;
54 59
         }
55 60
 
@@ -61,9 +66,12 @@  discard block
 block discarded – undo
61 66
      */
62 67
     public function has(int|string $name): bool
63 68
     {
64
-        try {
69
+        try
70
+        {
65 71
             $this->dotGet($name);
66
-        } catch (DotNotFoundException) {
72
+        }
73
+        catch (DotNotFoundException)
74
+        {
67 75
             return false;
68 76
         }
69 77
 
@@ -72,9 +80,12 @@  discard block
 block discarded – undo
72 80
 
73 81
     public function offsetExists(mixed $offset): bool
74 82
     {
75
-        try {
83
+        try
84
+        {
76 85
             return !\is_null($this->dotGet($offset));
77
-        } catch (DotNotFoundException) {
86
+        }
87
+        catch (DotNotFoundException)
88
+        {
78 89
             return false;
79 90
         }
80 91
     }
@@ -89,9 +100,12 @@  discard block
 block discarded – undo
89 100
      */
90 101
     public function get(int|string $name, mixed $default = null): mixed
91 102
     {
92
-        try {
103
+        try
104
+        {
93 105
             return $this->dotGet($name);
94
-        } catch (DotNotFoundException) {
106
+        }
107
+        catch (DotNotFoundException)
108
+        {
95 109
             return $default;
96 110
         }
97 111
     }
@@ -128,14 +142,17 @@  discard block
 block discarded – undo
128 142
 
129 143
         //Generating path relative to a given name and prefix
130 144
         $path = (empty($this->prefix) ? '' : $this->prefix . '.') . $name;
131
-        if (empty($path)) {
145
+        if (empty($path))
146
+        {
132 147
             return $data;
133 148
         }
134 149
 
135 150
         $path = \explode('.', \rtrim($path, '.'));
136 151
 
137
-        foreach ($path as $step) {
138
-            if (!\is_array($data) || !\array_key_exists($step, $data)) {
152
+        foreach ($path as $step)
153
+        {
154
+            if (!\is_array($data) || !\array_key_exists($step, $data))
155
+            {
139 156
                 throw new DotNotFoundException(\sprintf("Unable to find requested element '%s'.", $name));
140 157
             }
141 158
 
Please login to merge, or discard this patch.
src/Http/src/Http.php 2 patches
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -25,21 +25,21 @@  discard block
 block discarded – undo
25 25
 {
26 26
     private ?RequestHandlerInterface $handler = null;
27 27
     private readonly TracerFactoryInterface $tracerFactory;
28
-    private readonly Pipeline|LazyPipeline $pipeline;
28
+    private readonly Pipeline | LazyPipeline $pipeline;
29 29
 
30 30
     public function __construct(
31 31
         private readonly HttpConfig $config,
32
-        Pipeline|LazyPipeline $pipeline,
32
+        Pipeline | LazyPipeline $pipeline,
33 33
         private readonly ResponseFactoryInterface $responseFactory,
34 34
         private readonly ContainerInterface $container,
35 35
         ?TracerFactoryInterface $tracerFactory = null,
36 36
         private readonly ?EventDispatcherInterface $dispatcher = null,
37
-    ) {
38
-        if ($pipeline instanceof Pipeline) {
39
-            foreach ($this->config->getMiddleware() as $middleware) {
37
+    ){
38
+        if ($pipeline instanceof Pipeline){
39
+            foreach ($this->config->getMiddleware() as $middleware){
40 40
                 $pipeline->pushMiddleware($this->container->get($middleware));
41 41
             }
42
-        } else {
42
+        }else{
43 43
             $pipeline = $pipeline->withAddedMiddleware(
44 44
                 ...$this->config->getMiddleware(),
45 45
             );
@@ -53,12 +53,12 @@  discard block
 block discarded – undo
53 53
     /**
54 54
      * @internal
55 55
      */
56
-    public function getPipeline(): Pipeline|LazyPipeline
56
+    public function getPipeline(): Pipeline | LazyPipeline
57 57
     {
58 58
         return $this->pipeline;
59 59
     }
60 60
 
61
-    public function setHandler(callable|RequestHandlerInterface $handler): self
61
+    public function setHandler(callable | RequestHandlerInterface $handler): self
62 62
     {
63 63
         $this->handler = $handler instanceof RequestHandlerInterface
64 64
             ? $handler
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 
78 78
             $this->dispatcher?->dispatch(new RequestReceived($request));
79 79
 
80
-            if ($this->handler === null) {
80
+            if ($this->handler === null){
81 81
                 throw new HttpException('Unable to run HttpCore, no handler is set.');
82 82
             }
83 83
 
@@ -103,11 +103,11 @@  discard block
 block discarded – undo
103 103
 
104 104
         /** @var ResponseInterface $response */
105 105
         $response = $tracer->trace(
106
-            name: \sprintf('%s %s', $request->getMethod(), (string) $request->getUri()),
106
+            name: \sprintf('%s %s', $request->getMethod(), (string)$request->getUri()),
107 107
             callback: $callback,
108 108
             attributes: [
109 109
                 'http.method' => $request->getMethod(),
110
-                'http.url' => (string) $request->getUri(),
110
+                'http.url' => (string)$request->getUri(),
111 111
                 'http.headers' => \array_map(
112 112
                     static fn(array $values): string => \implode(',', $values),
113 113
                     $request->getHeaders(),
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
             traceKind: TraceKind::SERVER,
118 118
         );
119 119
 
120
-        foreach ($tracer->getContext() as $key => $value) {
120
+        foreach ($tracer->getContext() as $key => $value){
121 121
             $response = $response->withHeader($key, $value);
122 122
         }
123 123
 
Please login to merge, or discard this patch.
Braces   +11 added lines, -5 removed lines patch added patch discarded remove patch
@@ -35,11 +35,15 @@  discard block
 block discarded – undo
35 35
         ?TracerFactoryInterface $tracerFactory = null,
36 36
         private readonly ?EventDispatcherInterface $dispatcher = null,
37 37
     ) {
38
-        if ($pipeline instanceof Pipeline) {
39
-            foreach ($this->config->getMiddleware() as $middleware) {
38
+        if ($pipeline instanceof Pipeline)
39
+        {
40
+            foreach ($this->config->getMiddleware() as $middleware)
41
+            {
40 42
                 $pipeline->pushMiddleware($this->container->get($middleware));
41 43
             }
42
-        } else {
44
+        }
45
+        else
46
+        {
43 47
             $pipeline = $pipeline->withAddedMiddleware(
44 48
                 ...$this->config->getMiddleware(),
45 49
             );
@@ -77,7 +81,8 @@  discard block
 block discarded – undo
77 81
 
78 82
             $this->dispatcher?->dispatch(new RequestReceived($request));
79 83
 
80
-            if ($this->handler === null) {
84
+            if ($this->handler === null)
85
+            {
81 86
                 throw new HttpException('Unable to run HttpCore, no handler is set.');
82 87
             }
83 88
 
@@ -117,7 +122,8 @@  discard block
 block discarded – undo
117 122
             traceKind: TraceKind::SERVER,
118 123
         );
119 124
 
120
-        foreach ($tracer->getContext() as $key => $value) {
125
+        foreach ($tracer->getContext() as $key => $value)
126
+        {
121 127
             $response = $response->withHeader($key, $value);
122 128
         }
123 129
 
Please login to merge, or discard this patch.
src/Scaffolder/tests/App/Controller/DefaultController.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -4,4 +4,4 @@
 block discarded – undo
4 4
 
5 5
 namespace Spiral\Tests\Scaffolder\App\Controller;
6 6
 
7
-class DefaultController {}
7
+class DefaultController{}
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -4,4 +4,6 @@
 block discarded – undo
4 4
 
5 5
 namespace Spiral\Tests\Scaffolder\App\Controller;
6 6
 
7
-class DefaultController {}
7
+class DefaultController
8
+{
9
+}
Please login to merge, or discard this patch.
src/Scaffolder/tests/App/Command/CommandWithoutNamespace.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@
 block discarded – undo
11 11
 final class CommandWithoutNamespace extends AbstractCommand
12 12
 {
13 13
     protected const NAME = 'create:command-without-namespace';
14
-    protected const ARGUMENTS   = [
14
+    protected const ARGUMENTS = [
15 15
         ['name', InputArgument::REQUIRED, 'Command name'],
16 16
         ['alias', InputArgument::OPTIONAL, 'Command id/alias'],
17 17
     ];
Please login to merge, or discard this patch.