Skip to content

[DX][Debug] Fix a service by its class nameΒ #28143

Closed
@theofidry

Description

@theofidry

Given the following service registered:

services:
    Acme\Foo: ~

Running the following will fail:

bin/console debug:container Acme\Foo

The reason being the correct way would be to escape the backslash:

bin/console debug:container Acme\\Foo
# or
bin/console debug:container "Acme\Foo"

I however find a bit tedious and unfriendly: I register a service by a class but if I copy/paste the class I won't find the service... Plus it's a bit annoying manually escape if there is a lot of backslashes. Maybe the debug:container command could be made a bit smarter to understand the AcmeFoo is similar to Acme\Foo.

Edit: The DX issue here IMO is that the simple copy/paste does not work (you need to escape the service name) and that can lead to confusion. Maybe the error message could help a bit with it

Metadata

Metadata

Assignees

No one assigned

    Labels

    DXDX = Developer eXperience (anything that improves the experience of using Symfony)DependencyInjectionHelp wantedIssues and PRs which are looking for volunteers to complete them.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions