8000 [Routing] fixed previous merge · symfony/symfony@c67cf8b · GitHub
[go: up one dir, main page]

Skip to content

Commit c67cf8b

Browse files
committed
[Routing] fixed previous merge
1 parent db9a8c1 commit c67cf8b

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/Symfony/Component/Routing/RouteCollection.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,12 @@ public function getIterator()
9595
*/
9696
public function count()
9797
{
98-
return count($this->routes->all());
98+
$count = 0;
99+
foreach ($this->routes as $route) {
100+
$count += $route instanceof RouteCollection ? count($route) : 1;
101+
}
102+
103+
return $count;
99104
}
100105

101106
/**

src/Symfony/Component/Routing/Tests/RouteCollectionTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public function testCount()
8383

8484
$collection1 = new RouteCollection();
8585
$collection->addCollection($collection1);
86-
$collection1->add('foo', new Route('/foo1'));
86+
$collection1->add('foo1', new Route('/foo1'));
8787

8888
$this->assertCount(2, $collection);
8989
}

0 commit comments

Comments
 (0)
0