Skip to content

Confusing exception when using action injection + casing mismatch in routing file #28254

@ostrolucky

Description

@ostrolucky

Having such action:

public function index(Request $request, PostRepository $posts): Response

and such routing:

index:
    path: /en/blog
    controller: App\Controller\BlogController::Index

yields

Controller "App\Controller\BlogController::Index()" requires that you provide a value for the "$posts" argument. Either the argument is nullable and no null value has been provided, no default value has been provided or because there is a non optional argument after this one.

This is because user made a typo in routing and used BlogController::Index, instead of BlogController::index

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions