mirror of
https://github.com/nextcloud/documentation.git
synced 2026-03-26 13:28:45 +07:00
chore: add line highlights to more DI examples
Signed-off-by: Josh <josh.t.richards@gmail.com>
This commit is contained in:
@@ -56,6 +56,7 @@ centralizes object creation logic.
|
||||
For example, consider the following pattern:
|
||||
|
||||
.. code-block:: php
|
||||
:emphasize-lines: 10, 14
|
||||
|
||||
/**
|
||||
* Without dependency injection:
|
||||
@@ -77,6 +78,7 @@ For example, consider the following pattern:
|
||||
With dependency injection, you would instead pass the dependency into the constructor:
|
||||
|
||||
.. code-block:: php
|
||||
:emphasize-lines: 10, 13, 15
|
||||
|
||||
/**
|
||||
* Using dependency injection:
|
||||
@@ -99,6 +101,7 @@ With dependency injection, you would instead pass the dependency into the constr
|
||||
Or, more succinctly, by using constructor property promotion (since PHP 7.4):
|
||||
|
||||
.. code-block:: php
|
||||
:emphasize-lines: 18
|
||||
|
||||
/**
|
||||
* Using dependency injection with constructor property promotion:
|
||||
|
||||
Reference in New Issue
Block a user