The Wayback Machine - https://web.archive.org/web/20230128091040/https://github.com/symfony/symfony/pull/49126
Skip to content
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] Fix order of arguments when mixing positional and named ones #49126

Merged
merged 1 commit into from Jan 27, 2023

Conversation

nicolas-grekas
Copy link
Member

Q A
Branch? 5.4
Bug fix? yes
New feature? no
Deprecations? no
Tickets Fix #49118
License MIT
Doc PR -

stof
stof approved these changes Jan 27, 2023
@msteltenpool
Copy link

Tried to see if this would fix the latest builds. The below issue popped up, need to dive a bit deeper to understand and isolate this new issue.

Invalid constructor argument 2 for service "[REMOVED]": argument 1 must be defined before. Check your   
  service definition.                                            

@msteltenpool
Copy link

services.yaml

services:
    # default configuration for services in *this* file
    _defaults:
        public: true
        bind:
            $a: 'A'

    App\Controller\IndexController:
        arguments:
            $b: 'B'
            $c: 'C'

IndexController.php

class IndexController
{
    public function __construct($b, $a, $c)
    {
    }
}

Result:

!!  In DefinitionErrorExceptionPass.php line 54:
!!                                                                                 
!!    Invalid constructor argument 2 for service "App\Controller\IndexController"  
!!    : argument 1 must be defined before. Check your service definition.    

@nicolas-grekas
Copy link
Member Author

Thanks for checking. I'd need a reproducer to figure out what I missed. 🙏

@nicolas-grekas
Copy link
Member Author

Got it thanks. PR updated.

@msteltenpool
Copy link

Confirmed. No issues any more on my end. Thanks!

@nicolas-grekas nicolas-grekas merged commit 387a6b0 into symfony:5.4 Jan 27, 2023
9 of 11 checks passed
@nicolas-grekas nicolas-grekas deleted the di-args-order branch Jan 27, 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.

None yet

4 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.