Passed
Pull Request — master (#927)
by Aleksei
08:21
created
src/Router/src/Exception/RouteNotFoundException.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -12,8 +12,8 @@
 block discarded – undo
12 12
         private readonly UriInterface $uri,
13 13
         int $code = 0,
14 14
         \Throwable $previous = null
15
-    ) {
16
-        parent::__construct(\sprintf('Unable to route `%s`.', (string) $uri), $code, $previous);
15
+    ){
16
+        parent::__construct(\sprintf('Unable to route `%s`.', (string)$uri), $code, $previous);
17 17
     }
18 18
 
19 19
     public function getUri(): UriInterface
Please login to merge, or discard this patch.
src/Router/src/Traits/VerbsTrait.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -19,9 +19,9 @@
 block discarded – undo
19 19
      */
20 20
     public function withVerbs(string ...$verbs): RouteInterface
21 21
     {
22
-        foreach ($verbs as &$verb) {
22
+        foreach ($verbs as &$verb){
23 23
             $verb = \strtoupper($verb);
24
-            if (!\in_array($verb, RouteInterface::VERBS, true)) {
24
+            if (!\in_array($verb, RouteInterface::VERBS, true)){
25 25
                 throw new RouteException(\sprintf('Invalid HTTP verb `%s`', $verb));
26 26
             }
27 27
 
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -19,9 +19,11 @@
 block discarded – undo
19 19
      */
20 20
     public function withVerbs(string ...$verbs): RouteInterface
21 21
     {
22
-        foreach ($verbs as &$verb) {
22
+        foreach ($verbs as &$verb)
23
+        {
23 24
             $verb = \strtoupper($verb);
24
-            if (!\in_array($verb, RouteInterface::VERBS, true)) {
25
+            if (!\in_array($verb, RouteInterface::VERBS, true))
26
+            {
25 27
                 throw new RouteException(\sprintf('Invalid HTTP verb `%s`', $verb));
26 28
             }
27 29
 
Please login to merge, or discard this patch.
src/Router/src/Traits/PipelineTrait.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -42,16 +42,16 @@  discard block
 block discarded – undo
42 42
         $route = clone $this;
43 43
 
44 44
         // array fallback
45
-        if (\count($middleware) === 1 && \is_array($middleware[0])) {
45
+        if (\count($middleware) === 1 && \is_array($middleware[0])){
46 46
             $middleware = $middleware[0];
47 47
         }
48 48
 
49 49
         /** @var MiddlewareType[] $middleware */
50
-        foreach ($middleware as $item) {
50
+        foreach ($middleware as $item){
51 51
             $route->middleware[] = $item;
52 52
         }
53 53
 
54
-        if ($route->pipeline !== null) {
54
+        if ($route->pipeline !== null){
55 55
             $route->pipeline = $route->makePipeline();
56 56
         }
57 57
 
@@ -75,11 +75,11 @@  discard block
 block discarded – undo
75 75
      */
76 76
     protected function makePipeline(): Pipeline
77 77
     {
78
-        try {
78
+        try{
79 79
             return $this->container
80 80
                 ->get(PipelineFactory::class)
81 81
                 ->createWithMiddleware($this->middleware);
82
-        } catch (ContainerExceptionInterface $e) {
82
+        }catch (ContainerExceptionInterface $e){
83 83
             throw new RouteException($e->getMessage(), $e->getCode(), $e);
84 84
         }
85 85
     }
Please login to merge, or discard this patch.
Braces   +11 added lines, -5 removed lines patch added patch discarded remove patch
@@ -42,16 +42,19 @@  discard block
 block discarded – undo
42 42
         $route = clone $this;
43 43
 
44 44
         // array fallback
45
-        if (\count($middleware) === 1 && \is_array($middleware[0])) {
45
+        if (\count($middleware) === 1 && \is_array($middleware[0]))
46
+        {
46 47
             $middleware = $middleware[0];
47 48
         }
48 49
 
49 50
         /** @var MiddlewareType[] $middleware */
50
-        foreach ($middleware as $item) {
51
+        foreach ($middleware as $item)
52
+        {
51 53
             $route->middleware[] = $item;
52 54
         }
53 55
 
54
-        if ($route->pipeline !== null) {
56
+        if ($route->pipeline !== null)
57
+        {
55 58
             $route->pipeline = $route->makePipeline();
56 59
         }
57 60
 
@@ -75,11 +78,14 @@  discard block
 block discarded – undo
75 78
      */
76 79
     protected function makePipeline(): Pipeline
77 80
     {
78
-        try {
81
+        try
82
+        {
79 83
             return $this->container
80 84
                 ->get(PipelineFactory::class)
81 85
                 ->createWithMiddleware($this->middleware);
82
-        } catch (ContainerExceptionInterface $e) {
86
+        }
87
+        catch (ContainerExceptionInterface $e)
88
+        {
83 89
             throw new RouteException($e->getMessage(), $e->getCode(), $e);
84 90
         }
85 91
     }
Please login to merge, or discard this patch.
src/Router/src/Event/Routing.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -10,6 +10,6 @@
 block discarded – undo
10 10
 {
11 11
     public function __construct(
12 12
         public readonly ServerRequestInterface $request
13
-    ) {
13
+    ){
14 14
     }
15 15
 }
Please login to merge, or discard this patch.
src/Router/src/Event/RouteMatched.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -12,6 +12,6 @@
 block discarded – undo
12 12
     public function __construct(
13 13
         public readonly ServerRequestInterface $request,
14 14
         public readonly RouteInterface $route,
15
-    ) {
15
+    ){
16 16
     }
17 17
 }
Please login to merge, or discard this patch.
src/Router/src/Autofill.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@
 block discarded – undo
8 8
 {
9 9
     public function __construct(
10 10
         private readonly string $value
11
-    ) {
11
+    ){
12 12
     }
13 13
 
14 14
     public function __toString(): string
Please login to merge, or discard this patch.
src/Router/src/Target/Controller.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@
 block discarded – undo
15 15
         private readonly string $controller,
16 16
         int $options = 0,
17 17
         string $defaultAction = 'index'
18
-    ) {
18
+    ){
19 19
         parent::__construct(
20 20
             ['action' => null],
21 21
             ['action' => null],
Please login to merge, or discard this patch.
src/Router/src/Target/Group.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@
 block discarded – undo
15 15
         private readonly array $controllers,
16 16
         int $options = 0,
17 17
         string $defaultAction = 'index'
18
-    ) {
18
+    ){
19 19
         parent::__construct(
20 20
             ['controller' => null, 'action' => null],
21 21
             ['controller' => \array_keys($controllers), 'action' => null],
Please login to merge, or discard this patch.
src/Router/src/Target/Namespaced.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
         string $namespace,
24 24
         string $postfix = 'Controller',
25 25
         int $options = 0
26
-    ) {
26
+    ){
27 27
         $this->namespace = \rtrim($namespace, '\\');
28 28
         $this->postfix = \ucfirst($postfix);
29 29
 
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 
39 39
     protected function resolveController(array $matches): string
40 40
     {
41
-        if (\preg_match('/[^a-z_0-9\-]/i', $matches['controller'])) {
41
+        if (\preg_match('/[^a-z_0-9\-]/i', $matches['controller'])){
42 42
             throw new TargetException('Invalid namespace target, controller name not allowed.');
43 43
         }
44 44
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -38,7 +38,8 @@
 block discarded – undo
38 38
 
39 39
     protected function resolveController(array $matches): string
40 40
     {
41
-        if (\preg_match('/[^a-z_0-9\-]/i', $matches['controller'])) {
41
+        if (\preg_match('/[^a-z_0-9\-]/i', $matches['controller']))
42
+        {
42 43
             throw new TargetException('Invalid namespace target, controller name not allowed.');
43 44
         }
44 45
 
Please login to merge, or discard this patch.