Skip to content

Commit e23d6da

Browse files
committed
RouteList: Countable and IteratorAggregate are deprecated
1 parent c2c41c2 commit e23d6da

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

src/Application/Routers/RouteList.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,10 @@ public function getModule(): ?string
9393
}
9494

9595

96+
/** @deprecated */
9697
public function count(): int
9798
{
99+
trigger_error(__METHOD__ . '() is deprecated.', E_USER_DEPRECATED);
98100
return count($this->getRouters());
99101
}
100102

@@ -149,8 +151,10 @@ public function offsetUnset($index): void
149151
}
150152

151153

154+
/** @deprecated */
152155
public function getIterator(): \ArrayIterator
153156
{
157+
trigger_error(__METHOD__ . '() is deprecated, use getRouters().', E_USER_DEPRECATED);
154158
return new \ArrayIterator($this->getRouters());
155159
}
156160
}

src/Bridges/ApplicationTracy/RoutingPanel.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ private function analyse(Nette\Routing\Router $router, string $module = ''): voi
100100
{
101101
if ($router instanceof Routers\RouteList) {
102102
if ($router->match($this->httpRequest)) {
103-
foreach ($router as $subRouter) {
103+
foreach ($router->getRouters() as $subRouter) {
104104
$this->analyse($subRouter, $module . $router->getModule());
105105
}
106106
}

tests/Bridges.DI/RoutingExtension.basic.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ test(function () {
3636
$container = new Container1;
3737
$router = $container->getService('router');
3838
Assert::type(Nette\Application\Routers\RouteList::class, $router);
39-
Assert::count(2, $router);
39+
@Assert::count(2, $router); // @ is deprecated
4040
Assert::same('index.php', $router[0]->getMask());
4141
Assert::same('item/<id>', $router[1]->getMask());
4242

0 commit comments

Comments
 (0)