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