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:
372372 .. caution ::
373373
374374 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::
376376
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;
387378
388- namespace App\ Service;
379+ use Acme\OptionalBundle\ Service\OptionalService ;
389380
390- use Acme\OptionalBundle\Service\OptionalService;
381+ class DecoratorService
382+ {
383+ private $decorated;
391384
392- class DecoratorService
385+ public function __construct(?OptionalService $decorated)
393386 {
394- private $decorated;
387+ $this->decorated = $decorated;
388+ }
395389
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';
399394 }
400395
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';
409397 }
398+ }
410399
411400.. note ::
412401
You can’t perform that action at this time.
0 commit comments