Skip to content

Conversation

@nicolas-grekas
Copy link
Member

@nicolas-grekas nicolas-grekas commented Mar 4, 2017

Q A
Branch? master
Bug fix? no
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets -
License MIT
Doc PR -

Leveraging the new "id/alias <> class" convention that replaces autowiring types.

@nicolas-grekas nicolas-grekas added this to the 3.3 milestone Mar 4, 2017
@nicolas-grekas nicolas-grekas changed the title [DI] Replace "autowired." prefix by "autoregistered" tag for services… [DI] Replace "autowired." prefix by "autoregistered" tag for services created by AutowirePass Mar 4, 2017
@xabbuh
Copy link
Member

xabbuh commented Mar 5, 2017

👍 LGTM

@xabbuh
Copy link
Member

xabbuh commented Mar 5, 2017

@nicolasgrekas This change together with #21873 could lead to confusing behaviour (see my comment there), couldn't it?

@nicolas-grekas
Copy link
Member Author

@xabbuh to me, this change doesn't introduce any new behavior, thus can't lead to anything new in #21873: even without this PR, autoregistered services have always been valid by-type candidates for autowiring.

@xabbuh
Copy link
Member

xabbuh commented Mar 5, 2017

The difference is that you may want to register a service named Foo\Bar explicitly now that the id defaults to the class name. So you will get an error when you forget to register it. But with this change Foo\Bar could be created implicitly depending on whether another autowired service triggered the auto registration.

@nicolas-grekas
Copy link
Member Author

OK - and since this change now misses a purpose (I don't think I need it anymore now that I'm working on another approach) - I'm closing. Thanks for the feedback.

@nicolas-grekas nicolas-grekas deleted the no-autow-prefix branch March 5, 2017 12:56
@theofidry
Copy link
Contributor

The behaviour is:

  • If you have a Foo\Bar service already registered, then the PSR-4 loading won't auto-register a new Foo\Bar service
  • If a Foo\Bar service has been auto-registered by a PSR-4 loading and you re-declare a new Foo\Bar later on, you override the service as expected

@nicolas-grekas could you confirm that this is correct or I misunderstood the change? (And if that's correct then @xabbuh I'm not sure to see what's confusing)

@nicolas-grekas
Copy link
Member Author

@theofidry this is not related to psr4, but to autoregistration of type-hints as services - @xabbuh is correct :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants