Skip to content

Commit 57ea6d1

Browse files
committed
Merge branch '6.3' into 6.4
* 6.3: [DependencyInjection] Fix dumping containers with null-referenced services [Routing] Fix removing aliases pointing to removed route in RouteCollection::remove() [VarExporter] Fix lazy ghost trait when using nullsafe operator
2 parents d8f83c3 + 3f14efc commit 57ea6d1

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

RouteCollection.php

+9-2
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,15 @@ public function get(string $name): ?Route
147147
*/
148148
public function remove(string|array $name)
149149
{
150-
foreach ((array) $name as $n) {
151-
unset($this->routes[$n], $this->priorities[$n], $this->aliases[$n]);
150+
$names = (array) $name;
151+
foreach ($names as $n) {
152+
unset($this->routes[$n], $this->priorities[$n]);
153+
}
154+
155+
foreach ($this->aliases as $k => $alias) {
156+
if (\in_array($alias->getId(), $names, true)) {
157+
unset($this->aliases[$k]);
158+
}
152159
}
153160
}
154161

Tests/RouteCollectionTest.php

+2
Original file line numberDiff line numberDiff line change
@@ -225,11 +225,13 @@ public function testRemove()
225225
$collection1->add('bar', $bar = new Route('/bar'));
226226
$collection->addCollection($collection1);
227227
$collection->add('last', $last = new Route('/last'));
228+
$collection->addAlias('ccc_my_custom_alias', 'foo');
228229

229230
$collection->remove('foo');
230231
$this->assertSame(['bar' => $bar, 'last' => $last], $collection->all(), '->remove() can remove a single route');
231232
$collection->remove(['bar', 'last']);
232233
$this->assertSame([], $collection->all(), '->remove() accepts an array and can remove multiple routes at once');
234+
$this->assertNull($collection->getAlias('ccc_my_custom_alias'));
233235
}
234236

235237
public function testSetHost()

0 commit comments

Comments
 (0)