appendices/migration74/new-features.xml
e150cc645a17588282e5e6b5e43e600a2f345549
...
...
@@ -77,6 +77,33 @@ class ChildProducer extends Producer {
77
77
Full variance support is only available if autoloading is used. Inside a
78
78
single file only non-cyclic type references are possible, because all
79
79
classes need to be available before they are referenced.
80
+
<informalexample>
81
+
<programlisting role="php">
82
+
<![CDATA[
83
+
<?php
84
+

85
+
/**
86
+
* These classes satisfy the LSP requirements, because C is a subtype of A.
87
+
* However, at the time class B is declared, class C is not yet available
88
+
*/
89
+
class A
90
+
{
91
+
public function method(): A {}
92
+
}
93
+

94
+
class B extends A
95
+
{
96
+
// Fatal error: Could not check compatibility between B::method():C and
97
+
// A::method(): A, because class С is not available
98
+
public function method(): С {}
99
+
}
100
+

101
+
class C extends B {}
102
+

103
+
?>
104
+
]]>
105
+
</programlisting>
106
+
</informalexample>
80
107
</para>
81
108
</sect3>
82
109

...
...
@@ -142,7 +169,7 @@ $fruits = ['banana', 'orange', ...$parts, 'watermelon'];
142
169
<title>Weak references</title>
143
170

144
171
<para>
145
-
Weak references allow the programmer to retain a reference to an object
172
+
<link linkend="class.weakreference">Weak references</link> allow the programmer to retain a reference to an object
146
173
that does not prevent the object from being destroyed.
147
174
</para>
148
175
</sect3>
...
...
@@ -233,7 +260,7 @@ $fruits = ['banana', 'orange', ...$parts, 'watermelon'];
233
260
The <function>preg_replace_callback</function> and <function>preg_replace_callback_array</function>
234
261
functions now accept an additional <parameter>flags</parameter> argument, with support for the
235
262
<constant>PREG_OFFSET_CAPTURE</constant> and <constant>PREG_UNMATCHED_AS_NULL</constant> flags.
236
-
This influences the format of the matches array passed to to the callback function.
263
+
This influences the format of the matches array passed to the callback function.
237
264
</para>
238
265
</sect2>
239
266

...
...
@@ -314,10 +341,14 @@ $fruits = ['banana', 'orange', ...$parts, 'watermelon'];
314
341
<![CDATA[
315
342
<?php
316
343
// Returns array containing all the necessary state of the object.
317
-
public function __serialize(): array;
344
+
public function __serialize(): array
345
+
{
346
+
}
318
347

319
348
// Restores the object state from the given data array.
320
-
public function __unserialize(array $data): void;
349
+
public function __unserialize(array $data): void
350
+
{
351
+
}
321
352
?>
322
353
]]>
323
354
</programlisting>
324
355