language/generators.xml
5f2da51e3cc91d9459ecd064203afb8cac3ac5cc
...
...
@@ -185,14 +185,6 @@ foreach ($generator as $value) {
185
185
</para>
186
186
</note>
187
187

188
-
<caution>
189
-
<para>
190
-
The value that will be assigned to <varname>$data</varname> is the value
191
-
passed to <methodname>Generator::send</methodname>, or &null; if
192
-
<methodname>Generator::next</methodname> is called instead.
193
-
</para>
194
-
</caution>
195
-

196
188
<sect3 xml:id="control-structures.yield.associative">
197
189
<title>Yielding values with keys</title>
198
190

...
...
@@ -255,22 +247,6 @@ foreach (input_parser($input) as $id => $fields) {
255
247
]]>
256
248
</screen>
257
249
</example>
258
-

259
-
<caution>
260
-
<para>
261
-
As with the simple value yields shown earlier, yielding a key/value pair
262
-
in an expression context requires the yield statement to be
263
-
parenthesised:
264
-
</para>
265
-

266
-
<informalexample>
267
-
<programlisting role="php">
268
-
<![CDATA[
269
-
$data = (yield $key => $value);
270
-
]]>
271
-
</programlisting>
272
-
</informalexample>
273
-
</caution>
274
250
</sect3>
275
251

276
252
<sect3 xml:id="control-structures.yield.null">
...
...
@@ -388,7 +364,7 @@ foreach (gen_reference() as &$number) {
388
364
A common case where this matters is <function>iterator_to_array</function>
389
365
returning a keyed array by default, leading to possibly unexpected results.
390
366
<function>iterator_to_array</function> has a second parameter
391
-
<parameter>use_keys</parameter> which can be set to &false; to collect
367
+
<parameter>preserve_keys</parameter> which can be set to &false; to collect
392
368
all the values while ignoring the keys returned by the <classname>Generator</classname>.
393
369
</para>
394
370

...
...
@@ -593,6 +569,16 @@ class LineIterator implements Iterator {
593
569
means that the same generator can't be iterated over multiple times: the
594
570
generator will need to be rebuilt by calling the generator function again.
595
571
</para>
572
+

573
+
<simplesect role="seealso">
574
+
&reftitle.seealso;
575
+
<para>
576
+
<simplelist>
577
+
<member><link linkend="language.oop5.iterations">Object Iteration</link></member>
578
+
</simplelist>
579
+
</para>
580
+
</simplesect>
581
+

596
582
</sect1>
597
583
</chapter>
598
584

599
585