Skip to content
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

[spiral/router] Required parameters are not required for uri generation #1162

Open
MartkCz opened this issue Oct 26, 2024 · 1 comment
Open
Labels

Comments

@MartkCz
Copy link
Contributor

MartkCz commented Oct 26, 2024

Description

When a parameter is not passed, even though it is required in a route, it is ignored without raising an error.

How To Reproduce

$routes->add('articles.list', '/articles')
    ->callable(fn () => new Response());
$routes->add('articles.detail', '/articles/<id>')
    ->callable(fn () => new Response());

var_dump($router->uri('articles.detail')->getPath()); // == /articles - Better solution is exception or warning
var_dump($router->uri('articles.list')->getPath()); // == /articles
var_dump($router->uri('articles.detail', ['id' => 1])->getPath()); // == /articles/1 
@MartkCz MartkCz added the Bug label Oct 26, 2024
@roxblnfk
Copy link
Member

@butschster hi
Could you comment the issue? Is it a bug or a feature?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants