ReflectionClass::resetAsLazyProxy
(PHP 8 >= 8.4.0)
ReflectionClass::resetAsLazyProxy — Resets an object and marks it as lazy
说明
The behavior of this method is the same as ReflectionClass::resetAsLazyGhost() except that it uses the proxy strategy.
The object
itself becomes the proxy. Similarly to
ReflectionClass::resetAsLazyGhost(), the object is not
replaced by an other one, and its identity does not change, even after
initialization. The proxy and the real instance are distinct objects, with
distinct identities.
参数
object
- A non-lazy object, or an initialized lazy object.
factory
- An factory callback with the same signature and purpose as in ReflectionClass::newLazyProxy().
options
-
options
can be a combination of the following flags:-
ReflectionClass::SKIP_INITIALIZATION_ON_SERIALIZE
- By default, serializing a lazy object triggers its initialization. Setting this flag prevents initialization, allowing lazy objects to be serialized without being initialized.
-
ReflectionClass::SKIP_DESTRUCTOR
- By default, the object destructor is called (if any) before making it lazy. This provides safety regarding any preexisting state in the object. This flag disables that behavior, allowing objects to be reset as lazy without calling the destructor.
-
返回值
没有返回值。
错误/异常
A ReflectionException if the object is lazy and non-initialized.
An Error if the object is being initialized, or if the
object properties are being iterated with
foreach
.
参见
- ReflectionClass::newLazyProxy() - Creates a new lazy proxy instance
- ReflectionClass::resetAsLazyGhost() - Resets an object and marks it as lazy
用户贡献的备注
备份地址:http://www.lvesu.com/blog/php/reflectionclass.resetaslazyproxy.php