Skip to content

Adapt to Yii Router 4 #255

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@
"minimum-stability": "dev",
"prefer-stable": true,
"require": {
"php": "~8.1.0 || ~8.2.0 || ~8.3.0 || ~8.4.0",
"php": "8.1 - 8.4",
"psr/container": "^1.0 || ^2.0",
"yiisoft/arrays": "^3.1",
"yiisoft/data": "dev-master",
"yiisoft/friendly-exception": "^1.0",
"yiisoft/html": "^3.0",
"yiisoft/injector": "^1.2",
"yiisoft/router": "^3.0",
"yiisoft/router": "^4.0",
"yiisoft/translator": "^3.0",
"yiisoft/validator": "^2.0",
"yiisoft/view": "^12.0.0",
Expand All @@ -52,11 +52,11 @@
"rector/rector": "^2.0.9",
"roave/infection-static-analysis-plugin": "^1.35",
"spatie/phpunit-watcher": "^1.24",
"vimeo/psalm": "^5.26.1 || ^6.8.6",
"vimeo/psalm": "^5.26.1 || ^6.8.8",
"yiisoft/di": "^1.3",
"yiisoft/event-dispatcher": "^1.1",
"yiisoft/log": "^2.1",
"yiisoft/router-fastroute": "^3.1.0",
"yiisoft/router-fastroute": "^4.0",
"yiisoft/test-support": "^3.0.2",
"yiisoft/translator-message-php": "^1.1.1"
},
Expand Down
12 changes: 5 additions & 7 deletions tests/Support/Mock.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
use Psr\EventDispatcher\EventDispatcherInterface;
use Yiisoft\Router\CurrentRoute;
use Yiisoft\Router\FastRoute\UrlGenerator;
use Yiisoft\Router\Group;
use Yiisoft\Router\Route;
use Yiisoft\Router\RouteCollection;
use Yiisoft\Router\RouteCollectionInterface;
Expand All @@ -35,8 +34,8 @@ public static function category(string $category, string $path): CategorySource

public static function translator(
string $locale,
string $fallbackLocale = null,
EventDispatcherInterface $eventDispatcher = null
?string $fallbackLocale = null,
?EventDispatcherInterface $eventDispatcher = null
): TranslatorInterface {
return new Translator($locale, $fallbackLocale, 'app', $eventDispatcher);
}
Expand All @@ -46,8 +45,8 @@ public static function translator(
*/
public static function urlGenerator(
array $routes = [],
CurrentRoute $currentRoute = null,
RouteParser $parser = null
?CurrentRoute $currentRoute = null,
?RouteParser $parser = null
): UrlGeneratorInterface {
if ($routes === []) {
$routes = [
Expand All @@ -69,9 +68,8 @@ public static function urlGenerator(
*/
private static function routeCollection(array $routes): RouteCollectionInterface
{
$rootGroup = Group::create()->routes(...$routes);
$collector = new RouteCollector();
$collector->addGroup($rootGroup);
$collector->addRoute(...$routes);

return new RouteCollection($collector);
}
Expand Down
Loading