Skip to content

Commit f7a5efc

Browse files
authored
[Sync EN] Habilitar ejemplos WASM en attributes, generators y references (#581)
PR upstream: php/doc-en#5484 Commit: 50e6f42c83ac3f6de5e1086b649e06adedd562ff Closes #575
1 parent 28cb873 commit f7a5efc

3 files changed

Lines changed: 72 additions & 90 deletions

File tree

language/attributes.xml

Lines changed: 28 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<!-- $Revision$ -->
3-
<!-- EN-Revision: 0f14761ba340c6e49797706ac3f0cf1147d97253 Maintainer: Marqitos Status: ready -->
3+
<!-- EN-Revision: 50e6f42c83ac3f6de5e1086b649e06adedd562ff Maintainer: lacatoire Status: ready -->
44
<!-- Reviewed: no -->
5-
<chapter xml:id="language.attributes" xmlns="http://docbook.org/ns/docbook">
5+
<chapter xml:id="language.attributes" xmlns="http://docbook.org/ns/docbook" annotations="interactive">
66
<title>Atributos</title>
77
<sect1 xml:id="language.attributes.overview">
88
<title>Descripción general de atributos</title>
@@ -32,7 +32,7 @@
3232

3333
<example>
3434
<title>Implementación de métodos opcionales de una interfaz mediante atributos</title>
35-
<programlisting role="php">
35+
<programlisting role="php" annotations="non-interactive">
3636
<![CDATA[
3737
<?php
3838
interface ActionHandler
@@ -123,7 +123,7 @@ executeAction($copyAction);
123123
<example>
124124
<title>Sintaxis de atributos</title>
125125

126-
<programlisting role="php">
126+
<programlisting role="php" annotations="non-interactive">
127127
<![CDATA[
128128
<?php
129129
// a.php
@@ -224,7 +224,11 @@ function dumpAttributeData($reflection) {
224224
}
225225
226226
dumpAttributeData(new ReflectionClass(Thing::class));
227-
/*
227+
]]>
228+
</programlisting>
229+
&example.outputs;
230+
<screen>
231+
<![CDATA[
228232
string(11) "MyAttribute"
229233
array(1) {
230234
["value"]=>
@@ -234,10 +238,8 @@ object(MyAttribute)#3 (1) {
234238
["value"]=>
235239
int(1234)
236240
}
237-
*/
238-
239241
]]>
240-
</programlisting>
242+
</screen>
241243
</example>
242244

243245
<para>
@@ -252,6 +254,21 @@ object(MyAttribute)#3 (1) {
252254
<programlisting role="php">
253255
<![CDATA[
254256
<?php
257+
#[Attribute]
258+
class MyAttribute
259+
{
260+
public $value;
261+
262+
public function __construct($value)
263+
{
264+
$this->value = $value;
265+
}
266+
}
267+
268+
#[MyAttribute(value: 1234)]
269+
class Thing
270+
{
271+
}
255272
256273
function dumpMyAttributeData($reflection) {
257274
$attributes = $reflection->getAttributes(MyAttribute::class);
@@ -282,7 +299,7 @@ dumpMyAttributeData(new ReflectionClass(Thing::class));
282299
<example>
283300
<title>Clase de atributo simple</title>
284301

285-
<programlisting role="php">
302+
<programlisting role="php" annotations="non-interactive">
286303
<![CDATA[
287304
<?php
288305
@@ -307,7 +324,7 @@ class MyAttribute
307324
<example>
308325
<title>Usar la especificación de destino para restringir dónde se pueden usar los atributos</title>
309326

310-
<programlisting role="php">
327+
<programlisting role="php" annotations="non-interactive">
311328
<![CDATA[
312329
<?php
313330
@@ -350,7 +367,7 @@ class MyAttribute
350367
<example>
351368
<title>Usar IS_REPEATABLE para permitir que un atributo se use varias veces en una declaración</title>
352369

353-
<programlisting role="php">
370+
<programlisting role="php" annotations="non-interactive">
354371
<![CDATA[
355372
<?php
356373

language/generators.xml

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<!-- $Revision$ -->
3-
<!-- EN-Revision: 08e58ace7e5b538c8ed75d784a54885d5f785d30 Maintainer: PhilDaiguille Status: ready -->
3+
<!-- EN-Revision: 50e6f42c83ac3f6de5e1086b649e06adedd562ff Maintainer: lacatoire Status: ready -->
44
<!-- Reviewed: no -->
55
<!-- CREDITS: DAnnebicque -->
66

7-
<chapter xml:id="language.generators" xmlns="http://docbook.org/ns/docbook">
7+
<chapter xml:id="language.generators" xmlns="http://docbook.org/ns/docbook" annotations="interactive">
88
<title>Generators</title>
99

1010
<sect1 xml:id="language.generators.overview">
@@ -86,7 +86,6 @@ echo 'Números impares de un solo dígito desde xrange(): ';
8686
foreach (xrange(1, 9, 2) as $number) {
8787
echo "$number ";
8888
}
89-
?>
9089
]]>
9190
</programlisting>
9291
&example.outputs;
@@ -166,7 +165,6 @@ $generator = gen_one_to_three();
166165
foreach ($generator as $value) {
167166
echo "$value\n";
168167
}
169-
?>
170168
]]>
171169
</programlisting>
172170
&example.outputs;
@@ -231,7 +229,6 @@ foreach (input_parser($input) as $id => $fields) {
231229
echo " $fields[0]\n";
232230
echo " $fields[1]\n";
233231
}
234-
?>
235232
]]>
236233
</programlisting>
237234
&example.outputs;
@@ -271,7 +268,6 @@ function gen_three_nulls() {
271268
}
272269
273270
var_dump(iterator_to_array(gen_three_nulls()));
274-
?>
275271
]]>
276272
</programlisting>
277273
&example.outputs;
@@ -322,7 +318,6 @@ function &gen_reference() {
322318
foreach (gen_reference() as &$number) {
323319
echo (--$number).'... ';
324320
}
325-
?>
326321
]]>
327322
</programlisting>
328323
&example.outputs;
@@ -388,7 +383,6 @@ function gen() {
388383
}
389384
// establece en false el segundo parámetro para obtener un array [0, 1, 2, 3, 4]
390385
var_dump(iterator_to_array(gen()));
391-
?>
392386
]]>
393387
</programlisting>
394388
&example.outputs;
@@ -434,7 +428,6 @@ function eight() {
434428
foreach (count_to_ten() as $num) {
435429
echo "$num ";
436430
}
437-
?>
438431
]]>
439432
</programlisting>
440433
&example.outputs;
@@ -478,7 +471,6 @@ foreach ($gen as $num) {
478471
echo "$num ";
479472
}
480473
echo $gen->getReturn();
481-
?>
482474
]]>
483475
</programlisting>
484476
&example.outputs;
@@ -503,7 +495,7 @@ echo $gen->getReturn();
503495
</para>
504496

505497
<informalexample>
506-
<programlisting role="php">
498+
<programlisting role="php" annotations="non-interactive">
507499
<![CDATA[
508500
<?php
509501
function getLinesFromFile($fileName) {
@@ -561,7 +553,6 @@ class LineIterator implements Iterator {
561553
fclose($this->fileHandle);
562554
}
563555
}
564-
?>
565556
]]>
566557
</programlisting>
567558
</informalexample>

0 commit comments

Comments
 (0)