Skip to content

Resolver: autowire variadic parameters#244

Open
jiripudil wants to merge 1 commit intonette:masterfrom
jiripudil:feature/variadic-autowiring
Open

Resolver: autowire variadic parameters#244
jiripudil wants to merge 1 commit intonette:masterfrom
jiripudil:feature/variadic-autowiring

Conversation

@jiripudil
Copy link
Contributor

  • new feature
  • BC break: no
  • doc PR: todo

Hi there, in addition to autowiring arrays of services via annotations, I think it might be useful to autowire variadic arguments as well – it's a very similar mechanism, but with added type safety on the language level:

final class ApplicationPermissionsConfigurator
{
    /** @var ModulePermissionsConfigurator[] */
    private array $moduleConfigurators;

    public function __construct(ModulePermissionsConfigurator ...$moduleConfigurators) {
        $this->moduleConfigurators = $moduleConfigurators;
    }
}

@dg dg force-pushed the master branch 9 times, most recently from 47688f3 to 4c651dc Compare November 4, 2020 15:16
@dg dg force-pushed the master branch 4 times, most recently from e14a8ec to 5db4398 Compare November 6, 2020 00:54
@dg dg force-pushed the master branch 8 times, most recently from 9b4240b to e639ccf Compare November 25, 2020 22:43
@dg dg force-pushed the master branch 4 times, most recently from 997b4fc to a1e346d Compare December 20, 2020 22:24
@dg dg force-pushed the master branch 2 times, most recently from d09b7b3 to 9a6cd01 Compare January 31, 2021 22:05
@dg dg force-pushed the master branch 5 times, most recently from e04f67d to 0e6b25c Compare March 4, 2021 19:58
@dg dg force-pushed the master branch 16 times, most recently from 68f623d to e517eae Compare August 31, 2021 09:54
@dg dg force-pushed the master branch 5 times, most recently from acdc68f to 49c4af0 Compare September 13, 2021 11:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants