Skip to content

Commit 7216a75

Browse files
committed
minor #13160 Fix: remove decoration-on-invalid unneeded configuration block (mtarld)
This PR was merged into the 4.4 branch. Discussion ---------- Fix: remove decoration-on-invalid unneeded configuration block Commits ------- 463d1e3 Remove configuration block
2 parents c59a2de + 463d1e3 commit 7216a75

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
@@ -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

0 commit comments

Comments
 (0)