File tree Expand file tree Collapse file tree 1 file changed +15
-24
lines changed Expand file tree Collapse file tree 1 file changed +15
-24
lines changed Original file line number Diff line number Diff line change @@ -379,39 +379,30 @@ Three different behaviors are available:
379
379
When using ``null ``, you may have to update the decorator constructor in
380
380
order to make decorated dependency nullable.
381
381
382
- .. configuration-block ::
383
-
384
- .. code-block :: yaml
385
-
386
- App\Service\DecoratorService :
387
- decorates : Acme\OptionalBundle\Service\OptionalService
388
- decoration_on_invalid : null
389
- arguments : ['@App\Service\DecoratorService.inner']
382
+ .. code-block :: php
390
383
391
- .. code-block :: php
384
+ namespace App\Service;
392
385
393
- namespace App\ Service;
386
+ use Acme\OptionalBundle\ Service\OptionalService ;
394
387
395
- use Acme\OptionalBundle\Service\OptionalService;
388
+ class DecoratorService
389
+ {
390
+ private $decorated;
396
391
397
- class DecoratorService
392
+ public function __construct(?OptionalService $decorated)
398
393
{
399
- private $decorated;
394
+ $this->decorated = $decorated;
395
+ }
400
396
401
- public function __construct(?OptionalService $decorated)
402
- {
403
- $this->decorated = $decorated;
397
+ public function tellInterestingStuff(): string
398
+ {
399
+ if (!$this->decorated) {
400
+ return 'Just one interesting thing';
404
401
}
405
402
406
- public function tellInterestingStuff(): string
407
- {
408
- if (!$this->decorated) {
409
- return 'Just one interesting thing';
410
- }
411
-
412
- return $this->decorated->tellInterestingStuff().' + one more interesting thing';
413
- }
403
+ return $this->decorated->tellInterestingStuff().' + one more interesting thing';
414
404
}
405
+ }
415
406
416
407
.. note ::
417
408
You can’t perform that action at this time.
0 commit comments