File: resetaslazyghost.xml

package info (click to toggle)
php-doc 20241205~git.dfcbb86%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 70,956 kB
  • sloc: xml: 968,269; php: 23,883; javascript: 671; sh: 177; makefile: 37
file content (167 lines) | stat: -rw-r--r-- 5,958 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
<?xml version="1.0" encoding="utf-8"?>
<refentry xml:id="reflectionclass.resetaslazyghost" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
 <refnamediv>
  <refname>ReflectionClass::resetAsLazyGhost</refname>
  <refpurpose>Resets an object and marks it as lazy</refpurpose>
 </refnamediv>

 <refsect1 role="description">
  &reftitle.description;
  <methodsynopsis role="ReflectionClass">
   <modifier>public</modifier> <type>void</type><methodname>ReflectionClass::resetAsLazyGhost</methodname>
   <methodparam><type>object</type><parameter>object</parameter></methodparam>
   <methodparam><type>callable</type><parameter>initializer</parameter></methodparam>
   <methodparam choice="opt"><type>int</type><parameter>options</parameter><initializer>0</initializer></methodparam>
  </methodsynopsis>
  <simpara>
   Resets an existing <parameter>object</parameter> and marks it as lazy.
  </simpara>
  <simpara>
   The object's destructor is called (if one exists) unless the
   <constant>ReflectionClass::SKIP_DESTRUCTOR</constant> flag is specified. In
   the special case where the object is an initialized proxy, the real instance
   is detached from the proxy. If the real instance is no longer referenced
   elsewhere, its destructor is called regardless of the
   <constant>SKIP_DESTRUCTOR</constant> flag.
  </simpara>
  <simpara>
   Dynamic properties are removed, and the value of properties declared on the
   class is discarded as though <function>unset</function> was called, and
   marked as lazy. This implies that if the object is an instance of a subclass
   with additional properties, these properties are not modified and not made
   lazy.
   <link linkend="language.oop5.properties.readonly-properties">Readonly
   properties</link> are also not modified and not made lazy if they are
   <literal>final</literal> or the class itself is <literal>final</literal>.
  </simpara>
  <simpara>
   If no properties was marked lazy, the object is is not marked as lazy. See
   also
   <link linkend="language.oop5.lazy-objects.lifecycle">Lazy Objects
   Lifecycle</link>.
  </simpara>
  <simpara>
   Otherwise, after calling this method, the behavior of the object is the same
   as an object created by
   <methodname>ReflectionClass::newLazyGhost</methodname> (except for
   subclass and readonly properties, as described above).
  </simpara>
  <simpara>
   The object is not replaced by an other one, and its identity remains
   unchanged. Functionality such as <function>spl_object_id</function>,
   <function>spl_object_hash</function>,
   <classname>SplObjectStorage</classname>, <classname>WeakMap</classname>,
   <classname>WeakReference</classname>, or
   <link linkend="language.oop5.object-comparison">the identity operator
   (<literal>===</literal>)</link> are unaffected.
  </simpara>
 </refsect1>

 <refsect1 role="parameters">
  &reftitle.parameters;
  <variablelist>
   <varlistentry>
    <term><parameter>object</parameter></term>
    <listitem>
     <simpara>
      A non-lazy object, or an initialized lazy object.
     </simpara>
    </listitem>
   </varlistentry>
   <varlistentry>
    <term><parameter>initializer</parameter></term>
    <listitem>
     <simpara>
      An initializer callback with the same signature and purpose as in
      <methodname>ReflectionClass::newLazyGhost</methodname>.
     </simpara>
    </listitem>
   </varlistentry>
   <varlistentry xml:id="reflectionclass.resetaslazyghost.parameters.options">
    <term><parameter>options</parameter></term>
    <listitem>
     <para>
      <parameter>options</parameter> can be a combination of the following
      flags:
      <variablelist>
       <varlistentry>
        <term>
         <constant>ReflectionClass::SKIP_INITIALIZATION_ON_SERIALIZE</constant>
        </term>
        <listitem>
         <simpara>
          By default, serializing a lazy object triggers its
          initialization. Setting this flag prevents initialization, allowing
          lazy objects to be serialized without being initialized.
         </simpara>
        </listitem>
       </varlistentry>
       <varlistentry>
        <term>
         <constant>ReflectionClass::SKIP_DESTRUCTOR</constant>
        </term>
        <listitem>
         <simpara>
          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.
         </simpara>
        </listitem>
       </varlistentry>
      </variablelist>
     </para>
    </listitem>
   </varlistentry>
  </variablelist>
 </refsect1>

 <refsect1 role="returnvalues">
  &reftitle.returnvalues;
  <simpara>
   &return.void;
  </simpara>
 </refsect1>

 <refsect1 role="errors">
  &reftitle.errors;
  <simpara>
   A <classname>ReflectionException</classname> if the object is lazy and
   non-initialized.
  </simpara>
  <simpara>
   An <classname>Error</classname> if the object is being initialized, or if the
   object properties are being iterated with
   <link linkend="control-structures.foreach"><literal>foreach</literal></link>.
  </simpara>
 </refsect1>

 <refsect1 role="seealso">
  &reftitle.seealso;
  <simplelist>
   <member><methodname>ReflectionClass::newLazyGhost</methodname></member>
   <member><methodname>ReflectionClass::resetAsLazyProxy</methodname></member>
  </simplelist>
 </refsect1>

</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->