Skip to content

Commit ce1c99d

Browse files
committed
Merge branch '4.4' into 5.0
* 4.4: Remove configuration block
2 parents 1c68fad + 7216a75 commit ce1c99d

File tree

1 file changed

+15
-26
lines changed

1 file changed

+15
-26
lines changed

service_container/service_decoration.rst

Lines changed: 15 additions & 26 deletions
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)