updated-packages
This commit is contained in:
23
vendor/symfony/routing/RouteCollection.php
vendored
23
vendor/symfony/routing/RouteCollection.php
vendored
@@ -28,12 +28,12 @@ class RouteCollection implements \IteratorAggregate, \Countable
|
||||
/**
|
||||
* @var Route[]
|
||||
*/
|
||||
private $routes = array();
|
||||
private $routes = [];
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
private $resources = array();
|
||||
private $resources = [];
|
||||
|
||||
public function __clone()
|
||||
{
|
||||
@@ -51,6 +51,7 @@ class RouteCollection implements \IteratorAggregate, \Countable
|
||||
*
|
||||
* @return \ArrayIterator|Route[] An \ArrayIterator object for iterating over routes
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function getIterator()
|
||||
{
|
||||
return new \ArrayIterator($this->routes);
|
||||
@@ -61,6 +62,7 @@ class RouteCollection implements \IteratorAggregate, \Countable
|
||||
*
|
||||
* @return int The number of routes
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function count()
|
||||
{
|
||||
return \count($this->routes);
|
||||
@@ -69,8 +71,7 @@ class RouteCollection implements \IteratorAggregate, \Countable
|
||||
/**
|
||||
* Adds a route.
|
||||
*
|
||||
* @param string $name The route name
|
||||
* @param Route $route A Route instance
|
||||
* @param string $name The route name
|
||||
*/
|
||||
public function add($name, Route $route)
|
||||
{
|
||||
@@ -98,7 +99,7 @@ class RouteCollection implements \IteratorAggregate, \Countable
|
||||
*/
|
||||
public function get($name)
|
||||
{
|
||||
return isset($this->routes[$name]) ? $this->routes[$name] : null;
|
||||
return $this->routes[$name] ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -138,8 +139,12 @@ class RouteCollection implements \IteratorAggregate, \Countable
|
||||
* @param array $defaults An array of default values
|
||||
* @param array $requirements An array of requirements
|
||||
*/
|
||||
public function addPrefix($prefix, array $defaults = array(), array $requirements = array())
|
||||
public function addPrefix($prefix, array $defaults = [], array $requirements = [])
|
||||
{
|
||||
if (null === $prefix) {
|
||||
@trigger_error(sprintf('Passing null as $prefix to %s is deprecated in Symfony 4.4 and will trigger a TypeError in 5.0.', __METHOD__), \E_USER_DEPRECATED);
|
||||
}
|
||||
|
||||
$prefix = trim(trim($prefix), '/');
|
||||
|
||||
if ('' === $prefix) {
|
||||
@@ -158,7 +163,7 @@ class RouteCollection implements \IteratorAggregate, \Countable
|
||||
*/
|
||||
public function addNamePrefix(string $prefix)
|
||||
{
|
||||
$prefixedRoutes = array();
|
||||
$prefixedRoutes = [];
|
||||
|
||||
foreach ($this->routes as $name => $route) {
|
||||
$prefixedRoutes[$prefix.$name] = $route;
|
||||
@@ -177,7 +182,7 @@ class RouteCollection implements \IteratorAggregate, \Countable
|
||||
* @param array $defaults An array of default values
|
||||
* @param array $requirements An array of requirements
|
||||
*/
|
||||
public function setHost($pattern, array $defaults = array(), array $requirements = array())
|
||||
public function setHost($pattern, array $defaults = [], array $requirements = [])
|
||||
{
|
||||
foreach ($this->routes as $route) {
|
||||
$route->setHost($pattern);
|
||||
@@ -236,8 +241,6 @@ class RouteCollection implements \IteratorAggregate, \Countable
|
||||
* Adds options to all routes.
|
||||
*
|
||||
* An existing option value under the same name in a route will be overridden.
|
||||
*
|
||||
* @param array $options An array of options
|
||||
*/
|
||||
public function addOptions(array $options)
|
||||
{
|
||||
|
Reference in New Issue
Block a user