Skip to content

Commit 76f0eb1

Browse files
committed
fixed short array CS in comments
1 parent abc23a3 commit 76f0eb1

File tree

4 files changed

+12
-12
lines changed

4 files changed

+12
-12
lines changed

CHANGELOG.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,15 @@ CHANGELOG
4141
Before:
4242

4343
```php
44-
$router->generate('blog_show', array('slug' => 'my-blog-post'), true);
44+
$router->generate('blog_show', ['slug' => 'my-blog-post'], true);
4545
```
4646

4747
After:
4848

4949
```php
5050
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
5151

52-
$router->generate('blog_show', array('slug' => 'my-blog-post'), UrlGeneratorInterface::ABSOLUTE_URL);
52+
$router->generate('blog_show', ['slug' => 'my-blog-post'], UrlGeneratorInterface::ABSOLUTE_URL);
5353
```
5454

5555
2.5.0
@@ -114,7 +114,7 @@ CHANGELOG
114114
```php
115115
$route = new Route();
116116
$route->setPath('/article/{id}');
117-
$route->setMethods(array('POST', 'PUT'));
117+
$route->setMethods(['POST', 'PUT']);
118118
$route->setSchemes('https');
119119
```
120120

@@ -169,10 +169,10 @@ CHANGELOG
169169
used with a single parameter. The other params `$prefix`, `$default`, `$requirements` and `$options`
170170
will still work, but have been deprecated. The `addPrefix` method should be used for this
171171
use-case instead.
172-
Before: `$parentCollection->addCollection($collection, '/prefix', array(...), array(...))`
172+
Before: `$parentCollection->addCollection($collection, '/prefix', [...], [...])`
173173
After:
174174
```php
175-
$collection->addPrefix('/prefix', array(...), array(...));
175+
$collection->addPrefix('/prefix', [...], [...]);
176176
$parentCollection->addCollection($collection);
177177
```
178178
* added support for the method default argument values when defining a @Route
@@ -197,7 +197,7 @@ CHANGELOG
197197
(only relevant if you implemented your own RouteCompiler).
198198
* Added possibility to generate relative paths and network paths in the UrlGenerator, e.g.
199199
"../parent-file" and "//example.com/dir/file". The third parameter in
200-
`UrlGeneratorInterface::generate($name, $parameters = array(), $referenceType = self::ABSOLUTE_PATH)`
200+
`UrlGeneratorInterface::generate($name, $parameters = [], $referenceType = self::ABSOLUTE_PATH)`
201201
now accepts more values and you should use the constants defined in `UrlGeneratorInterface` for
202202
claritiy. The old method calls with a Boolean parameter will continue to work because they
203203
equal the signature using the constants.

Generator/Dumper/PhpGeneratorDumper.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public function __construct(RequestContext \$context, LoggerInterface \$logger =
7676
*/
7777
private function generateDeclaredRoutes()
7878
{
79-
$routes = "array(\n";
79+
$routes = "[\n";
8080
foreach ($this->getRoutes()->all() as $name => $route) {
8181
$compiledRoute = $route->compile();
8282

@@ -90,7 +90,7 @@ private function generateDeclaredRoutes()
9090

9191
$routes .= sprintf(" '%s' => %s,\n", $name, str_replace("\n", '', var_export($properties, true)));
9292
}
93-
$routes .= ' )';
93+
$routes .= ' ]';
9494

9595
return $routes;
9696
}
@@ -103,7 +103,7 @@ private function generateDeclaredRoutes()
103103
private function generateGenerateMethod()
104104
{
105105
return <<<'EOF'
106-
public function generate($name, $parameters = array(), $referenceType = self::ABSOLUTE_PATH)
106+
public function generate($name, $parameters = [], $referenceType = self::ABSOLUTE_PATH)
107107
{
108108
if (!isset(self::$declaredRoutes[$name])) {
109109
throw new RouteNotFoundException(sprintf('Unable to generate a URL for the named route "%s" as such route does not exist.', $name));

RouteCompiler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ private static function compilePattern(Route $route, $pattern, $isHost)
154154
// Find the next static character after the variable that functions as a separator. By default, this separator and '/'
155155
// are disallowed for the variable. This default requirement makes sure that optional variables can be matched at all
156156
// and that the generating-matching-combination of URLs unambiguous, i.e. the params used for generating the URL are
157-
// the same that will be matched. Example: new Route('/{page}.{_format}', array('_format' => 'html'))
157+
// the same that will be matched. Example: new Route('/{page}.{_format}', ['_format' => 'html'])
158158
// If {page} would also match the separating dot, {_format} would never match as {page} will eagerly consume everything.
159159
// Also even if {_format} was not optional the requirement prevents that {page} matches something that was originally
160160
// part of {_format} when generating the URL, e.g. _format = 'mobile.html'.

Tests/RouteTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ public function testHost()
153153
public function testScheme()
154154
{
155155
$route = new Route('/');
156-
$this->assertEquals([], $route->getSchemes(), 'schemes is initialized with array()');
156+
$this->assertEquals([], $route->getSchemes(), 'schemes is initialized with []');
157157
$this->assertFalse($route->hasScheme('http'));
158158
$route->setSchemes('hTTp');
159159
$this->assertEquals(['http'], $route->getSchemes(), '->setSchemes() accepts a single scheme string and lowercases it');
@@ -168,7 +168,7 @@ public function testScheme()
168168
public function testMethod()
169169
{
170170
$route = new Route('/');
171-
$this->assertEquals([], $route->getMethods(), 'methods is initialized with array()');
171+
$this->assertEquals([], $route->getMethods(), 'methods is initialized with []');
172172
$route->setMethods('gEt');
173173
$this->assertEquals(['GET'], $route->getMethods(), '->setMethods() accepts a single method string and uppercases it');
174174
$route->setMethods(['gEt', 'PosT']);

0 commit comments

Comments
 (0)