Passed
Pull Request — master (#839)
by Alexander
16:59
created
src/Router/tests/PipelineFactoryTest.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -71,7 +71,7 @@
 block discarded – undo
71 71
             new Autowire('bar'),
72 72
         ]));
73 73
 
74
-        $handle = function (ServerRequestInterface $request, RequestHandlerInterface $handler) {
74
+        $handle = function (ServerRequestInterface $request, RequestHandlerInterface $handler){
75 75
             return $handler->handle($request);
76 76
         };
77 77
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -71,7 +71,8 @@
 block discarded – undo
71 71
             new Autowire('bar'),
72 72
         ]));
73 73
 
74
-        $handle = function (ServerRequestInterface $request, RequestHandlerInterface $handler) {
74
+        $handle = function (ServerRequestInterface $request, RequestHandlerInterface $handler)
75
+        {
75 76
             return $handler->handle($request);
76 77
         };
77 78
 
Please login to merge, or discard this patch.
src/Router/tests/UriTest.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -100,7 +100,7 @@
 block discarded – undo
100 100
             ]))
101 101
         );
102 102
 
103
-        $uri = $router->uri('test:id', ['id' => 100, 'title' => new class implements \Stringable {
103
+        $uri = $router->uri('test:id', ['id' => 100, 'title' => new class implements \Stringable{
104 104
             public function __toString()
105 105
             {
106 106
                 return 'hello-world';
Please login to merge, or discard this patch.
src/Router/tests/TestCore.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -17,6 +17,6 @@
 block discarded – undo
17 17
 
18 18
     public function callAction(string $controller, string $action = null, array $parameters = []): string
19 19
     {
20
-        return '@wrapped.' . $this->core->callAction($controller, $action, $parameters);
20
+        return '@wrapped.'.$this->core->callAction($controller, $action, $parameters);
21 21
     }
22 22
 }
Please login to merge, or discard this patch.
src/Router/tests/Fixtures/file.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@
 block discarded – undo
2 2
 
3 3
 use Spiral\Router\Loader\Configurator\RoutingConfigurator;
4 4
 
5
-return function (RoutingConfigurator $routes) {
5
+return function (RoutingConfigurator $routes){
6 6
     $routes->add('index', '/')->callable(static fn () => null);
7 7
     $routes->add('posts', '/posts')->callable(static fn () => null);
8 8
     $routes->add('post', '/post/<id>')->callable(static fn () => null);
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -2,7 +2,8 @@
 block discarded – undo
2 2
 
3 3
 use Spiral\Router\Loader\Configurator\RoutingConfigurator;
4 4
 
5
-return function (RoutingConfigurator $routes) {
5
+return function (RoutingConfigurator $routes)
6
+{
6 7
     $routes->add('index', '/')->callable(static fn () => null);
7 8
     $routes->add('posts', '/posts')->callable(static fn () => null);
8 9
     $routes->add('post', '/post/<id>')->callable(static fn () => null);
Please login to merge, or discard this patch.
src/Router/tests/SingleActionTest.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -96,9 +96,9 @@
 block discarded – undo
96 96
         $this->assertSame('echoed', (string)$response->getBody());
97 97
 
98 98
         $e = null;
99
-        try {
99
+        try{
100 100
             $router->handle(new ServerRequest('GET', new Uri('/test')));
101
-        } catch (UndefinedRouteException $e) {
101
+        }catch (UndefinedRouteException $e){
102 102
         }
103 103
 
104 104
         $this->assertNotNull($e, 'Autofill not fired');
Please login to merge, or discard this patch.
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -96,9 +96,12 @@
 block discarded – undo
96 96
         $this->assertSame('echoed', (string)$response->getBody());
97 97
 
98 98
         $e = null;
99
-        try {
99
+        try
100
+        {
100 101
             $router->handle(new ServerRequest('GET', new Uri('/test')));
101
-        } catch (UndefinedRouteException $e) {
102
+        }
103
+        catch (UndefinedRouteException $e)
104
+        {
102 105
         }
103 106
 
104 107
         $this->assertNotNull($e, 'Autofill not fired');
Please login to merge, or discard this patch.
src/Router/tests/RouterTest.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@
 block discarded – undo
50 50
         $dispatcher
51 51
             ->expects(self::exactly(2))
52 52
             ->method('dispatch')
53
-            ->with($this->callback(static fn (Routing|RouteMatched $event): bool => $event->request instanceof ServerRequest));
53
+            ->with($this->callback(static fn (Routing | RouteMatched $event): bool => $event->request instanceof ServerRequest));
54 54
 
55 55
         $router = $this->makeRouter('', $dispatcher);
56 56
         $router->setDefault($route);
Please login to merge, or discard this patch.
src/Router/tests/Diactoros/ResponseFactory.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@
 block discarded – undo
33 33
         $response = new Response($code);
34 34
         $response = $response->withStatus($code, $reasonPhrase);
35 35
 
36
-        foreach ($this->config->getBaseHeaders() as $header => $value) {
36
+        foreach ($this->config->getBaseHeaders() as $header => $value){
37 37
             $response = $response->withAddedHeader($header, $value);
38 38
         }
39 39
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -33,7 +33,8 @@
 block discarded – undo
33 33
         $response = new Response($code);
34 34
         $response = $response->withStatus($code, $reasonPhrase);
35 35
 
36
-        foreach ($this->config->getBaseHeaders() as $header => $value) {
36
+        foreach ($this->config->getBaseHeaders() as $header => $value)
37
+        {
37 38
             $response = $response->withAddedHeader($header, $value);
38 39
         }
39 40
 
Please login to merge, or discard this patch.
src/Router/src/Loader/Configurator/RoutingConfigurator.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -14,19 +14,19 @@
 block discarded – undo
14 14
     public function __construct(
15 15
         private readonly RouteCollection $collection,
16 16
         private readonly LoaderInterface $loader
17
-    ) {
17
+    ){
18 18
     }
19 19
 
20
-    public function import(string|array $resource, string $type = null): ImportConfigurator
20
+    public function import(string | array $resource, string $type = null): ImportConfigurator
21 21
     {
22 22
         $imported = $this->loader->load($resource, $type) ?: [];
23 23
 
24
-        if (!\is_array($imported)) {
24
+        if (!\is_array($imported)){
25 25
             return new ImportConfigurator($this->collection, $imported);
26 26
         }
27 27
 
28 28
         $mergedCollection = new RouteCollection();
29
-        foreach ($imported as $subCollection) {
29
+        foreach ($imported as $subCollection){
30 30
             $mergedCollection->addCollection($subCollection);
31 31
         }
32 32
 
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -21,12 +21,14 @@
 block discarded – undo
21 21
     {
22 22
         $imported = $this->loader->load($resource, $type) ?: [];
23 23
 
24
-        if (!\is_array($imported)) {
24
+        if (!\is_array($imported))
25
+        {
25 26
             return new ImportConfigurator($this->collection, $imported);
26 27
         }
27 28
 
28 29
         $mergedCollection = new RouteCollection();
29
-        foreach ($imported as $subCollection) {
30
+        foreach ($imported as $subCollection)
31
+        {
30 32
             $mergedCollection->addCollection($subCollection);
31 33
         }
32 34
 
Please login to merge, or discard this patch.
src/Router/src/Loader/Configurator/RouteConfigurator.php 2 patches
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -31,12 +31,12 @@  discard block
 block discarded – undo
31 31
         private readonly string $name,
32 32
         private readonly string $pattern,
33 33
         private readonly RouteCollection $collection
34
-    ) {
34
+    ){
35 35
     }
36 36
 
37 37
     public function __destruct()
38 38
     {
39
-        if ($this->target === null) {
39
+        if ($this->target === null){
40 40
             throw new TargetException(
41 41
                 \sprintf('The [%s] route has no defined target. Call one of: `controller`, `action`, 
42 42
                     `namespaced`, `groupControllers`, `callable`, `handler` methods.', $this->name)
@@ -87,21 +87,21 @@  discard block
 block discarded – undo
87 87
         return $this;
88 88
     }
89 89
 
90
-    public function action(string $controller, string|array $action, int $options = 0): self
90
+    public function action(string $controller, string | array $action, int $options = 0): self
91 91
     {
92 92
         $this->target = new Action($controller, $action, $options);
93 93
 
94 94
         return $this;
95 95
     }
96 96
 
97
-    public function callable(array|\Closure $callable): self
97
+    public function callable(array | \Closure $callable): self
98 98
     {
99 99
         $this->target = $callable;
100 100
 
101 101
         return $this;
102 102
     }
103 103
 
104
-    public function handler(TargetInterface|string $target): self
104
+    public function handler(TargetInterface | string $target): self
105 105
     {
106 106
         $this->target = $target;
107 107
 
@@ -136,9 +136,9 @@  discard block
 block discarded – undo
136 136
         return $this;
137 137
     }
138 138
 
139
-    public function middleware(MiddlewareInterface|string|array $middleware): self
139
+    public function middleware(MiddlewareInterface | string | array $middleware): self
140 140
     {
141
-        if (!\is_array($middleware)) {
141
+        if (!\is_array($middleware)){
142 142
             $middleware = [$middleware];
143 143
         }
144 144
 
@@ -147,9 +147,9 @@  discard block
 block discarded – undo
147 147
         return $this;
148 148
     }
149 149
 
150
-    public function methods(string|array $methods): self
150
+    public function methods(string | array $methods): self
151 151
     {
152
-        $this->methods = (array) $methods;
152
+        $this->methods = (array)$methods;
153 153
 
154 154
         return $this;
155 155
     }
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -36,7 +36,8 @@  discard block
 block discarded – undo
36 36
 
37 37
     public function __destruct()
38 38
     {
39
-        if ($this->target === null) {
39
+        if ($this->target === null)
40
+        {
40 41
             throw new TargetException(
41 42
                 \sprintf('The [%s] route has no defined target. Call one of: `controller`, `action`, 
42 43
                     `namespaced`, `groupControllers`, `callable`, `handler` methods.', $this->name)
@@ -138,7 +139,8 @@  discard block
 block discarded – undo
138 139
 
139 140
     public function middleware(MiddlewareInterface|string|array $middleware): self
140 141
     {
141
-        if (!\is_array($middleware)) {
142
+        if (!\is_array($middleware))
143
+        {
142 144
             $middleware = [$middleware];
143 145
         }
144 146
 
Please login to merge, or discard this patch.