Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Factory named arguments wiring issue #48818

Copy link
Copy link
Closed
@v-m-i

Description

@v-m-i
Issue body actions

Symfony version(s) affected

6.2.3 and 5.4.16

Description

If we have a factory that looks like this:

final class ExampleFactory
{
    public function __invoke(
        string $first = '',
        string $second = '',
    ): ExampleService
    {...}
}

And if we use it like this (based on Passing Arguments to the Factory Method documentation):

    $services->set(ExampleFactory::class);

    $services
        ->set(ExampleCommand::class)
        ->arg('$service',
                inline_service(ExampleService::class)
                ->factory(service(ExampleFactory::class))
                ->args(
                    [
                        '$second' => 'second',
                    ]
                )
        )

The factory will be called with

$factory('second');

instead of

$factory('', 'second');

Tested on 6.2.3 and 5.4.16, but it probably affects other versions too.

How to reproduce

Bug reproducer: https://github.com/v-m-i/symfony-argument-bug

Possible Solution

No response

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

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