Passed
Push — master ( 82bd79...a09bf3 )
by Alex
07:52
created
Mezon/Router/Tests/RouterUnitTest.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@
 block discarded – undo
1 1
 <?php
2
-declare(strict_types = 1);
2
+declare(strict_types=1);
3 3
 namespace Mezon\Router\Tests;
4 4
 
5 5
 use Mezon\Router\Router;
Please login to merge, or discard this patch.
Mezon/Router/Tests/Base/DynamicRoutesTestClass.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-declare(strict_types = 1);
2
+declare(strict_types=1);
3 3
 namespace Mezon\Router\Tests\Base;
4 4
 
5 5
 use Mezon\Router\Types\DateRouterType;
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
         $router->addType('date', DateRouterType::class);
194 194
 
195 195
         foreach ($pattern as $r) {
196
-            $router->addRoute($r, function () {
196
+            $router->addRoute($r, function() {
197 197
                 // do nothing
198 198
             }, $method);
199 199
         }
@@ -211,8 +211,8 @@  discard block
 block discarded – undo
211 211
     {
212 212
         // setup
213 213
         $router = $this->getRouter();
214
-        for ($i = 0; $i < 15; $i ++) {
215
-            $router->addRoute('/multiple/' . $i . '/[i:id]', function () {
214
+        for ($i = 0; $i < 15; $i++) {
215
+            $router->addRoute('/multiple/' . $i . '/[i:id]', function() {
216 216
                 return 'done!';
217 217
             });
218 218
         }
@@ -233,22 +233,22 @@  discard block
 block discarded – undo
233 233
     {
234 234
         // setup
235 235
         $router = $this->getRouter();
236
-        $router->addRoute('/user/[s:login]/custom-field/[s:name]', function () {
236
+        $router->addRoute('/user/[s:login]/custom-field/[s:name]', function() {
237 237
             return 'get-custom-field';
238 238
         });
239
-        $router->addRoute('/user/[s:login]/custom-field/[s:name]/add', function () {
239
+        $router->addRoute('/user/[s:login]/custom-field/[s:name]/add', function() {
240 240
             return 'add-custom-field';
241 241
         });
242
-        $router->addRoute('/user/[s:login]/custom-field/[s:name]/delete', function () {
242
+        $router->addRoute('/user/[s:login]/custom-field/[s:name]/delete', function() {
243 243
             return 'delete-custom-field';
244 244
         });
245
-        $router->addRoute('/restore-password/[s:token]', function () {
245
+        $router->addRoute('/restore-password/[s:token]', function() {
246 246
             return 'restore-password';
247 247
         });
248
-        $router->addRoute('/reset-password/[s:token]', function () {
248
+        $router->addRoute('/reset-password/[s:token]', function() {
249 249
             return 'reset-password';
250 250
         });
251
-        $router->addRoute('/user/[s:login]/delete', function () {
251
+        $router->addRoute('/user/[s:login]/delete', function() {
252 252
             return 'user-delete';
253 253
         });
254 254
 
Please login to merge, or discard this patch.
Mezon/Router/Tests/Base/BaseRouterUnitTestClass.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@
 block discarded – undo
1 1
 <?php
2
-declare(strict_types = 1);
2
+declare(strict_types=1);
3 3
 namespace Mezon\Router\Tests\Base;
4 4
 
5 5
 use PHPUnit\Framework\TestCase;
Please login to merge, or discard this patch.
Mezon/Router/Tests/Base/ExtractParametersTestClass.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-declare(strict_types = 1);
2
+declare(strict_types=1);
3 3
 namespace Mezon\Router\Tests\Base;
4 4
 
5 5
 use PHPUnit\Framework\TestCase;
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
     {
30 30
         // setup
31 31
         $router = $this->getRouter();
32
-        $router->addRoute('/catalog/[i:foo]/', function (): void {
32
+        $router->addRoute('/catalog/[i:foo]/', function(): void {
33 33
             // do nothing
34 34
         });
35 35
 
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
          *            route
53 53
          * @param string[] $parameters
54 54
          */
55
-        function (string $route, array $parameters): string {
55
+        function(string $route, array $parameters): string {
56 56
             return $parameters['cat_id'];
57 57
         });
58 58
 
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
          *            route
75 75
          * @param string[] $parameters
76 76
          */
77
-        function (string $route, array $parameters): string {
77
+        function(string $route, array $parameters): string {
78 78
             return $parameters['cat_id'] . $parameters['item_id'];
79 79
         });
80 80
 
@@ -91,8 +91,8 @@  discard block
 block discarded – undo
91 91
     {
92 92
         // setup
93 93
         $router = $this->getRouter();
94
-        for ($i = 0; $i < 15; $i ++) {
95
-            $router->addRoute('/multiple/' . $i . '/[i:id]', function () {
94
+        for ($i = 0; $i < 15; $i++) {
95
+            $router->addRoute('/multiple/' . $i . '/[i:id]', function() {
96 96
                 return 'done!';
97 97
             });
98 98
         }
Please login to merge, or discard this patch.
Mezon/Router/Tests/Base/BigSetOfRoutesTestClass.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-declare(strict_types = 1);
2
+declare(strict_types=1);
3 3
 namespace Mezon\Router\Tests\Base;
4 4
 
5 5
 /**
@@ -38,8 +38,8 @@  discard block
 block discarded – undo
38 38
         // setup
39 39
         RouterUnitTestUtils::setRequestMethod('GET');
40 40
         $router = $this->getRouter();
41
-        for ($i = 1; $i <= $amount; $i ++) {
42
-            $router->addRoute('/param/[i:id]/' . $i, function () use ($i): int {
41
+        for ($i = 1; $i <= $amount; $i++) {
42
+            $router->addRoute('/param/[i:id]/' . $i, function() use ($i): int {
43 43
                 return $i;
44 44
             });
45 45
         }
Please login to merge, or discard this patch.
Mezon/Router/Tests/Base/UnexistingRouteTestClass.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-declare(strict_types = 1);
2
+declare(strict_types=1);
3 3
 namespace Mezon\Router\Tests\Base;
4 4
 
5 5
 /**
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 
22 22
         // assertions
23 23
         $this->expectException(\Exception::class);
24
-        $this->expectExceptionCode(- 1);
24
+        $this->expectExceptionCode(-1);
25 25
         $this->expectErrorMessage('The processor was not found for the route unexisting in GET : r1, ; POST : r1, ; PUT : <none>; DELETE : <none>; OPTION : <none>; PATCH : <none>');
26 26
 
27 27
         // test body
Please login to merge, or discard this patch.
Mezon/Router/Tests/Base/DynamicRoutesInvalidCasesTestClass.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-declare(strict_types = 1);
2
+declare(strict_types=1);
3 3
 namespace Mezon\Router\Tests\Base;
4 4
 
5 5
 use PHPUnit\Framework\TestCase;
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
     {
30 30
         // setup
31 31
         $router = $this->getRouter();
32
-        $router->addRoute('/catalog/[i:foo]/', function () {
32
+        $router->addRoute('/catalog/[i:foo]/', function() {
33 33
             // do nothing
34 34
         });
35 35
 
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
         // setup
50 50
         $_SERVER['REQUEST_METHOD'] = 'HEAD';
51 51
         $router = $this->getRouter();
52
-        $router->addRoute('/catalog/[i:foo]/', function () {
52
+        $router->addRoute('/catalog/[i:foo]/', function() {
53 53
             // do nothing
54 54
         });
55 55
 
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
     {
68 68
         // setup
69 69
         $router = $this->getRouter();
70
-        $router->addRoute('/catalog/[il:cat_id]/', function () {
70
+        $router->addRoute('/catalog/[il:cat_id]/', function() {
71 71
             return 1;
72 72
         });
73 73
 
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
 
89 89
         $exception = '';
90 90
         $router = $this->getRouter();
91
-        $router->addRoute('/catalog/[i:cat_id]', function () {
91
+        $router->addRoute('/catalog/[i:cat_id]', function() {
92 92
             return 1;
93 93
         });
94 94
 
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
 
113 113
         $exception = '';
114 114
         $router = $this->getRouter();
115
-        $router->addRoute('/catalog/[i:cat_id]', function () {
115
+        $router->addRoute('/catalog/[i:cat_id]', function() {
116 116
             return 1;
117 117
         });
118 118
 
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
 
137 137
         $exception = '';
138 138
         $router = $this->getRouter();
139
-        $router->addRoute('/catalog/[i:item_id]', function () {
139
+        $router->addRoute('/catalog/[i:item_id]', function() {
140 140
             return 1;
141 141
         });
142 142
 
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
     {
180 180
         // setup
181 181
         $router = $this->getRouter();
182
-        $router->addRoute($route, function () {
182
+        $router->addRoute($route, function() {
183 183
             // do nothing
184 184
         });
185 185
 
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
     public function testInvalidType(): void
197 197
     {
198 198
         $router = $this->getRouter();
199
-        $router->addRoute('/catalog/[unexisting-type:i]/item/', function () {
199
+        $router->addRoute('/catalog/[unexisting-type:i]/item/', function() {
200 200
             return 1;
201 201
         });
202 202
 
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
     public function testValidInvalidTypes(): void
215 215
     {
216 216
         $router = $this->getRouter();
217
-        $router->addRoute('/catalog/[i:cat_id]/item/[unexisting-type-trace:item_id]/', function () {
217
+        $router->addRoute('/catalog/[i:cat_id]/item/[unexisting-type-trace:item_id]/', function() {
218 218
             return 1;
219 219
         });
220 220
 
Please login to merge, or discard this patch.
Mezon/Router/Tests/Base/MiddlewareTestClass.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-declare(strict_types = 1);
2
+declare(strict_types=1);
3 3
 namespace Mezon\Router\Tests\Base;
4 4
 
5 5
 use PHPUnit\Framework\TestCase;
@@ -30,19 +30,19 @@  discard block
 block discarded – undo
30 30
         // setup
31 31
         $route = '/route-with-middleware/';
32 32
         $router = $this->getRouter();
33
-        $router->registerMiddleware('*', function () {
33
+        $router->registerMiddleware('*', function() {
34 34
             return [
35 35
                 1,
36 36
                 2
37 37
             ];
38 38
         });
39
-        $router->addRoute($route, function (int $i, int $j) {
39
+        $router->addRoute($route, function(int $i, int $j) {
40 40
             return [
41 41
                 $i,
42 42
                 $j
43 43
             ];
44 44
         });
45
-        $router->registerMiddleware($route, function (int $i, int $j) {
45
+        $router->registerMiddleware($route, function(int $i, int $j) {
46 46
             return [
47 47
                 $i,
48 48
                 $j
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
         $route = '/route/[i:id]';
68 68
         $router = $this->getRouter();
69 69
 
70
-        $router->addRoute($route, function (string $route, array $parameters): array {
70
+        $router->addRoute($route, function(string $route, array $parameters): array {
71 71
             return $parameters;
72 72
         });
73 73
 
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
          * @psalm-param string $route route
77 77
          * @psalm-param array{id: int} $parameters parameters
78 78
          */
79
-        function (string $route, array $parameters) {
79
+        function(string $route, array $parameters) {
80 80
             $parameters['_second'] = $parameters['id'];
81 81
             $parameters['id'] += 9;
82 82
 
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
         });
88 88
 
89 89
         // This middleware is broken, don't parse the result
90
-        $router->registerMiddleware($route, function (string $route, array $parameters) {
90
+        $router->registerMiddleware($route, function(string $route, array $parameters) {
91 91
             $parameters['_dont_set_this'] = true;
92 92
 
93 93
             return null;
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
          *            route
100 100
          * @psalm-param array{id: int} $parameters parameters
101 101
          */
102
-        function (string $route, array $parameters) {
102
+        function(string $route, array $parameters) {
103 103
             $parameters['_third'] = $parameters['id'];
104 104
             $parameters['id'] *= 2;
105 105
 
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
          *            route
116 116
          * @psalm-param array{id: int} $parameters parameters
117 117
          */
118
-        function (string $route, array $parameters) {
118
+        function(string $route, array $parameters) {
119 119
             $parameters['_first'] = $parameters['id'];
120 120
             $parameters['id'] *= 2;
121 121
 
Please login to merge, or discard this patch.
Mezon/Router/Tests/Base/UniversalRouteTestClass.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-declare(strict_types = 1);
2
+declare(strict_types=1);
3 3
 namespace Mezon\Router\Tests\Base;
4 4
 
5 5
 use Mezon\Router\Tests\Utils;
@@ -54,23 +54,23 @@  discard block
 block discarded – undo
54 54
      */
55 55
     public function universalRouteDataProvider(): array
56 56
     {
57
-        $setup = function (): array {
57
+        $setup = function(): array {
58 58
             return [
59 59
                 [
60 60
                     '/hello/[s:name]/',
61
-                    function (): string {
61
+                    function(): string {
62 62
                         return 'hello';
63 63
                     }
64 64
                 ],
65 65
                 [
66 66
                     '*',
67
-                    function (): string {
67
+                    function(): string {
68 68
                         return 'universal';
69 69
                     }
70 70
                 ],
71 71
                 [
72 72
                     '/bye/[s:name]/',
73
-                    function (): string {
73
+                    function(): string {
74 74
                         return 'bye';
75 75
                     }
76 76
                 ]
Please login to merge, or discard this patch.