summaryrefslogtreecommitdiffstats
path: root/core/lib/Drupal/Core/Routing
diff options
context:
space:
mode:
authorxjm2017-03-04 01:20:24 (GMT)
committerxjm2017-03-04 01:20:24 (GMT)
commit52e3eec616efab4d5201e30d085a09ba5c4817e6 (patch)
treed295cc8b862edc04018ba0e04ded752fd1a2f5c6 /core/lib/Drupal/Core/Routing
parent3aba956a39a4852f42cad8483e4e6e307bedbd0e (diff)
Issue #2776975 by joelpittet, dawehner, tim.plunkett, xjm, pfrenssen: March 3, 2017: Convert core to array syntax coding standards for Drupal 8.3.x RC phase
Diffstat (limited to 'core/lib/Drupal/Core/Routing')
-rw-r--r--core/lib/Drupal/Core/Routing/AccessAwareRouter.php2
-rw-r--r--core/lib/Drupal/Core/Routing/CompiledRoute.php2
-rw-r--r--core/lib/Drupal/Core/Routing/Enhancer/ParamConversionEnhancer.php4
-rw-r--r--core/lib/Drupal/Core/Routing/MatcherDumper.php14
-rw-r--r--core/lib/Drupal/Core/Routing/NullGenerator.php4
-rw-r--r--core/lib/Drupal/Core/Routing/NullMatcherDumper.php2
-rw-r--r--core/lib/Drupal/Core/Routing/RouteBuilder.php14
-rw-r--r--core/lib/Drupal/Core/Routing/RouteMatch.php6
-rw-r--r--core/lib/Drupal/Core/Routing/RoutePreloader.php10
-rw-r--r--core/lib/Drupal/Core/Routing/RouteProvider.php26
-rw-r--r--core/lib/Drupal/Core/Routing/Router.php4
-rw-r--r--core/lib/Drupal/Core/Routing/TrustedRedirectResponse.php4
-rw-r--r--core/lib/Drupal/Core/Routing/UrlGenerator.php20
-rw-r--r--core/lib/Drupal/Core/Routing/UrlGeneratorInterface.php4
-rw-r--r--core/lib/Drupal/Core/Routing/UrlGeneratorTrait.php2
15 files changed, 59 insertions, 59 deletions
diff --git a/core/lib/Drupal/Core/Routing/AccessAwareRouter.php b/core/lib/Drupal/Core/Routing/AccessAwareRouter.php
index 5c3d931..d8487c6 100644
--- a/core/lib/Drupal/Core/Routing/AccessAwareRouter.php
+++ b/core/lib/Drupal/Core/Routing/AccessAwareRouter.php
@@ -127,7 +127,7 @@ class AccessAwareRouter implements AccessAwareRouterInterface {
/**
* {@inheritdoc}
*/
- public function generate($name, $parameters = array(), $referenceType = self::ABSOLUTE_PATH) {
+ public function generate($name, $parameters = [], $referenceType = self::ABSOLUTE_PATH) {
if ($this->router instanceof UrlGeneratorInterface) {
return $this->router->generate($name, $parameters, $referenceType);
}
diff --git a/core/lib/Drupal/Core/Routing/CompiledRoute.php b/core/lib/Drupal/Core/Routing/CompiledRoute.php
index 76d6ef1..a1366a6 100644
--- a/core/lib/Drupal/Core/Routing/CompiledRoute.php
+++ b/core/lib/Drupal/Core/Routing/CompiledRoute.php
@@ -62,7 +62,7 @@ class CompiledRoute extends SymfonyCompiledRoute {
* @param array $variables
* An array of variables (variables defined in the path and in the host patterns)
*/
- public function __construct($fit, $pattern_outline, $num_parts, $staticPrefix, $regex, array $tokens, array $pathVariables, $hostRegex = NULL, array $hostTokens = array(), array $hostVariables = array(), array $variables = array()) {
+ public function __construct($fit, $pattern_outline, $num_parts, $staticPrefix, $regex, array $tokens, array $pathVariables, $hostRegex = NULL, array $hostTokens = [], array $hostVariables = [], array $variables = []) {
parent::__construct($staticPrefix, $regex, $tokens, $pathVariables, $hostRegex, $hostTokens, $hostVariables, $variables);
$this->fit = $fit;
diff --git a/core/lib/Drupal/Core/Routing/Enhancer/ParamConversionEnhancer.php b/core/lib/Drupal/Core/Routing/Enhancer/ParamConversionEnhancer.php
index e804f2e..09d6148 100644
--- a/core/lib/Drupal/Core/Routing/Enhancer/ParamConversionEnhancer.php
+++ b/core/lib/Drupal/Core/Routing/Enhancer/ParamConversionEnhancer.php
@@ -62,7 +62,7 @@ class ParamConversionEnhancer implements RouteEnhancerInterface, EventSubscriber
// Foreach will copy the values from the array it iterates. Even if they
// are references, use it to break them. This avoids any scenarios where raw
// variables also get replaced with converted values.
- $raw_variables = array();
+ $raw_variables = [];
foreach (array_intersect_key($defaults, $variables) as $key => $value) {
$raw_variables[$key] = $value;
}
@@ -85,7 +85,7 @@ class ParamConversionEnhancer implements RouteEnhancerInterface, EventSubscriber
* {@inheritdoc}
*/
public static function getSubscribedEvents() {
- $events[KernelEvents::EXCEPTION][] = array('onException', 75);
+ $events[KernelEvents::EXCEPTION][] = ['onException', 75];
return $events;
}
diff --git a/core/lib/Drupal/Core/Routing/MatcherDumper.php b/core/lib/Drupal/Core/Routing/MatcherDumper.php
index 82c7074..5e329f7 100644
--- a/core/lib/Drupal/Core/Routing/MatcherDumper.php
+++ b/core/lib/Drupal/Core/Routing/MatcherDumper.php
@@ -84,10 +84,10 @@ class MatcherDumper implements MatcherDumperInterface {
* @param array $options
* An array of options.
*/
- public function dump(array $options = array()) {
+ public function dump(array $options = []) {
// Convert all of the routes into database records.
// Accumulate the menu masks on top of any we found before.
- $masks = array_flip($this->state->get('routing.menu_masks.' . $this->tableName, array()));
+ $masks = array_flip($this->state->get('routing.menu_masks.' . $this->tableName, []));
// Delete any old records first, then insert the new ones. That avoids
// stale data. The transaction makes it atomic to avoid unstable router
// states due to random failures.
@@ -106,15 +106,15 @@ class MatcherDumper implements MatcherDumperInterface {
// Split the routes into chunks to avoid big INSERT queries.
$route_chunks = array_chunk($this->routes->all(), 50, TRUE);
foreach ($route_chunks as $routes) {
- $insert = $this->connection->insert($this->tableName)->fields(array(
+ $insert = $this->connection->insert($this->tableName)->fields([
'name',
'fit',
'path',
'pattern_outline',
'number_parts',
'route',
- ));
- $names = array();
+ ]);
+ $names = [];
foreach ($routes as $name => $route) {
/** @var \Symfony\Component\Routing\Route $route */
$route->setOption('compiler_class', '\Drupal\Core\Routing\RouteCompiler');
@@ -126,14 +126,14 @@ class MatcherDumper implements MatcherDumperInterface {
// patterns we need to check in the RouteProvider.
$masks[$compiled->getFit()] = 1;
$names[] = $name;
- $values = array(
+ $values = [
'name' => $name,
'fit' => $compiled->getFit(),
'path' => $route->getPath(),
'pattern_outline' => $compiled->getPatternOutline(),
'number_parts' => $compiled->getNumParts(),
'route' => serialize($route),
- );
+ ];
$insert->values($values);
}
diff --git a/core/lib/Drupal/Core/Routing/NullGenerator.php b/core/lib/Drupal/Core/Routing/NullGenerator.php
index 9d6db83..74db5c9 100644
--- a/core/lib/Drupal/Core/Routing/NullGenerator.php
+++ b/core/lib/Drupal/Core/Routing/NullGenerator.php
@@ -52,7 +52,7 @@ class NullGenerator extends UrlGenerator {
/**
* {@inheritdoc}
*/
- protected function getInternalPathFromRoute($name, Route $route, $parameters = array(), &$query_params = array()) {
+ protected function getInternalPathFromRoute($name, Route $route, $parameters = [], &$query_params = []) {
return $route->getPath();
}
@@ -71,7 +71,7 @@ class NullGenerator extends UrlGenerator {
/**
* {@inheritdoc}
*/
- protected function processPath($path, &$options = array(), BubbleableMetadata $bubbleable_metadata = NULL) {
+ protected function processPath($path, &$options = [], BubbleableMetadata $bubbleable_metadata = NULL) {
return $path;
}
diff --git a/core/lib/Drupal/Core/Routing/NullMatcherDumper.php b/core/lib/Drupal/Core/Routing/NullMatcherDumper.php
index 938a426..3378e1b 100644
--- a/core/lib/Drupal/Core/Routing/NullMatcherDumper.php
+++ b/core/lib/Drupal/Core/Routing/NullMatcherDumper.php
@@ -39,7 +39,7 @@ class NullMatcherDumper implements MatcherDumperInterface {
* @param array $options
* An array of options.
*/
- public function dump(array $options = array()) {
+ public function dump(array $options = []) {
// The dumper is reused for multiple providers, so reset the queued routes.
$this->routes = NULL;
}
diff --git a/core/lib/Drupal/Core/Routing/RouteBuilder.php b/core/lib/Drupal/Core/Routing/RouteBuilder.php
index 29da760..2a0720a 100644
--- a/core/lib/Drupal/Core/Routing/RouteBuilder.php
+++ b/core/lib/Drupal/Core/Routing/RouteBuilder.php
@@ -159,15 +159,15 @@ class RouteBuilder implements RouteBuilderInterface, DestructableInterface {
unset($routes['route_callbacks']);
}
foreach ($routes as $name => $route_info) {
- $route_info += array(
- 'defaults' => array(),
- 'requirements' => array(),
- 'options' => array(),
+ $route_info += [
+ 'defaults' => [],
+ 'requirements' => [],
+ 'options' => [],
'host' => NULL,
- 'schemes' => array(),
- 'methods' => array(),
+ 'schemes' => [],
+ 'methods' => [],
'condition' => '',
- );
+ ];
$route = new Route($route_info['path'], $route_info['defaults'], $route_info['requirements'], $route_info['options'], $route_info['host'], $route_info['schemes'], $route_info['methods'], $route_info['condition']);
$collection->add($name, $route);
diff --git a/core/lib/Drupal/Core/Routing/RouteMatch.php b/core/lib/Drupal/Core/Routing/RouteMatch.php
index 29ff5c6..5784b7f 100644
--- a/core/lib/Drupal/Core/Routing/RouteMatch.php
+++ b/core/lib/Drupal/Core/Routing/RouteMatch.php
@@ -52,7 +52,7 @@ class RouteMatch implements RouteMatchInterface {
* @param array $raw_parameters
* The raw $parameters array.
*/
- public function __construct($route_name, Route $route, array $parameters = array(), array $raw_parameters = array()) {
+ public function __construct($route_name, Route $route, array $parameters = [], array $raw_parameters = []) {
$this->routeName = $route_name;
$this->route = $route;
@@ -77,7 +77,7 @@ class RouteMatch implements RouteMatchInterface {
*/
public static function createFromRequest(Request $request) {
if ($request->attributes->get(RouteObjectInterface::ROUTE_OBJECT)) {
- $raw_variables = array();
+ $raw_variables = [];
if ($raw = $request->attributes->get('_raw_variables')) {
$raw_variables = $raw->all();
}
@@ -141,7 +141,7 @@ class RouteMatch implements RouteMatchInterface {
* Route parameter names as both the keys and values.
*/
protected function getParameterNames() {
- $names = array();
+ $names = [];
if ($route = $this->getRouteObject()) {
// Variables defined in path and host patterns are route parameters.
$variables = $route->compile()->getVariables();
diff --git a/core/lib/Drupal/Core/Routing/RoutePreloader.php b/core/lib/Drupal/Core/Routing/RoutePreloader.php
index 2d382bb..9e75cdf 100644
--- a/core/lib/Drupal/Core/Routing/RoutePreloader.php
+++ b/core/lib/Drupal/Core/Routing/RoutePreloader.php
@@ -38,7 +38,7 @@ class RoutePreloader implements EventSubscriberInterface {
*
* @var array
*/
- protected $nonAdminRoutesOnRebuild = array();
+ protected $nonAdminRoutesOnRebuild = [];
/**
* The cache backend used to skip the state loading.
@@ -114,7 +114,7 @@ class RoutePreloader implements EventSubscriberInterface {
*/
public function onFinishedRoutes(Event $event) {
$this->state->set('routing.non_admin_routes', $this->nonAdminRoutesOnRebuild);
- $this->nonAdminRoutesOnRebuild = array();
+ $this->nonAdminRoutesOnRebuild = [];
}
/**
@@ -122,11 +122,11 @@ class RoutePreloader implements EventSubscriberInterface {
*/
public static function getSubscribedEvents() {
// Set a really low priority to catch as many as possible routes.
- $events[RoutingEvents::ALTER] = array('onAlterRoutes', -1024);
- $events[RoutingEvents::FINISHED] = array('onFinishedRoutes');
+ $events[RoutingEvents::ALTER] = ['onAlterRoutes', -1024];
+ $events[RoutingEvents::FINISHED] = ['onFinishedRoutes'];
// Load the routes before the controller is executed (which happens after
// the kernel request event).
- $events[KernelEvents::REQUEST][] = array('onRequest');
+ $events[KernelEvents::REQUEST][] = ['onRequest'];
return $events;
}
diff --git a/core/lib/Drupal/Core/Routing/RouteProvider.php b/core/lib/Drupal/Core/Routing/RouteProvider.php
index f16aa9f..1ba5f0d 100644
--- a/core/lib/Drupal/Core/Routing/RouteProvider.php
+++ b/core/lib/Drupal/Core/Routing/RouteProvider.php
@@ -48,7 +48,7 @@ class RouteProvider implements PreloadableRouteProviderInterface, PagedRouteProv
*
* @var \Symfony\Component\Routing\Route[]
*/
- protected $routes = array();
+ protected $routes = [];
/**
* A cache of already-loaded serialized routes, keyed by route name.
@@ -185,7 +185,7 @@ class RouteProvider implements PreloadableRouteProviderInterface, PagedRouteProv
* Thrown if there is no route with that name in this repository.
*/
public function getRouteByName($name) {
- $routes = $this->getRoutesByNames(array($name));
+ $routes = $this->getRoutesByNames([$name]);
if (empty($routes)) {
throw new RouteNotFoundException(sprintf('Route "%s" does not exist.', $name));
}
@@ -210,7 +210,7 @@ class RouteProvider implements PreloadableRouteProviderInterface, PagedRouteProv
}
else {
try {
- $result = $this->connection->query('SELECT name, route FROM {' . $this->connection->escapeTable($this->tableName) . '} WHERE name IN ( :names[] )', array(':names[]' => $routes_to_load));
+ $result = $this->connection->query('SELECT name, route FROM {' . $this->connection->escapeTable($this->tableName) . '} WHERE name IN ( :names[] )', [':names[]' => $routes_to_load]);
$routes = $result->fetchAllKeyed();
$this->cache->set($cid, $routes, Cache::PERMANENT, ['routes']);
@@ -252,14 +252,14 @@ class RouteProvider implements PreloadableRouteProviderInterface, PagedRouteProv
*/
protected function getCandidateOutlines(array $parts) {
$number_parts = count($parts);
- $ancestors = array();
+ $ancestors = [];
$length = $number_parts - 1;
$end = (1 << $number_parts) - 1;
// The highest possible mask is a 1 bit for every part of the path. We will
// check every value down from there to generate a possible outline.
if ($number_parts == 1) {
- $masks = array(1);
+ $masks = [1];
}
elseif ($number_parts <= 3 && $number_parts > 0) {
// Optimization - don't query the state system for short paths. This also
@@ -269,11 +269,11 @@ class RouteProvider implements PreloadableRouteProviderInterface, PagedRouteProv
}
elseif ($number_parts <= 0) {
// No path can match, short-circuit the process.
- $masks = array();
+ $masks = [];
}
else {
// Get the actual patterns that exist out of state.
- $masks = (array) $this->state->get('routing.menu_masks.' . $this->tableName, array());
+ $masks = (array) $this->state->get('routing.menu_masks.' . $this->tableName, []);
}
// Only examine patterns that actually exist as router items (the masks).
@@ -346,9 +346,9 @@ class RouteProvider implements PreloadableRouteProviderInterface, PagedRouteProv
// trailing wildcard parts as long as the pattern matches, since we
// dump the route pattern without those optional parts.
try {
- $routes = $this->connection->query("SELECT name, route, fit FROM {" . $this->connection->escapeTable($this->tableName) . "} WHERE pattern_outline IN ( :patterns[] ) AND number_parts >= :count_parts", array(
+ $routes = $this->connection->query("SELECT name, route, fit FROM {" . $this->connection->escapeTable($this->tableName) . "} WHERE pattern_outline IN ( :patterns[] ) AND number_parts >= :count_parts", [
':patterns[]' => $ancestors, ':count_parts' => count($parts),
- ))
+ ])
->fetchAll(\PDO::FETCH_ASSOC);
}
catch (\Exception $e) {
@@ -357,7 +357,7 @@ class RouteProvider implements PreloadableRouteProviderInterface, PagedRouteProv
// We sort by fit and name in PHP to avoid a SQL filesort and avoid any
// difference in the sorting behavior of SQL back-ends.
- usort($routes, array($this, 'routeProviderRouteCompare'));
+ usort($routes, [$this, 'routeProviderRouteCompare']);
foreach ($routes as $row) {
$collection->add($row['name'], unserialize($row['route']));
@@ -389,8 +389,8 @@ class RouteProvider implements PreloadableRouteProviderInterface, PagedRouteProv
* {@inheritdoc}
*/
public function reset() {
- $this->routes = array();
- $this->serializedRoutes = array();
+ $this->routes = [];
+ $this->serializedRoutes = [];
$this->cacheTagInvalidator->invalidateTags(['routes']);
}
@@ -398,7 +398,7 @@ class RouteProvider implements PreloadableRouteProviderInterface, PagedRouteProv
* {@inheritdoc}
*/
static function getSubscribedEvents() {
- $events[RoutingEvents::FINISHED][] = array('reset');
+ $events[RoutingEvents::FINISHED][] = ['reset'];
return $events;
}
diff --git a/core/lib/Drupal/Core/Routing/Router.php b/core/lib/Drupal/Core/Routing/Router.php
index dc724bc..e949c5e 100644
--- a/core/lib/Drupal/Core/Routing/Router.php
+++ b/core/lib/Drupal/Core/Routing/Router.php
@@ -214,7 +214,7 @@ class Router extends UrlMatcher implements RequestMatcherInterface, RouterInterf
continue;
}
- $hostMatches = array();
+ $hostMatches = [];
if ($compiledRoute->getHostRegex() && !preg_match($compiledRoute->getHostRegex(), $this->context->getHost(), $hostMatches)) {
$routes->remove($name);
continue;
@@ -383,7 +383,7 @@ class Router extends UrlMatcher implements RequestMatcherInterface, RouterInterf
/**
* {@inheritdoc}
*/
- public function generate($name, $parameters = array(), $referenceType = self::ABSOLUTE_PATH) {
+ public function generate($name, $parameters = [], $referenceType = self::ABSOLUTE_PATH) {
@trigger_error('Use the \Drupal\Core\Url object instead', E_USER_DEPRECATED);
return $this->urlGenerator->generate($name, $parameters, $referenceType);
}
diff --git a/core/lib/Drupal/Core/Routing/TrustedRedirectResponse.php b/core/lib/Drupal/Core/Routing/TrustedRedirectResponse.php
index e959c2a..625f7a3 100644
--- a/core/lib/Drupal/Core/Routing/TrustedRedirectResponse.php
+++ b/core/lib/Drupal/Core/Routing/TrustedRedirectResponse.php
@@ -16,12 +16,12 @@ class TrustedRedirectResponse extends CacheableSecuredRedirectResponse {
*
* @var string[]
*/
- protected $trustedUrls = array();
+ protected $trustedUrls = [];
/**
* {@inheritdoc}
*/
- public function __construct($url, $status = 302, $headers = array()) {
+ public function __construct($url, $status = 302, $headers = []) {
$this->trustedUrls[$url] = TRUE;
parent::__construct($url, $status, $headers);
}
diff --git a/core/lib/Drupal/Core/Routing/UrlGenerator.php b/core/lib/Drupal/Core/Routing/UrlGenerator.php
index 36ed0f6..63dcd47 100644
--- a/core/lib/Drupal/Core/Routing/UrlGenerator.php
+++ b/core/lib/Drupal/Core/Routing/UrlGenerator.php
@@ -124,7 +124,7 @@ class UrlGenerator implements UrlGeneratorInterface {
/**
* {@inheritdoc}
*/
- public function getPathFromRoute($name, $parameters = array()) {
+ public function getPathFromRoute($name, $parameters = []) {
$route = $this->getRoute($name);
$name = $this->getRouteDebugMessage($name);
$this->processRoute($name, $route, $parameters);
@@ -241,7 +241,7 @@ class UrlGenerator implements UrlGeneratorInterface {
* The URL path corresponding to the route, without the base path, not URL
* encoded.
*/
- protected function getInternalPathFromRoute($name, SymfonyRoute $route, $parameters = array(), &$query_params = array()) {
+ protected function getInternalPathFromRoute($name, SymfonyRoute $route, $parameters = [], &$query_params = []) {
// The Route has a cache of its own and is not recompiled as long as it does
// not get modified.
$compiledRoute = $route->compile();
@@ -252,7 +252,7 @@ class UrlGenerator implements UrlGeneratorInterface {
/**
* {@inheritdoc}
*/
- public function generate($name, $parameters = array(), $referenceType = self::ABSOLUTE_PATH) {
+ public function generate($name, $parameters = [], $referenceType = self::ABSOLUTE_PATH) {
$options['absolute'] = is_bool($referenceType) ? $referenceType : $referenceType === self::ABSOLUTE_URL;
return $this->generateFromRoute($name, $parameters, $options);
}
@@ -260,10 +260,10 @@ class UrlGenerator implements UrlGeneratorInterface {
/**
* {@inheritdoc}
*/
- public function generateFromRoute($name, $parameters = array(), $options = array(), $collect_bubbleable_metadata = FALSE) {
- $options += array('prefix' => '');
+ public function generateFromRoute($name, $parameters = [], $options = [], $collect_bubbleable_metadata = FALSE) {
+ $options += ['prefix' => ''];
if (!isset($options['query']) || !is_array($options['query'])) {
- $options['query'] = array();
+ $options['query'] = [];
}
$route = $this->getRoute($name);
@@ -284,7 +284,7 @@ class UrlGenerator implements UrlGeneratorInterface {
}
$options += $route->getOption('default_url_options') ?: [];
- $options += array('prefix' => '', 'path_processing' => TRUE);
+ $options += ['prefix' => '', 'path_processing' => TRUE];
$name = $this->getRouteDebugMessage($name);
$this->processRoute($name, $route, $parameters, $generated_url);
@@ -306,7 +306,7 @@ class UrlGenerator implements UrlGeneratorInterface {
// so we need to encode them as they are not used for this purpose here
// otherwise we would generate a URI that, when followed by a user agent
// (e.g. browser), does not match this route
- $path = strtr($path, array('/../' => '/%2E%2E/', '/./' => '/%2E/'));
+ $path = strtr($path, ['/../' => '/%2E%2E/', '/./' => '/%2E/']);
if ('/..' === substr($path, -3)) {
$path = substr($path, 0, -2) . '%2E%2E';
}
@@ -377,7 +377,7 @@ class UrlGenerator implements UrlGeneratorInterface {
/**
* Passes the path to a processor manager to allow alterations.
*/
- protected function processPath($path, &$options = array(), BubbleableMetadata $bubbleable_metadata = NULL) {
+ protected function processPath($path, &$options = [], BubbleableMetadata $bubbleable_metadata = NULL) {
$actual_path = $path === '/' ? $path : rtrim($path, '/');
return $this->pathProcessor->processOutbound($actual_path, $options, $this->requestStack->getCurrentRequest(), $bubbleable_metadata);
}
@@ -433,7 +433,7 @@ class UrlGenerator implements UrlGeneratorInterface {
/**
* {@inheritdoc}
*/
- public function getRouteDebugMessage($name, array $parameters = array()) {
+ public function getRouteDebugMessage($name, array $parameters = []) {
if (is_scalar($name)) {
return $name;
}
diff --git a/core/lib/Drupal/Core/Routing/UrlGeneratorInterface.php b/core/lib/Drupal/Core/Routing/UrlGeneratorInterface.php
index b2b8196..e63383d 100644
--- a/core/lib/Drupal/Core/Routing/UrlGeneratorInterface.php
+++ b/core/lib/Drupal/Core/Routing/UrlGeneratorInterface.php
@@ -24,7 +24,7 @@ interface UrlGeneratorInterface extends VersatileGeneratorInterface {
* The internal Drupal path corresponding to the route. This string is
* not urlencoded and will be an empty string for the front page.
*/
- public function getPathFromRoute($name, $parameters = array());
+ public function getPathFromRoute($name, $parameters = []);
/**
* Generates a URL or path for a specific route based on the given parameters.
@@ -78,6 +78,6 @@ interface UrlGeneratorInterface extends VersatileGeneratorInterface {
* Should not be used in user code.
* Use \Drupal\Core\Url instead.
*/
- public function generateFromRoute($name, $parameters = array(), $options = array(), $collect_bubbleable_metadata = FALSE);
+ public function generateFromRoute($name, $parameters = [], $options = [], $collect_bubbleable_metadata = FALSE);
}
diff --git a/core/lib/Drupal/Core/Routing/UrlGeneratorTrait.php b/core/lib/Drupal/Core/Routing/UrlGeneratorTrait.php
index 98429d4..7854a0a 100644
--- a/core/lib/Drupal/Core/Routing/UrlGeneratorTrait.php
+++ b/core/lib/Drupal/Core/Routing/UrlGeneratorTrait.php
@@ -38,7 +38,7 @@ trait UrlGeneratorTrait {
*
* @see \Drupal\Core\Routing\UrlGeneratorInterface::generateFromRoute()
*/
- protected function url($route_name, $route_parameters = array(), $options = array()) {
+ protected function url($route_name, $route_parameters = [], $options = []) {
return $this->getUrlGenerator()->generateFromRoute($route_name, $route_parameters, $options);
}