@@ -1,5 +1,5 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 | } |
@@ -1,5 +1,5 @@ discard block |
||
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 |
||
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 | } |
@@ -1,5 +1,5 @@ discard block |
||
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 |
||
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 |
@@ -1,5 +1,5 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
@@ -1,5 +1,5 @@ discard block |
||
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; |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | $router = $this->getRouter(); |
91 | 91 | $router->addRoute('/trash/', [ |
92 | 92 | $this, |
93 | - function (): void {} |
|
93 | + function(): void {} |
|
94 | 94 | ]); |
95 | 95 | |
96 | 96 | // assertions |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | public function testArrayRoutes(): void |
107 | 107 | { |
108 | 108 | $router = $this->getRouter(); |
109 | - $router->addRoute('/part1/part2/', function (string $route): string { |
|
109 | + $router->addRoute('/part1/part2/', function(string $route): string { |
|
110 | 110 | return $route; |
111 | 111 | }, 'GET'); |
112 | 112 | |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | $this->setRequestUri('/catalog/item/'); |
128 | 128 | |
129 | 129 | $router = $this->getRouter(); |
130 | - $router->addRoute('/catalog/item/', function (string $route): string { |
|
130 | + $router->addRoute('/catalog/item/', function(string $route): string { |
|
131 | 131 | return $route; |
132 | 132 | }, 'GET'); |
133 | 133 | |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | $this->setRequestUri('/'); |
148 | 148 | |
149 | 149 | $router = $this->getRouter(); |
150 | - $router->addRoute('/index/', function (string $route): string { |
|
150 | + $router->addRoute('/index/', function(string $route): string { |
|
151 | 151 | return $route; |
152 | 152 | }, 'GET'); |
153 | 153 | |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | $this->setRequestUri('/'); |
169 | 169 | |
170 | 170 | $router = $this->getRouter(); |
171 | - $router->addRoute('/index/', function (string $route): string { |
|
171 | + $router->addRoute('/index/', function(string $route): string { |
|
172 | 172 | return $route; |
173 | 173 | }, [ |
174 | 174 | 'GET', |
@@ -292,7 +292,7 @@ discard block |
||
292 | 292 | { |
293 | 293 | // setup |
294 | 294 | $router = $this->getRouter(); |
295 | - $router->addRoute('/route-to-clear/', function () use ($method) { |
|
295 | + $router->addRoute('/route-to-clear/', function() use ($method) { |
|
296 | 296 | return $method; |
297 | 297 | }, $method); |
298 | 298 | |
@@ -315,7 +315,7 @@ discard block |
||
315 | 315 | $_SERVER['REQUEST_METHOD'] = $method; |
316 | 316 | |
317 | 317 | $router = $this->getRouter(); |
318 | - $router->addRoute('/catalog/', function (string $route): string { |
|
318 | + $router->addRoute('/catalog/', function(string $route): string { |
|
319 | 319 | return $route; |
320 | 320 | }, $method); |
321 | 321 | |
@@ -332,10 +332,10 @@ discard block |
||
332 | 332 | { |
333 | 333 | // setup |
334 | 334 | $router = $this->getRouter(); |
335 | - $router->addRoute('/searching-static-route/', function (string $route) { |
|
335 | + $router->addRoute('/searching-static-route/', function(string $route) { |
|
336 | 336 | return $route; |
337 | 337 | }); |
338 | - $router->addRoute('/searching-param-route/[i:id]/', function (string $route) { |
|
338 | + $router->addRoute('/searching-param-route/[i:id]/', function(string $route) { |
|
339 | 339 | return $route; |
340 | 340 | }); |
341 | 341 |
@@ -1,5 +1,5 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
@@ -1,5 +1,5 @@ discard block |
||
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 |
||
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 | ] |
@@ -1,5 +1,5 @@ |
||
1 | 1 | <?php |
2 | -declare(strict_types = 1); |
|
2 | +declare(strict_types=1); |
|
3 | 3 | namespace Mezon\Router\Tests\Base; |
4 | 4 | |
5 | 5 | class RouterUnitTestUtils |
@@ -1,5 +1,5 @@ |
||
1 | 1 | <?php |
2 | -declare(strict_types = 1); |
|
2 | +declare(strict_types=1); |
|
3 | 3 | namespace Mezon\Router\Tests\Base; |
4 | 4 | |
5 | 5 | /** |