[Routing] Deprecate RouteCollection::addPrefix(null).
This commit is contained in:
parent
7f6ed32a1d
commit
2a88752cd6
@ -140,6 +140,10 @@ class RouteCollection implements \IteratorAggregate, \Countable
|
|||||||
*/
|
*/
|
||||||
public function addPrefix($prefix, array $defaults = [], array $requirements = [])
|
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), '/');
|
$prefix = trim(trim($prefix), '/');
|
||||||
|
|
||||||
if ('' === $prefix) {
|
if ('' === $prefix) {
|
||||||
|
@ -309,7 +309,9 @@ class RouteCollectionBuilder
|
|||||||
} else {
|
} else {
|
||||||
/* @var self $route */
|
/* @var self $route */
|
||||||
$subCollection = $route->build();
|
$subCollection = $route->build();
|
||||||
$subCollection->addPrefix($this->prefix);
|
if (null !== $this->prefix) {
|
||||||
|
$subCollection->addPrefix($this->prefix);
|
||||||
|
}
|
||||||
|
|
||||||
$routeCollection->addCollection($subCollection);
|
$routeCollection->addCollection($subCollection);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user