Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commite3950df

Browse files
committed
Clarify Lazy Services usage with final & readonly classes
1 parentc850209 commite3950df

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

‎service_container/lazy_services.rst

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ until you interact with the proxy in some way.
2323

2424
..warning::
2525

26-
Lazy servicesdo notsupport `final`_ or ``readonly`` classes, but you can use
27-
`Interface Proxifying`_ to work around this limitation.
26+
Lazy services supportfor`final`_ or ``readonly`` classes was introduced in Symfony 7.3, and
27+
requires PHP 8.4 or newer. You can use`Interface Proxifying`_ to work around this limitation.
2828

2929
.. _lazy-services_configuration:
3030

@@ -145,9 +145,9 @@ It defines an optional parameter used to define interfaces for proxy and interse
145145
Interface Proxifying
146146
--------------------
147147

148-
Under the hood,proxies generated to lazily load services inherit from the class
149-
used bythe service. However, sometimes this is not possible at all (e.g. because
150-
the class is`final`_and can not be extended)ornot convenient.
148+
Under the hood,lazy services leverage `lazy object`_ since PHP 8.4 and Symfony 7.3. In earlier version,
149+
proxy objects inheriting fromthe service's class are generated. One of the limitations of proxy objects
150+
is inability to extend`final`_ or``readonly`` classes.
151151

152152
To workaround this limitation, you can configure a proxy to only implement
153153
specific interfaces.
@@ -231,4 +231,5 @@ implement multiple interfaces by adding new "proxy" tags.
231231

232232
.. _`ghost object`:https://en.wikipedia.org/wiki/Lazy_loading#Ghost
233233
.. _`final`:https://www.php.net/manual/en/language.oop5.final.php
234+
.. _`lazy objects`:https://www.php.net/manual/en/language.oop5.lazy-objects.php
234235
.. _`proxy`:https://en.wikipedia.org/wiki/Proxy_pattern

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp