Skip to content

Commit

Permalink
Merge pull request #283 from symfony-cmf/any-iterable
Browse files Browse the repository at this point in the history
any iterable of routes is ok
  • Loading branch information
dbu committed Feb 19, 2024
2 parents bec8b60 + 2defdca commit 57e7101
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
@@ -1,6 +1,11 @@
Changelog
=========

3.0.3 (unreleased)
------------------

* Fix regression: Any kind of iterable can be used with the ContentAwareGenerator

3.0.2
-----

Expand Down
5 changes: 2 additions & 3 deletions src/ContentAwareGenerator.php
Expand Up @@ -15,7 +15,6 @@
use Symfony\Component\Routing\Exception\RouteNotFoundException;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use Symfony\Component\Routing\Route as SymfonyRoute;
use Symfony\Component\Routing\RouteCollection;

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

/**
* @param RouteCollection|SymfonyRoute[] $routes
* @param iterable<SymfonyRoute> $routes
*
* @return bool|SymfonyRoute false if no route requirement matches the provided locale
*/
private function getRouteByLocale(RouteCollection|array $routes, ?string $locale): bool|SymfonyRoute
private function getRouteByLocale(iterable $routes, ?string $locale): bool|SymfonyRoute
{
foreach ($routes as $route) {
if (!$route instanceof SymfonyRoute) {
Expand Down
2 changes: 1 addition & 1 deletion src/RouteReferrersReadInterface.php
Expand Up @@ -22,7 +22,7 @@ interface RouteReferrersReadInterface
/**
* Get the routes that point to this content.
*
* @return Route[] Route instances that point to this content
* @return iterable<Route> Route instances that point to this content
*/
public function getRoutes(): iterable;
}

0 comments on commit 57e7101

Please sign in to comment.