8000 [Routing] Deprecate RouteCollection::addPrefix(null). · symfony/symfony@2a88752 · GitHub
[go: up one dir, main page]

Skip to content

Commit 2a88752

Browse files
committed
[Routing] Deprecate RouteCollection::addPrefix(null).
1 parent 7f6ed32 commit 2a88752

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/Symfony/Component/Routing/RouteCollection.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,10 @@ public function addCollection(self $collection)
140140
*/
141141
public function addPrefix($prefix, array $defaults = [], array $requirements = [])
142142
{
143+
if (null === $prefix) {
144+
@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);
145+
}
146+
143147
$prefix = trim(trim($prefix), '/');
144148

145149
if ('' === $prefix) {

src/Symfony/Component/Routing/RouteCollectionBuilder.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,9 @@ public function build()
309309
} else {
310310
/* @var self $route */
311311
$subCollection = $route->build();
312-
$subCollection->addPrefix($this->prefix);
312+
if (null !== $this->prefix) {
313+
$subCollection->addPrefix($this->prefix);
314+
}
313315

314316
$routeCollection->addCollection($subCollection);
315317
}

0 commit comments

Comments
 (0)
0