Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[DI] Service auto-registration error message still exists #25959

Closed
@weaverryan

Description

@weaverryan
Q A
Bug report? yes
Feature request? no
BC Break report? no
RFC? no
Symfony version 3.4

Just a minor thing: in 4.0 (or 3.4 with strict mode on), we removed the "service auto-registration" functionality of autowiring (i.e. where autowiring would automatically register a service for you if non existed for a class). But, the error message and some related code still exists:

return ' It cannot be auto-registered because it is from a different root namespace.';

Unless I'm mistaken, this stuff should be removed in 4.0: the error message should not mention anything about auto-registration :). But, it's not as simple as just removing the if statement - in practice, the final error doesn't quite make sense.

To repeat the situation:

  1. Type-hint some vendor class (e.g. MyLib\FooClient that has a service in the container (e.g. my_lib.foo_client, but does not have an autowireable alias.

  2. The error will mention auto-registration. But if you simply remove the last elseif, the final message will also not make sense: it should suggest adding an alias from MyLib\FooClient to my_lib.foo_client.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions