Skip to content

[DependencyInjection] Fix manual ordering of arguments #21700

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

Closed
wants to merge 3 commits into from

Conversation

GuilhemN
Copy link
Contributor

@GuilhemN GuilhemN commented Feb 21, 2017

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

I think we expect arguments to be reordered when the keys are numeric so here is the fix :)

ping @nicolas-grekas

@nicolas-grekas
Copy link
Member

nope, that's on purpose, to preserve bc

@GuilhemN
Copy link
Contributor Author

ok, updated to a bc layer then

@nicolas-grekas
Copy link
Member

why should we change something here? what's the benefit?

@GuilhemN
Copy link
Contributor Author

If you want to mix named arguments with manual indexes, you'll currently get something weird:

class Foo {
    public function __construct ($foo, $bar) {}
}
services:
    Foo:
        $bar: 'bar'
        0: 'foo'

@Foo will be instantiated as new Foo('bar', 'foo')... Imo we should either not support mixing named/indexed arguments or consider the indexes.

@nicolas-grekas
Copy link
Member

@GuilhemN
Copy link
Contributor Author

GuilhemN commented Feb 21, 2017

Yes I added another test case to show it.

@GuilhemN
Copy link
Contributor Author

Closing as discussed ;)

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.

3 participants