-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[DependencyInjection] Deprecate integer keys in "service_locator" config #48686
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[DependencyInjection] Deprecate integer keys in "service_locator" config #48686
Conversation
return new ServiceLocatorArgument(AbstractConfigurator::processValue($values, true)); | ||
$values = AbstractConfigurator::processValue($values, true); | ||
|
||
if (isset($values[0])) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can use array_is_list
to detect numerically indexed arrays. But for a more complete validation, all key needs to be strings.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see, it's a bit confusing. It's possible to mix strings and sequential integers and non-sequential integers. The only sequential integers from zero (or undefined keys) are deprecated and will be replaced with IDs.
I will try to improve the messages. However, I could use help.
src/Symfony/Component/DependencyInjection/Loader/Configurator/ContainerConfigurator.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/DependencyInjection/Loader/Configurator/ContainerConfigurator.php
Outdated
Show resolved
Hide resolved
afac82d
to
249b26d
Compare
249b26d
to
57c2365
Compare
Thank you @upyx. |
…pyx) This PR was squashed before being merged into the 5.4 branch. Discussion ---------- [DependencyInjection] Remove not implemented behavior Currently numeric keys are used, but it will be deprecated and changed in 7.0. Deprecation: symfony/symfony#48686 New behavior: symfony/symfony#48653 Commits ------- a8770de [DependencyInjection] Remove not implemented behavior
It deprecates undefined/wrong behaviour of https://symfony.com/doc/current/service_container/service_subscribers_locators.html#defining-a-service-locator