Skip to content

Commit a99835b

Browse files
committed
fixed CS
1 parent c0bc2cc commit a99835b

File tree

4 files changed

+296
-296
lines changed

4 files changed

+296
-296
lines changed

Generator/UrlGenerator.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class UrlGenerator implements UrlGeneratorInterface, ConfigurableRequirementsInt
4747
* "?" and "#" (would be interpreted wrongly as query and fragment identifier),
4848
* "'" and """ (are used as delimiters in HTML).
4949
*/
50-
protected $decodedChars = array(
50+
protected $decodedChars = [
5151
// the slash can be used to designate a hierarchical structure and we want allow using it with this meaning
5252
// some webservers don't allow the slash in encoded form in the path for security reasons anyway
5353
// see http://stackoverflow.com/questions/4069002/http-400-if-2f-part-of-get-url-in-jboss
@@ -65,7 +65,7 @@ class UrlGenerator implements UrlGeneratorInterface, ConfigurableRequirementsInt
6565
'%21' => '!',
6666
'%2A' => '*',
6767
'%7C' => '|',
68-
);
68+
];
6969

7070
public function __construct(RouteCollection $routes, RequestContext $context, LoggerInterface $logger = null, string $defaultLocale = null)
7171
{
@@ -110,7 +110,7 @@ public function isStrictRequirements()
110110
/**
111111
* {@inheritdoc}
112112
*/
113-
public function generate($name, $parameters = array(), $referenceType = self::ABSOLUTE_PATH)
113+
public function generate($name, $parameters = [], $referenceType = self::ABSOLUTE_PATH)
114114
{
115115
$route = null;
116116
$locale = $parameters['_locale']
@@ -141,7 +141,7 @@ public function generate($name, $parameters = array(), $referenceType = self::AB
141141
* @throws InvalidParameterException When a parameter value for a placeholder is not correct because
142142
* it does not match the requirement
143143
*/
144-
protected function doGenerate($variables, $defaults, $requirements, $tokens, $parameters, $name, $referenceType, $hostTokens, array $requiredSchemes = array())
144+
protected function doGenerate($variables, $defaults, $requirements, $tokens, $parameters, $name, $referenceType, $hostTokens, array $requiredSchemes = [])
145145
{
146146
$variables = array_flip($variables);
147147
$mergedParams = array_replace($defaults, $this->context->getParameters(), $parameters);
@@ -165,11 +165,11 @@ protected function doGenerate($variables, $defaults, $requirements, $tokens, $pa
165165
// check requirement
166166
if (null !== $this->strictRequirements && !preg_match('#^'.$token[2].'$#'.(empty($token[4]) ? '' : 'u'), $mergedParams[$varName])) {
167167
if ($this->strictRequirements) {
168-
throw new InvalidParameterException(strtr($message, array('{parameter}' => $varName, '{route}' => $name, '{expected}' => $token[2], '{given}' => $mergedParams[$varName])));
168+
throw new InvalidParameterException(strtr($message, ['{parameter}' => $varName, '{route}' => $name, '{expected}' => $token[2], '{given}' => $mergedParams[$varName]]));
169169
}
170170

171171
if ($this->logger) {
172-
$this->logger->error($message, array('parameter' => $varName, 'route' => $name, 'expected' => $token[2], 'given' => $mergedParams[$varName]));
172+
$this->logger->error($message, ['parameter' => $varName, 'route' => $name, 'expected' => $token[2], 'given' => $mergedParams[$varName]]);
173173
}
174174

175175
return;
@@ -195,7 +195,7 @@ protected function doGenerate($variables, $defaults, $requirements, $tokens, $pa
195195
// the path segments "." and ".." are interpreted as relative reference when resolving a URI; see http://tools.ietf.org/html/rfc3986#section-3.3
196196
// so we need to encode them as they are not used for this purpose here
197197
// otherwise we would generate a URI that, when followed by a user agent (e.g. browser), does not match this route
198-
$url = strtr($url, array('/../' => '/%2E%2E/', '/./' => '/%2E/'));
198+
$url = strtr($url, ['/../' => '/%2E%2E/', '/./' => '/%2E/']);
199199
if ('/..' === substr($url, -3)) {
200200
$url = substr($url, 0, -2).'%2E%2E';
201201
} elseif ('/.' === substr($url, -2)) {
@@ -219,11 +219,11 @@ protected function doGenerate($variables, $defaults, $requirements, $tokens, $pa
219219
if ('variable' === $token[0]) {
220220
if (null !== $this->strictRequirements && !preg_match('#^'.$token[2].'$#i'.(empty($token[4]) ? '' : 'u'), $mergedParams[$token[3]])) {
221221
if ($this->strictRequirements) {
222-
throw new InvalidParameterException(strtr($message, array('{parameter}' => $token[3], '{route}' => $name, '{expected}' => $token[2], '{given}' => $mergedParams[$token[3]])));
222+
throw new InvalidParameterException(strtr($message, ['{parameter}' => $token[3], '{route}' => $name, '{expected}' => $token[2], '{given}' => $mergedParams[$token[3]]]));
223223
}
224224

225225
if ($this->logger) {
226-
$this->logger->error($message, array('parameter' => $token[3], 'route' => $name, 'expected' => $token[2], 'given' => $mergedParams[$token[3]]));
226+
$this->logger->error($message, ['parameter' => $token[3], 'route' => $name, 'expected' => $token[2], 'given' => $mergedParams[$token[3]]]);
227227
}
228228

229229
return;
@@ -277,11 +277,11 @@ protected function doGenerate($variables, $defaults, $requirements, $tokens, $pa
277277
if ($extra && $query = http_build_query($extra, '', '&', PHP_QUERY_RFC3986)) {
278278
// "/" and "?" can be left decoded for better user experience, see
279279
// http://tools.ietf.org/html/rfc3986#section-3.4
280-
$url .= '?'.strtr($query, array('%2F' => '/'));
280+
$url .= '?'.strtr($query, ['%2F' => '/']);
281281
}
282282

283283
if ('' !== $fragment) {
284-
$url .= '#'.strtr(rawurlencode($fragment), array('%2F' => '/', '%3F' => '?'));
284+
$url .= '#'.strtr(rawurlencode($fragment), ['%2F' => '/', '%3F' => '?']);
285285
}
286286

287287
return $url;

RouteCompiler.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,10 @@ class RouteCompiler implements RouteCompilerInterface
4646
*/
4747
public static function compile(Route $route)
4848
{
49-
$hostVariables = array();
50-
$variables = array();
49+
$hostVariables = [];
50+
$variables = [];
5151
$hostRegex = null;
52-
$hostTokens = array();
52+
$hostTokens = [];
5353

5454
if ('' !== $host = $route->getHost()) {
5555
$result = self::compilePattern($route, $host, true);
@@ -94,9 +94,9 @@ public static function compile(Route $route)
9494

9595
private static function compilePattern(Route $route, $pattern, $isHost)
9696
{
97-
$tokens = array();
98-
$variables = array();
99-
$matches = array();
97+
$tokens = [];
98+
$variables = [];
99+
$matches = [];
100100
$pos = 0;
101101
$defaultSeparator = $isHost ? '.' : '/';
102102
$useUtf8 = preg_match('//u', $pattern);
@@ -142,9 +142,9 @@ private static function compilePattern(Route $route, $pattern, $isHost)
142142
}
143143

144144
if ($isSeparator && $precedingText !== $precedingChar) {
145-
$tokens[] = array('text', substr($precedingText, 0, -\strlen($precedingChar)));
145+
$tokens[] = ['text', substr($precedingText, 0, -\strlen($precedingChar))];
146146
} elseif (!$isSeparator && \strlen($precedingText) > 0) {
147-
$tokens[] = array('text', $precedingText);
147+
$tokens[] = ['text', $precedingText];
148148
}
149149

150150
$regexp = $route->getRequirement($varName);
@@ -183,15 +183,15 @@ private static function compilePattern(Route $route, $pattern, $isHost)
183183
$regexp = self::transformCapturingGroupsToNonCapturings($regexp);
184184
}
185185

186-
$tokens[] = array('variable', $isSeparator ? $precedingChar : '', $regexp, $varName);
186+
$tokens[] = ['variable', $isSeparator ? $precedingChar : '', $regexp, $varName];
187187
if ('!' === $varName[0]) {
188188
$varName = substr($varName, 1);
189189
}
190190
$variables[] = $varName;
191191
}
192192

193193
if ($pos < \strlen($pattern)) {
194-
$tokens[] = array('text', substr($pattern, $pos));
194+
$tokens[] = ['text', substr($pattern, $pos)];
195195
}
196196

197197
// find the first optional token
@@ -224,12 +224,12 @@ private static function compilePattern(Route $route, $pattern, $isHost)
224224
}
225225
}
226226

227-
return array(
227+
return [
228228
'staticPrefix' => self::determineStaticPrefix($route, $tokens),
229229
'regex' => $regexp,
230230
'tokens' => array_reverse($tokens),
231231
'variables' => $variables,
232-
);
232+
];
233233
}
234234

235235
/**

0 commit comments

Comments
 (0)