Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Register argument name aliases #272

Merged
merged 2 commits into from
Jun 9, 2022

Conversation

IonBazan
Copy link
Contributor

@IonBazan IonBazan commented Jun 8, 2022

Registers Runner services for each check group as named argument aliases. It is now possible to inject a specific runner into a controller or other service by naming the argument to match the group name:

public function __construct(private Runner $fooRunner) {} // Injects liip_monitor.runner_foo

public function __construct(private Runner $defaultRunner) {} // Injects liip_monitor.runner_default

public function __construct(private Runner $runner) {} // Injects liip_monitor.runner (alias of liip_monitor.runner_default)

This is a common practice in Symfony world, used for example in symfony/http-client or league/flysystem-bundle.

@kbond
Copy link
Collaborator

kbond commented Jun 8, 2022

Should Runner be an alias for the default runner? Should your third example above just inject the default runner? I believe that's how (at least) symfony/http-client works.

@kbond kbond merged commit a2fb5d8 into liip:master Jun 9, 2022
@kbond
Copy link
Collaborator

kbond commented Jun 9, 2022

Thanks!

@IonBazan IonBazan deleted the feature/alias-parameter-names branch June 10, 2022 00:45
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants