-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[DI] Add way to register service with implicit name using the PHP DSL
- Loading branch information
1 parent
8cf8d16
commit 8b6945d
Showing
6 changed files
with
76 additions
and
4 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
11 changes: 11 additions & 0 deletions
11
src/Symfony/Component/DependencyInjection/Tests/Fixtures/StdClassDecorator.php
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,11 @@ | ||
<?php | ||
|
||
namespace Symfony\Component\DependencyInjection\Tests\Fixtures; | ||
|
||
final class StdClassDecorator | ||
{ | ||
public function __construct(\stdClass $foo) | ||
{ | ||
$this->foo = $foo; | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
src/Symfony/Component/DependencyInjection/Tests/Fixtures/config/anonymous.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,19 @@ | ||
|
||
services: | ||
service_container: | ||
class: Symfony\Component\DependencyInjection\ContainerInterface | ||
public: true | ||
synthetic: true | ||
listener_aggregator: | ||
class: Bar\FooClass | ||
public: true | ||
arguments: [!tagged listener] | ||
2_stdClass~uWxhfdJ: | ||
class: stdClass | ||
public: false | ||
tags: | ||
- { name: listener } | ||
decorated: | ||
class: Symfony\Component\DependencyInjection\Tests\Fixtures\StdClassDecorator | ||
public: true | ||
arguments: [!service { class: stdClass, public: false }] |
21 changes: 21 additions & 0 deletions
21
src/Symfony/Component/DependencyInjection/Tests/Fixtures/config/anonymous.php
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,21 @@ | ||
<?php | ||
|
||
namespace Symfony\Component\DependencyInjection\Loader\Configurator; | ||
|
||
use Bar\FooClass; | ||
use stdClass; | ||
use Symfony\Component\DependencyInjection\Tests\Fixtures\StdClassDecorator; | ||
|
||
return function (ContainerConfigurator $c) { | ||
$s = $c->services(); | ||
|
||
$s->set('decorated', stdClass::class); | ||
|
||
$s->set(null, StdClassDecorator::class) | ||
->decorate('decorated', 'decorator42') | ||
->args(array(ref('decorator42'))); | ||
|
||
$s->set('listener_aggregator', FooClass::class)->public()->args(array(tagged('listener'))); | ||
|
||
$s->set(null, stdClass::class)->tag('listener'); | ||
}; |
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