Skip to content

Commit 57e7101

Browse files
authored
Merge pull request #283 from symfony-cmf/any-iterable
any iterable of routes is ok
2 parents bec8b60 + 2defdca commit 57e7101

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
Changelog
22
=========
33

4+
3.0.3 (unreleased)
5+
------------------
6+
7+
* Fix regression: Any kind of iterable can be used with the ContentAwareGenerator
8+
49
3.0.2
510
-----
611

src/ContentAwareGenerator.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
use Symfony\Component\Routing\Exception\RouteNotFoundException;
1616
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
1717
use Symfony\Component\Routing\Route as SymfonyRoute;
18-
use Symfony\Component\Routing\RouteCollection;
1918

2019
/**
2120
* A generator that tries to generate routes from object, route names or
@@ -182,11 +181,11 @@ private function getRouteByContent(string $name, array &$parameters): SymfonyRou
182181
}
183182

184183
/**
185-
* @param RouteCollection|SymfonyRoute[] $routes
184+
* @param iterable<SymfonyRoute> $routes
186185
*
187186
* @return bool|SymfonyRoute false if no route requirement matches the provided locale
188187
*/
189-
private function getRouteByLocale(RouteCollection|array $routes, ?string $locale): bool|SymfonyRoute
188+
private function getRouteByLocale(iterable $routes, ?string $locale): bool|SymfonyRoute
190189
{
191190
foreach ($routes as $route) {
192191
if (!$route instanceof SymfonyRoute) {

src/RouteReferrersReadInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ interface RouteReferrersReadInterface
2222
/**
2323
* Get the routes that point to this content.
2424
*
25-
* @return Route[] Route instances that point to this content
25+
* @return iterable<Route> Route instances that point to this content
2626
*/
2727
public function getRoutes(): iterable;
2828
}

0 commit comments

Comments
 (0)