@@ -199,8 +199,8 @@ LazyGhostTrait
199199
200200Ghost objects are empty objects, which see their properties populated the first
201201time any method is called. Thanks to :class: `Symfony\\ Component\\ VarExporter\\ LazyGhostTrait `,
202- the implementation of the lazy mechanism is eased. In the following example, we are
203- defining the ``$hash `` property as lazy. We also declare that the ``MyLazyObject::computeHash() ``
202+ the implementation of the lazy mechanism is eased. In the following example, the
203+ ``$hash `` property is defined as lazy. Also, the ``MyLazyObject::computeHash() ``
204204method should be called only when ``$hash ``'s value need to be known::
205205
206206 namespace App\Hash;
@@ -269,12 +269,12 @@ convert non-lazy classes to lazy ones::
269269 $instance->validateHash();
270270 });
271271
272- While you never query ``$processor->hash `` value, heavy methods will never be triggered.
273- But still, the ``$processor `` object exists and can be used in your code, passed to
274- methods, functions, etc.
272+ While you never query ``$processor->hash `` value, heavy methods will never be
273+ triggered. But still, the ``$processor `` object exists and can be used in your
274+ code, passed to methods, functions, etc.
275275
276- Additionally and by adding two arguments to initializer function, it is possible to initialize
277- properties one-by-one::
276+ Additionally and by adding two arguments to the initializer function, it is
277+ possible to initialize properties one-by-one::
278278
279279 $processor = LazyHashProcessor::createLazyGhost(initializer: function (HashProcessor $instance, string $propertyName, ?string $propertyScope): mixed {
280280 if (HashProcessor::class === $propertyScope && 'hash' === $propertyName) {
@@ -284,9 +284,9 @@ properties one-by-one::
284284 // Then you can add more logic for the other properties
285285 });
286286
287- Ghost objects unfortunately can't work with abstract classes but also internal PHP classes.
288- Nevertheless, the VarExporter component covers this need with the help of to
289- :ref: `Virtual Proxies <var-exporter_virtual-proxies >`.
287+ Ghost objects unfortunately can't work with abstract classes or internal PHP
288+ classes. Nevertheless, the VarExporter component covers this need with the help
289+ of :ref: `Virtual Proxies <var-exporter_virtual-proxies >`.
290290
291291.. versionadded :: 6.2
292292
@@ -301,9 +301,9 @@ The purpose of virtual proxies in the same one as
301301:ref: `ghost objects <var-exporter_ghost-objects >`, but their internal behavior is
302302totally different. Where ghost objects requires to extend a base class, virtual
303303proxies take advantage of the **Liskov Substitution principle **. This principle
304- describes that if two objects are implementing the same interface, you can swap between
305- the different implementations without breaking your application. This is what virtual
306- proxies take advantage of. To use virtual proxies, you may use
304+ describes that if two objects are implementing the same interface, you can swap
305+ between the different implementations without breaking your application. This is
306+ what virtual proxies take advantage of. To use virtual proxies, you may use
307307:class: `Symfony\\ Component\\ VarExporter\\ ProxyHelper ` to generate proxy's class
308308code::
309309
@@ -353,9 +353,9 @@ code::
353353 return $instance;
354354 });
355355
356- Just like ghost objects, while you never query ``$processor->hash ``, its value will not be computed.
357- The main difference with ghost objects is that this time, we created a proxy of an abstract class.
358- This also works with internal PHP class.
356+ Just like ghost objects, while you never query ``$processor->hash ``, its value
357+ will not be computed. The main difference with ghost objects is that this time,
358+ a proxy of an abstract class was created. This also works with internal PHP class.
359359
360360.. versionadded :: 6.2
361361
0 commit comments