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 @@ -372,41 +372,30 @@ Three different behaviors are available:
372
372
.. caution ::
373
373
374
374
When using ``null ``, you may have to update the decorator constructor in
375
- order to make decorated dependency nullable.
375
+ order to make decorated dependency nullable::
376
376
377
- .. configuration-block ::
378
-
379
- .. code-block :: yaml
380
-
381
- App\Service\DecoratorService :
382
- decorates : Acme\OptionalBundle\Service\OptionalService
383
- decoration_on_invalid : null
384
- arguments : ['@App\Service\DecoratorService.inner']
385
-
386
- .. code-block :: php
377
+ namespace App\Service;
387
378
388
- namespace App\ Service;
379
+ use Acme\OptionalBundle\ Service\OptionalService ;
389
380
390
- use Acme\OptionalBundle\Service\OptionalService;
381
+ class DecoratorService
382
+ {
383
+ private $decorated;
391
384
392
- class DecoratorService
385
+ public function __construct(?OptionalService $decorated)
393
386
{
394
- private $decorated;
387
+ $this->decorated = $decorated;
388
+ }
395
389
396
- public function __construct(?OptionalService $decorated)
397
- {
398
- $this->decorated = $decorated;
390
+ public function tellInterestingStuff(): string
391
+ {
392
+ if (!$this->decorated) {
393
+ return 'Just one interesting thing';
399
394
}
400
395
401
- public function tellInterestingStuff(): string
402
- {
403
- if (!$this->decorated) {
404
- return 'Just one interesting thing';
405
- }
406
-
407
- return $this->decorated->tellInterestingStuff().' + one more interesting thing';
408
- }
396
+ return $this->decorated->tellInterestingStuff().' + one more interesting thing';
409
397
}
398
+ }
410
399
411
400
.. note ::
412
401
You can’t perform that action at this time.
0 commit comments