Skip to content

Commit 1e61976

Browse files
committed
Merge branch '5.1' into 5.x
2 parents 3bf7d02 + e9d8973 commit 1e61976

File tree

7 files changed

+18
-18
lines changed

7 files changed

+18
-18
lines changed

Generator/CompiledUrlGenerator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public function generate(string $name, array $parameters = [], int $referenceTyp
5050
throw new RouteNotFoundException(sprintf('Unable to generate a URL for the named route "%s" as such route does not exist.', $name));
5151
}
5252

53-
list($variables, $defaults, $requirements, $tokens, $hostTokens, $requiredSchemes) = $this->compiledRoutes[$name];
53+
[$variables, $defaults, $requirements, $tokens, $hostTokens, $requiredSchemes] = $this->compiledRoutes[$name];
5454

5555
if (isset($defaults['_canonical_route']) && isset($defaults['_locale'])) {
5656
if (!\in_array('_locale', $variables, true)) {

Loader/XmlFileLoader.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ protected function parseRoute(RouteCollection $collection, \DOMElement $node, st
118118
$schemes = preg_split('/[\s,\|]++/', $node->getAttribute('schemes'), -1, \PREG_SPLIT_NO_EMPTY);
119119
$methods = preg_split('/[\s,\|]++/', $node->getAttribute('methods'), -1, \PREG_SPLIT_NO_EMPTY);
120120

121-
list($defaults, $requirements, $options, $condition, $paths, /* $prefixes */, $hosts) = $this->parseConfigs($node, $path);
121+
[$defaults, $requirements, $options, $condition, $paths, /* $prefixes */, $hosts] = $this->parseConfigs($node, $path);
122122

123123
if (!$paths && '' === $node->getAttribute('path')) {
124124
throw new \InvalidArgumentException(sprintf('The <route> element in file "%s" must have a "path" attribute or <path> child nodes.', $path));
@@ -163,7 +163,7 @@ protected function parseImport(RouteCollection $collection, \DOMElement $node, s
163163
$trailingSlashOnRoot = $node->hasAttribute('trailing-slash-on-root') ? XmlUtils::phpize($node->getAttribute('trailing-slash-on-root')) : true;
164164
$namePrefix = $node->getAttribute('name-prefix') ?: null;
165165

166-
list($defaults, $requirements, $options, $condition, /* $paths */, $prefixes, $hosts) = $this->parseConfigs($node, $path);
166+
[$defaults, $requirements, $options, $condition, /* $paths */, $prefixes, $hosts] = $this->parseConfigs($node, $path);
167167

168168
if ('' !== $prefix && $prefixes) {
169169
throw new \InvalidArgumentException(sprintf('The <route> element in file "%s" must not have both a "prefix" attribute and <prefix> child nodes.', $path));

Matcher/CompiledUrlMatcher.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,6 @@ class CompiledUrlMatcher extends UrlMatcher
2626
public function __construct(array $compiledRoutes, RequestContext $context)
2727
{
2828
$this->context = $context;
29-
list($this->matchHost, $this->staticRoutes, $this->regexpList, $this->dynamicRoutes, $this->checkCondition) = $compiledRoutes;
29+
[$this->matchHost, $this->staticRoutes, $this->regexpList, $this->dynamicRoutes, $this->checkCondition] = $compiledRoutes;
3030
}
3131
}

Matcher/Dumper/CompiledUrlMatcherDumper.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public function getCompiledRoutes(bool $forDump = false): array
8383
$routes = $this->getRoutes();
8484
}
8585

86-
list($staticRoutes, $dynamicRoutes) = $this->groupStaticRoutes($routes);
86+
[$staticRoutes, $dynamicRoutes] = $this->groupStaticRoutes($routes);
8787

8888
$conditions = [null];
8989
$compiledRoutes[] = $this->compileStaticRoutes($staticRoutes, $conditions);
@@ -131,7 +131,7 @@ static function (\$condition, \$context, \$request) { // \$checkCondition
131131

132132
private function generateCompiledRoutes(): string
133133
{
134-
list($matchHost, $staticRoutes, $regexpCode, $dynamicRoutes, $checkConditionCode) = $this->getCompiledRoutes(true);
134+
[$matchHost, $staticRoutes, $regexpCode, $dynamicRoutes, $checkConditionCode] = $this->getCompiledRoutes(true);
135135

136136
$code = self::export($matchHost).', // $matchHost'."\n";
137137

@@ -186,7 +186,7 @@ private function groupStaticRoutes(RouteCollection $collection): array
186186
if ($hasTrailingSlash) {
187187
$url = substr($url, 0, -1);
188188
}
189-
foreach ($dynamicRegex as list($hostRx, $rx, $prefix)) {
189+
foreach ($dynamicRegex as [$hostRx, $rx, $prefix]) {
190190
if (('' === $prefix || 0 === strpos($url, $prefix)) && (preg_match($rx, $url) || preg_match($rx, $url.'/')) && (!$host || !$hostRx || preg_match($hostRx, $host))) {
191191
$dynamicRegex[] = [$hostRegex, $regex, $staticPrefix];
192192
$dynamicRoutes->add($name, $route);
@@ -221,7 +221,7 @@ private function compileStaticRoutes(array $staticRoutes, array &$conditions): a
221221

222222
foreach ($staticRoutes as $url => $routes) {
223223
$compiledRoutes[$url] = [];
224-
foreach ($routes as $name => list($route, $hasTrailingSlash)) {
224+
foreach ($routes as $name => [$route, $hasTrailingSlash]) {
225225
$compiledRoutes[$url][] = $this->compileRoute($route, $name, (!$route->compile()->getHostVariables() ? $route->getHost() : $route->compile()->getHostRegex()) ?: null, $hasTrailingSlash, false, $conditions);
226226
}
227227
}
@@ -287,7 +287,7 @@ private function compileDynamicRoutes(RouteCollection $collection, bool $matchHo
287287
$routes->add($name, $route);
288288
}
289289

290-
foreach ($perModifiers as list($modifiers, $routes)) {
290+
foreach ($perModifiers as [$modifiers, $routes]) {
291291
$prev = false;
292292
$perHost = [];
293293
foreach ($routes->all() as $name => $route) {
@@ -306,7 +306,7 @@ private function compileDynamicRoutes(RouteCollection $collection, bool $matchHo
306306
$state->mark += \strlen($rx);
307307
$state->regex = $rx;
308308

309-
foreach ($perHost as list($hostRegex, $routes)) {
309+
foreach ($perHost as [$hostRegex, $routes]) {
310310
if ($matchHost) {
311311
if ($hostRegex) {
312312
preg_match('#^.\^(.*)\$.[a-zA-Z]*$#', $hostRegex, $rx);
@@ -391,7 +391,7 @@ private function compileStaticPrefixCollection(StaticPrefixCollection $tree, \st
391391
continue;
392392
}
393393

394-
list($name, $regex, $vars, $route, $hasTrailingSlash, $hasTrailingVar) = $route;
394+
[$name, $regex, $vars, $route, $hasTrailingSlash, $hasTrailingVar] = $route;
395395
$compiledRoute = $route->compile();
396396
$vars = array_merge($state->hostVars, $vars);
397397

Matcher/Dumper/CompiledUrlMatcherTrait.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ private function doMatch(string $pathinfo, array &$allow = [], array &$allowSche
8787
}
8888
$supportsRedirections = 'GET' === $canonicalMethod && $this instanceof RedirectableUrlMatcherInterface;
8989

90-
foreach ($this->staticRoutes[$trimmedPathinfo] ?? [] as list($ret, $requiredHost, $requiredMethods, $requiredSchemes, $hasTrailingSlash, , $condition)) {
90+
foreach ($this->staticRoutes[$trimmedPathinfo] ?? [] as [$ret, $requiredHost, $requiredMethods, $requiredSchemes, $hasTrailingSlash, , $condition]) {
9191
if ($condition && !($this->checkCondition)($condition, $context, 0 < $condition ? $request ?? $request = $this->request ?: $this->createRequest($pathinfo) : null)) {
9292
continue;
9393
}
@@ -127,7 +127,7 @@ private function doMatch(string $pathinfo, array &$allow = [], array &$allowSche
127127

128128
foreach ($this->regexpList as $offset => $regex) {
129129
while (preg_match($regex, $matchedPathinfo, $matches)) {
130-
foreach ($this->dynamicRoutes[$m = (int) $matches['MARK']] as list($ret, $vars, $requiredMethods, $requiredSchemes, $hasTrailingSlash, $hasTrailingVar, $condition)) {
130+
foreach ($this->dynamicRoutes[$m = (int) $matches['MARK']] as [$ret, $vars, $requiredMethods, $requiredSchemes, $hasTrailingSlash, $hasTrailingVar, $condition]) {
131131
if (null !== $condition) {
132132
if (0 === $condition) { // marks the last route in the regexp
133133
continue 3;

Matcher/Dumper/StaticPrefixCollection.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,12 @@ public function getRoutes(): array
6565
*/
6666
public function addRoute(string $prefix, $route)
6767
{
68-
list($prefix, $staticPrefix) = $this->getCommonPrefix($prefix, $prefix);
68+
[$prefix, $staticPrefix] = $this->getCommonPrefix($prefix, $prefix);
6969

7070
for ($i = \count($this->items) - 1; 0 <= $i; --$i) {
7171
$item = $this->items[$i];
7272

73-
list($commonPrefix, $commonStaticPrefix) = $this->getCommonPrefix($prefix, $this->prefixes[$i]);
73+
[$commonPrefix, $commonStaticPrefix] = $this->getCommonPrefix($prefix, $this->prefixes[$i]);
7474

7575
if ($this->prefix === $commonPrefix) {
7676
// the new route and a previous one have no common prefix, let's see if they are exclusive to each others
@@ -104,8 +104,8 @@ public function addRoute(string $prefix, $route)
104104
} else {
105105
// the new route and a previous one have a common prefix, let's merge them
106106
$child = new self($commonPrefix);
107-
list($child->prefixes[0], $child->staticPrefixes[0]) = $child->getCommonPrefix($this->prefixes[$i], $this->prefixes[$i]);
108-
list($child->prefixes[1], $child->staticPrefixes[1]) = $child->getCommonPrefix($prefix, $prefix);
107+
[$child->prefixes[0], $child->staticPrefixes[0]] = $child->getCommonPrefix($this->prefixes[$i], $this->prefixes[$i]);
108+
[$child->prefixes[1], $child->staticPrefixes[1]] = $child->getCommonPrefix($prefix, $prefix);
109109
$child->items = [$this->items[$i], $route];
110110

111111
$this->staticPrefixes[$i] = $commonStaticPrefix;

Tests/Matcher/Dumper/StaticPrefixCollectionTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public function testGrouping(array $routes, $expected)
1616
$collection = new StaticPrefixCollection('/');
1717

1818
foreach ($routes as $route) {
19-
list($path, $name) = $route;
19+
[$path, $name] = $route;
2020
$staticPrefix = (new Route($path))->compile()->getStaticPrefix();
2121
$collection->addRoute($staticPrefix, [$name]);
2222
}

0 commit comments

Comments
 (0)