Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 974914f

Browse files
authoredAug 16, 2023
Remove paragraph about the impossibility to typehint a property
1 parent 4c955a6 commit 974914f

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed
 

‎service_container/injection_types.rst

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -364,15 +364,11 @@ Another possibility is setting public fields of the class directly::
364364
};
365365
366366
There are mainly only disadvantages to using property injection, it is similar
367-
to setter injection but with these additional important problems:
367+
to setter injection but with this additional important problem:
368368

369369
* You cannot control when the dependency is set at all, it can be changed
370370
at any point in the object's lifetime.
371371

372-
* You cannot use type hinting so you cannot be sure what dependency is injected
373-
except by writing into the class code to explicitly test the class instance
374-
before using it.
375-
376372
But, it is useful to know that this can be done with the service container,
377373
especially if you are working with code that is out of your control, such
378374
as in a third party library, which uses public properties for its dependencies.

0 commit comments

Comments
 (0)
Please sign in to comment.