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:
377377 .. caution ::
378378
379379 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::
381381
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;
392383
393- namespace App\ Service;
384+ use Acme\OptionalBundle\ Service\OptionalService ;
394385
395- use Acme\OptionalBundle\Service\OptionalService;
386+ class DecoratorService
387+ {
388+ private $decorated;
396389
397- class DecoratorService
390+ public function __construct(?OptionalService $decorated)
398391 {
399- private $decorated;
392+ $this->decorated = $decorated;
393+ }
400394
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';
404399 }
405400
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';
414402 }
403+ }
415404
416405.. note ::
417406
You can’t perform that action at this time.
0 commit comments