Skip to content

Route segment constraints should be inferred by controller method signatures #1708

@innocenzi

Description

@innocenzi

Description

For instance, this:

#[Get('/foo/{id}')]
public function __invoke(int $id): void
{
    dd($id);
}

Should not trigger this error:

Image

Instead, it should 404 just like /foo/{id:\d+} would do.

Benefits

It would be a better experience for end users to get 404s in those situations than 500s.

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions