Skip to content

Commit ca35103

Browse files
committed
Fixed code style
1 parent 03586f0 commit ca35103

File tree

5 files changed

+397
-397
lines changed

5 files changed

+397
-397
lines changed

src/Symfony/Component/Routing/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);
@@ -164,11 +164,11 @@ protected function doGenerate($variables, $defaults, $requirements, $tokens, $pa
164164
// check requirement
165165
if (null !== $this->strictRequirements && !preg_match('#^'.$token[2].'$#'.(empty($token[4]) ? '' : 'u'), $mergedParams[$varName])) {
166166
if ($this->strictRequirements) {
167-
throw new InvalidParameterException(strtr($message, array('{parameter}' => $varName, '{route}' => $name, '{expected}' => $token[2], '{given}' => $mergedParams[$varName])));
167+
throw new InvalidParameterException(strtr($message, ['{parameter}' => $varName, '{route}' => $name, '{expected}' => $token[2], '{given}' => $mergedParams[$varName]]));
168168
}
169169

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

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

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

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

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

286286
return $url;

src/Symfony/Component/Routing/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);
@@ -143,9 +143,9 @@ private static function compilePattern(Route $route, $pattern, $isHost)
143143
}
144144

145145
if ($isSeparator && $precedingText !== $precedingChar) {
146-
$tokens[] = array('text', substr($precedingText, 0, -\strlen($precedingChar)));
146+
$tokens[] = ['text', substr($precedingText, 0, -\strlen($precedingChar))];
147147
} elseif (!$isSeparator && \strlen($precedingText) > 0) {
148-
$tokens[] = array('text', $precedingText);
148+
$tokens[] = ['text', $precedingText];
149149
}
150150

151151
$regexp = $route->getRequirement($varName);
@@ -184,12 +184,12 @@ private static function compilePattern(Route $route, $pattern, $isHost)
184184
$regexp = self::transformCapturingGroupsToNonCapturings($regexp);
185185
}
186186

187-
$tokens[] = array('variable', $isSeparator ? $precedingChar : '', $regexp, $varName, false, $important);
187+
$tokens[] = ['variable', $isSeparator ? $precedingChar : '', $regexp, $varName, false, $important];
188188
$variables[] = $varName;
189189
}
190190

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

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

226-
return array(
226+
return [
227227
'staticPrefix' => self::determineStaticPrefix($route, $tokens),
228228
'regex' => $regexp,
229229
'tokens' => array_reverse($tokens),
230230
'variables' => $variables,
231-
);
231+
];
232232
}
233233

234234
/**

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy