Skip to content

Commit abc23a3

Browse files
committed
fixed CS in generated files
1 parent 67146f6 commit abc23a3

File tree

9 files changed

+226
-226
lines changed

9 files changed

+226
-226
lines changed

Matcher/Dumper/PhpMatcherDumper.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ private function generateMatchMethod($supportsRedirections)
9898
return <<<EOF
9999
public function match(\$rawPathinfo)
100100
{
101-
\$allow = array();
101+
\$allow = [];
102102
\$pathinfo = rawurldecode(\$rawPathinfo);
103103
\$trimmedPathinfo = rtrim(\$pathinfo, '/');
104104
\$context = \$this->context;
@@ -290,7 +290,7 @@ private function compileRoute(Route $route, $name, $supportsRedirections, $paren
290290
if ($matches) {
291291
$vars[] = '$matches';
292292
}
293-
$vars[] = "array('_route' => '$name')";
293+
$vars[] = "['_route' => '$name']";
294294

295295
$code .= sprintf(
296296
" \$ret = \$this->mergeDefaults(array_replace(%s), %s);\n",
@@ -300,7 +300,7 @@ private function compileRoute(Route $route, $name, $supportsRedirections, $paren
300300
} elseif ($route->getDefaults()) {
301301
$code .= sprintf(" \$ret = %s;\n", str_replace("\n", '', var_export(array_replace($route->getDefaults(), ['_route' => $name]), true)));
302302
} else {
303-
$code .= sprintf(" \$ret = array('_route' => '%s');\n", $name);
303+
$code .= sprintf(" \$ret = ['_route' => '%s'];\n", $name);
304304
}
305305

306306
if ($hasTrailingSlash) {
@@ -331,9 +331,9 @@ private function compileRoute(Route $route, $name, $supportsRedirections, $paren
331331
$code .= <<<EOF
332332
\$requiredSchemes = $schemes;
333333
\$hasRequiredScheme = isset(\$requiredSchemes[\$context->getScheme()]);
334-
if (!in_array($methodVariable, array('$methods'))) {
334+
if (!in_array($methodVariable, ['$methods'])) {
335335
if (\$hasRequiredScheme) {
336-
\$allow = array_merge(\$allow, array('$methods'));
336+
\$allow = array_merge(\$allow, ['$methods']);
337337
}
338338
goto $gotoname;
339339
}
@@ -363,8 +363,8 @@ private function compileRoute(Route $route, $name, $supportsRedirections, $paren
363363
}
364364
} elseif ($methods) {
365365
$code .= <<<EOF
366-
if (!in_array($methodVariable, array('$methods'))) {
367-
\$allow = array_merge(\$allow, array('$methods'));
366+
if (!in_array($methodVariable, ['$methods'])) {
367+
\$allow = array_merge(\$allow, ['$methods']);
368368
goto $gotoname;
369369
}
370370

Tests/Fixtures/dumper/url_matcher0.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public function __construct(RequestContext $context)
1717

1818
public function match($rawPathinfo)
1919
{
20-
$allow = array();
20+
$allow = [];
2121
$pathinfo = rawurldecode($rawPathinfo);
2222
$trimmedPathinfo = rtrim($pathinfo, '/');
2323
$context = $this->context;

Tests/Fixtures/dumper/url_matcher1.php

Lines changed: 48 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public function __construct(RequestContext $context)
1717

1818
public function match($rawPathinfo)
1919
{
20-
$allow = array();
20+
$allow = [];
2121
$pathinfo = rawurldecode($rawPathinfo);
2222
$trimmedPathinfo = rtrim($pathinfo, '/');
2323
$context = $this->context;
@@ -31,7 +31,7 @@ public function match($rawPathinfo)
3131
if (0 === strpos($pathinfo, '/foo')) {
3232
// foo
3333
if (preg_match('#^/foo/(?P<bar>baz|symfony)$#sD', $pathinfo, $matches)) {
34-
return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo')), array ( 'def' => 'test',));
34+
return $this->mergeDefaults(array_replace($matches, ['_route' => 'foo']), array ( 'def' => 'test',));
3535
}
3636

3737
// foofoo
@@ -44,9 +44,9 @@ public function match($rawPathinfo)
4444
elseif (0 === strpos($pathinfo, '/bar')) {
4545
// bar
4646
if (preg_match('#^/bar/(?P<foo>[^/]++)$#sD', $pathinfo, $matches)) {
47-
$ret = $this->mergeDefaults(array_replace($matches, array('_route' => 'bar')), array ());
48-
if (!in_array($canonicalMethod, array('GET', 'HEAD'))) {
49-
$allow = array_merge($allow, array('GET', 'HEAD'));
47+
$ret = $this->mergeDefaults(array_replace($matches, ['_route' => 'bar']), array ());
48+
if (!in_array($canonicalMethod, ['GET', 'HEAD'])) {
49+
$allow = array_merge($allow, ['GET', 'HEAD']);
5050
goto not_bar;
5151
}
5252

@@ -56,9 +56,9 @@ public function match($rawPathinfo)
5656

5757
// barhead
5858
if (0 === strpos($pathinfo, '/barhead') && preg_match('#^/barhead/(?P<foo>[^/]++)$#sD', $pathinfo, $matches)) {
59-
$ret = $this->mergeDefaults(array_replace($matches, array('_route' => 'barhead')), array ());
60-
if (!in_array($canonicalMethod, array('GET'))) {
61-
$allow = array_merge($allow, array('GET'));
59+
$ret = $this->mergeDefaults(array_replace($matches, ['_route' => 'barhead']), array ());
60+
if (!in_array($canonicalMethod, ['GET'])) {
61+
$allow = array_merge($allow, ['GET']);
6262
goto not_barhead;
6363
}
6464

@@ -72,31 +72,31 @@ public function match($rawPathinfo)
7272
if (0 === strpos($pathinfo, '/test/baz')) {
7373
// baz
7474
if ('/test/baz' === $pathinfo) {
75-
return array('_route' => 'baz');
75+
return ['_route' => 'baz'];
7676
}
7777

7878
// baz2
7979
if ('/test/baz.html' === $pathinfo) {
80-
return array('_route' => 'baz2');
80+
return ['_route' => 'baz2'];
8181
}
8282

8383
// baz3
8484
if ('/test/baz3/' === $pathinfo) {
85-
return array('_route' => 'baz3');
85+
return ['_route' => 'baz3'];
8686
}
8787

8888
}
8989

9090
// baz4
9191
if (preg_match('#^/test/(?P<foo>[^/]++)/$#sD', $pathinfo, $matches)) {
92-
return $this->mergeDefaults(array_replace($matches, array('_route' => 'baz4')), array ());
92+
return $this->mergeDefaults(array_replace($matches, ['_route' => 'baz4']), array ());
9393
}
9494

9595
// baz5
9696
if (preg_match('#^/test/(?P<foo>[^/]++)/$#sD', $pathinfo, $matches)) {
97-
$ret = $this->mergeDefaults(array_replace($matches, array('_route' => 'baz5')), array ());
98-
if (!in_array($requestMethod, array('POST'))) {
99-
$allow = array_merge($allow, array('POST'));
97+
$ret = $this->mergeDefaults(array_replace($matches, ['_route' => 'baz5']), array ());
98+
if (!in_array($requestMethod, ['POST'])) {
99+
$allow = array_merge($allow, ['POST']);
100100
goto not_baz5;
101101
}
102102

@@ -106,9 +106,9 @@ public function match($rawPathinfo)
106106

107107
// baz.baz6
108108
if (preg_match('#^/test/(?P<foo>[^/]++)/$#sD', $pathinfo, $matches)) {
109-
$ret = $this->mergeDefaults(array_replace($matches, array('_route' => 'baz.baz6')), array ());
110-
if (!in_array($requestMethod, array('PUT'))) {
111-
$allow = array_merge($allow, array('PUT'));
109+
$ret = $this->mergeDefaults(array_replace($matches, ['_route' => 'baz.baz6']), array ());
110+
if (!in_array($requestMethod, ['PUT'])) {
111+
$allow = array_merge($allow, ['PUT']);
112112
goto not_bazbaz6;
113113
}
114114

@@ -120,42 +120,42 @@ public function match($rawPathinfo)
120120

121121
// quoter
122122
if (preg_match('#^/(?P<quoter>[\']+)$#sD', $pathinfo, $matches)) {
123-
return $this->mergeDefaults(array_replace($matches, array('_route' => 'quoter')), array ());
123+
return $this->mergeDefaults(array_replace($matches, ['_route' => 'quoter']), array ());
124124
}
125125

126126
// space
127127
if ('/spa ce' === $pathinfo) {
128-
return array('_route' => 'space');
128+
return ['_route' => 'space'];
129129
}
130130

131131
if (0 === strpos($pathinfo, '/a')) {
132132
if (0 === strpos($pathinfo, '/a/b\'b')) {
133133
// foo1
134134
if (preg_match('#^/a/b\'b/(?P<foo>[^/]++)$#sD', $pathinfo, $matches)) {
135-
return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo1')), array ());
135+
return $this->mergeDefaults(array_replace($matches, ['_route' => 'foo1']), array ());
136136
}
137137

138138
// bar1
139139
if (preg_match('#^/a/b\'b/(?P<bar>[^/]++)$#sD', $pathinfo, $matches)) {
140-
return $this->mergeDefaults(array_replace($matches, array('_route' => 'bar1')), array ());
140+
return $this->mergeDefaults(array_replace($matches, ['_route' => 'bar1']), array ());
141141
}
142142

143143
}
144144

145145
// overridden
146146
if (preg_match('#^/a/(?P<var>.*)$#sD', $pathinfo, $matches)) {
147-
return $this->mergeDefaults(array_replace($matches, array('_route' => 'overridden')), array ());
147+
return $this->mergeDefaults(array_replace($matches, ['_route' => 'overridden']), array ());
148148
}
149149

150150
if (0 === strpos($pathinfo, '/a/b\'b')) {
151151
// foo2
152152
if (preg_match('#^/a/b\'b/(?P<foo1>[^/]++)$#sD', $pathinfo, $matches)) {
153-
return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo2')), array ());
153+
return $this->mergeDefaults(array_replace($matches, ['_route' => 'foo2']), array ());
154154
}
155155

156156
// bar2
157157
if (preg_match('#^/a/b\'b/(?P<bar1>[^/]++)$#sD', $pathinfo, $matches)) {
158-
return $this->mergeDefaults(array_replace($matches, array('_route' => 'bar2')), array ());
158+
return $this->mergeDefaults(array_replace($matches, ['_route' => 'bar2']), array ());
159159
}
160160

161161
}
@@ -165,40 +165,40 @@ public function match($rawPathinfo)
165165
elseif (0 === strpos($pathinfo, '/multi')) {
166166
// helloWorld
167167
if (0 === strpos($pathinfo, '/multi/hello') && preg_match('#^/multi/hello(?:/(?P<who>[^/]++))?$#sD', $pathinfo, $matches)) {
168-
return $this->mergeDefaults(array_replace($matches, array('_route' => 'helloWorld')), array ( 'who' => 'World!',));
168+
return $this->mergeDefaults(array_replace($matches, ['_route' => 'helloWorld']), array ( 'who' => 'World!',));
169169
}
170170

171171
// hey
172172
if ('/multi/hey/' === $pathinfo) {
173-
return array('_route' => 'hey');
173+
return ['_route' => 'hey'];
174174
}
175175

176176
// overridden2
177177
if ('/multi/new' === $pathinfo) {
178-
return array('_route' => 'overridden2');
178+
return ['_route' => 'overridden2'];
179179
}
180180

181181
}
182182

183183
// foo3
184184
if (preg_match('#^/(?P<_locale>[^/]++)/b/(?P<foo>[^/]++)$#sD', $pathinfo, $matches)) {
185-
return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo3')), array ());
185+
return $this->mergeDefaults(array_replace($matches, ['_route' => 'foo3']), array ());
186186
}
187187

188188
// bar3
189189
if (preg_match('#^/(?P<_locale>[^/]++)/b/(?P<bar>[^/]++)$#sD', $pathinfo, $matches)) {
190-
return $this->mergeDefaults(array_replace($matches, array('_route' => 'bar3')), array ());
190+
return $this->mergeDefaults(array_replace($matches, ['_route' => 'bar3']), array ());
191191
}
192192

193193
if (0 === strpos($pathinfo, '/aba')) {
194194
// ababa
195195
if ('/ababa' === $pathinfo) {
196-
return array('_route' => 'ababa');
196+
return ['_route' => 'ababa'];
197197
}
198198

199199
// foo4
200200
if (preg_match('#^/aba/(?P<foo>[^/]++)$#sD', $pathinfo, $matches)) {
201-
return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo4')), array ());
201+
return $this->mergeDefaults(array_replace($matches, ['_route' => 'foo4']), array ());
202202
}
203203

204204
}
@@ -208,65 +208,65 @@ public function match($rawPathinfo)
208208
if (preg_match('#^a\\.example\\.com$#sDi', $host, $hostMatches)) {
209209
// route1
210210
if ('/route1' === $pathinfo) {
211-
return array('_route' => 'route1');
211+
return ['_route' => 'route1'];
212212
}
213213

214214
// route2
215215
if ('/c2/route2' === $pathinfo) {
216-
return array('_route' => 'route2');
216+
return ['_route' => 'route2'];
217217
}
218218

219219
}
220220

221221
if (preg_match('#^b\\.example\\.com$#sDi', $host, $hostMatches)) {
222222
// route3
223223
if ('/c2/route3' === $pathinfo) {
224-
return array('_route' => 'route3');
224+
return ['_route' => 'route3'];
225225
}
226226

227227
}
228228

229229
if (preg_match('#^a\\.example\\.com$#sDi', $host, $hostMatches)) {
230230
// route4
231231
if ('/route4' === $pathinfo) {
232-
return array('_route' => 'route4');
232+
return ['_route' => 'route4'];
233233
}
234234

235235
}
236236

237237
if (preg_match('#^c\\.example\\.com$#sDi', $host, $hostMatches)) {
238238
// route5
239239
if ('/route5' === $pathinfo) {
240-
return array('_route' => 'route5');
240+
return ['_route' => 'route5'];
241241
}
242242

243243
}
244244

245245
// route6
246246
if ('/route6' === $pathinfo) {
247-
return array('_route' => 'route6');
247+
return ['_route' => 'route6'];
248248
}
249249

250250
if (preg_match('#^(?P<var1>[^\\.]++)\\.example\\.com$#sDi', $host, $hostMatches)) {
251251
if (0 === strpos($pathinfo, '/route1')) {
252252
// route11
253253
if ('/route11' === $pathinfo) {
254-
return $this->mergeDefaults(array_replace($hostMatches, array('_route' => 'route11')), array ());
254+
return $this->mergeDefaults(array_replace($hostMatches, ['_route' => 'route11']), array ());
255255
}
256256

257257
// route12
258258
if ('/route12' === $pathinfo) {
259-
return $this->mergeDefaults(array_replace($hostMatches, array('_route' => 'route12')), array ( 'var1' => 'val',));
259+
return $this->mergeDefaults(array_replace($hostMatches, ['_route' => 'route12']), array ( 'var1' => 'val',));
260260
}
261261

262262
// route13
263263
if (0 === strpos($pathinfo, '/route13') && preg_match('#^/route13/(?P<name>[^/]++)$#sD', $pathinfo, $matches)) {
264-
return $this->mergeDefaults(array_replace($hostMatches, $matches, array('_route' => 'route13')), array ());
264+
return $this->mergeDefaults(array_replace($hostMatches, $matches, ['_route' => 'route13']), array ());
265265
}
266266

267267
// route14
268268
if (0 === strpos($pathinfo, '/route14') && preg_match('#^/route14/(?P<name>[^/]++)$#sD', $pathinfo, $matches)) {
269-
return $this->mergeDefaults(array_replace($hostMatches, $matches, array('_route' => 'route14')), array ( 'var1' => 'val',));
269+
return $this->mergeDefaults(array_replace($hostMatches, $matches, ['_route' => 'route14']), array ( 'var1' => 'val',));
270270
}
271271

272272
}
@@ -276,35 +276,35 @@ public function match($rawPathinfo)
276276
if (preg_match('#^c\\.example\\.com$#sDi', $host, $hostMatches)) {
277277
// route15
278278
if (0 === strpos($pathinfo, '/route15') && preg_match('#^/route15/(?P<name>[^/]++)$#sD', $pathinfo, $matches)) {
279-
return $this->mergeDefaults(array_replace($matches, array('_route' => 'route15')), array ());
279+
return $this->mergeDefaults(array_replace($matches, ['_route' => 'route15']), array ());
280280
}
281281

282282
}
283283

284284
// route16
285285
if (0 === strpos($pathinfo, '/route16') && preg_match('#^/route16/(?P<name>[^/]++)$#sD', $pathinfo, $matches)) {
286-
return $this->mergeDefaults(array_replace($matches, array('_route' => 'route16')), array ( 'var1' => 'val',));
286+
return $this->mergeDefaults(array_replace($matches, ['_route' => 'route16']), array ( 'var1' => 'val',));
287287
}
288288

289289
// route17
290290
if ('/route17' === $pathinfo) {
291-
return array('_route' => 'route17');
291+
return ['_route' => 'route17'];
292292
}
293293

294294
// a
295295
if ('/a/a...' === $pathinfo) {
296-
return array('_route' => 'a');
296+
return ['_route' => 'a'];
297297
}
298298

299299
if (0 === strpos($pathinfo, '/a/b')) {
300300
// b
301301
if (preg_match('#^/a/b/(?P<var>[^/]++)$#sD', $pathinfo, $matches)) {
302-
return $this->mergeDefaults(array_replace($matches, array('_route' => 'b')), array ());
302+
return $this->mergeDefaults(array_replace($matches, ['_route' => 'b']), array ());
303303
}
304304

305305
// c
306306
if (0 === strpos($pathinfo, '/a/b/c') && preg_match('#^/a/b/c/(?P<var>[^/]++)$#sD', $pathinfo, $matches)) {
307-
return $this->mergeDefaults(array_replace($matches, array('_route' => 'c')), array ());
307+
return $this->mergeDefaults(array_replace($matches, ['_route' => 'c']), array ());
308308
}
309309

310310
}

0 commit comments

Comments
 (0)