Skip to content

Commit 1eb2074

Browse files
committed
Merge branch '7.4' into 8.0
* 7.4: Minor tweak [DependencyInjection] Corrections and rephrasings
2 parents 2560647 + 5cdd220 commit 1eb2074

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

service_container/injection_types.rst

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
Types of Injection
22
==================
33

4-
Making a class's dependencies explicit and requiring that they be injected
5-
into it is a good way of making a class more reusable, testable and decoupled
6-
from others.
4+
Making a class's dependencies explicit and requiring that they are injected
5+
into it is a good way to make a class more reusable, testable, and decoupled
6+
from the rest of the code.
77

88
There are several ways that the dependencies can be injected. Each injection
99
point has advantages and disadvantages to consider, as well as different
@@ -88,10 +88,10 @@ service container configuration:
8888
There are several advantages to using constructor injection:
8989

9090
* If the dependency is a requirement and the class cannot work without it
91-
then injecting it via the constructor ensures it is present when the class
91+
then injecting it via the constructor ensures it is present especially when the class
9292
is used as the class cannot be constructed without it.
9393

94-
* The constructor is only ever called once when the object is created, so
94+
* The constructor is only called once when the object is created, so
9595
you can be sure that the dependency will not change during the object's
9696
lifetime.
9797

@@ -190,7 +190,7 @@ so, here's the advantages of immutable-setters:
190190
* Immutable setters works with optional dependencies, this way, if you don't need
191191
a dependency, the setter doesn't need to be called.
192192

193-
* Like the constructor injection, using immutable setters force the dependency to stay
193+
* Like the constructor injection, using immutable setters forces the dependency to stay
194194
the same during the lifetime of a service.
195195

196196
* This type of injection works well with traits as the service can be composed,
@@ -362,7 +362,7 @@ Another possibility is setting public fields of the class directly::
362362
->property('mailer', service('mailer'));
363363
};
364364
365-
There are mainly only disadvantages to using property injection, it is similar
365+
There are mainly only disadvantages to using property injection. It is similar
366366
to setter injection but with this additional important problem:
367367

368368
* You cannot control when the dependency is set at all, it can be changed

0 commit comments

Comments
 (0)