Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature #26768 [DI] Allow autoconfigured calls in PHP (Gary PEGEOT, G…
…aryPEGEOT) This PR was merged into the 4.1-dev branch. Discussion ---------- [DI] Allow autoconfigured calls in PHP | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | yes | BC breaks? |no | Deprecations? | no | Tests pass? | yes | Fixed tickets | | License | MIT | Doc PR | Allow to auto-configured method calls like: ```php $container->registerForAutoconfiguration(LoggerAwareInterface::class)->addMethodCall('setLogger', array(new Reference(LoggerInterface::class))); ``` Commits ------- 1d811cb Add test for both _intanceof and manual method setting. 71bf3ce CS fix 15c45ee Add more test-cases 2612f81 Allow autoconfigured calls in PHP.
- Loading branch information
Showing
5 changed files
with
62 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
...ent/DependencyInjection/Tests/Fixtures/yaml/integration/instanceof_and_calls/expected.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
services: | ||
# main_service should look like this in the end | ||
main_service_expected: | ||
class: Symfony\Component\DependencyInjection\Tests\Compiler\IntegrationTestStub | ||
public: true | ||
autoconfigure: true | ||
calls: | ||
- [setSunshine, [supernova]] | ||
- [setSunshine, [warm]] | ||
|
9 changes: 9 additions & 0 deletions
9
...mponent/DependencyInjection/Tests/Fixtures/yaml/integration/instanceof_and_calls/main.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
services: | ||
_instanceof: | ||
Symfony\Component\DependencyInjection\Tests\Compiler\IntegrationTestStubParent: | ||
calls: | ||
- [setSunshine, [warm]] | ||
main_service: | ||
class: Symfony\Component\DependencyInjection\Tests\Compiler\IntegrationTestStub | ||
autoconfigure: true | ||
public: true |