Skip to content

Commit

Permalink
any iterable of routes is ok
Browse files Browse the repository at this point in the history
  • Loading branch information
dbu committed Feb 19, 2024
1 parent bec8b60 commit 2defdca
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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 2defdca

Please sign in to comment.