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

Skip to content

[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

Merged

Conversation

upyx
Copy link
Contributor

@upyx upyx commented Dec 16, 2022

Q A
Branch? 6.3
Bug fix? no
New feature? no
Deprecations? yes
Tickets Deprecation befor #48653
License MIT
Doc PR symfony/symfony-docs#17576

It deprecates undefined/wrong behaviour of https://symfony.com/doc/current/service_container/service_subscribers_locators.html#defining-a-service-locator

return new ServiceLocatorArgument(AbstractConfigurator::processValue($values, true));
$values = AbstractConfigurator::processValue($values, true);

if (isset($values[0])) {
Copy link
Member

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.

Copy link
Contributor Author

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.

@upyx upyx force-pushed the ids-in-service-locator-deprecations branch from afac82d to 249b26d Compare December 20, 2022 17:57
@upyx upyx changed the title [DependencyInjection] Deprecate numeric keys in "service_locator" config [DependencyInjection] Deprecate integer keys in "service_locator" config Dec 20, 2022
@nicolas-grekas nicolas-grekas force-pushed the ids-in-service-locator-deprecations branch from 249b26d to 57c2365 Compare December 22, 2022 15:53
@nicolas-grekas
Copy link
Member

Thank you @upyx.

@nicolas-grekas nicolas-grekas merged commit ff6913e into symfony:6.3 Dec 22, 2022
javiereguiluz added a commit to symfony/symfony-docs that referenced this pull request Feb 21, 2023
…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
@fabpot fabpot mentioned this pull request May 1, 2023
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.

5 participants