Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 28 additions & 11 deletions language/attributes.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<!-- EN-Revision: 0f14761ba340c6e49797706ac3f0cf1147d97253 Maintainer: Marqitos Status: ready -->
<!-- EN-Revision: 50e6f42c83ac3f6de5e1086b649e06adedd562ff Maintainer: lacatoire Status: ready -->
<!-- Reviewed: no -->
<chapter xml:id="language.attributes" xmlns="http://docbook.org/ns/docbook">
<chapter xml:id="language.attributes" xmlns="http://docbook.org/ns/docbook" annotations="interactive">
<title>Atributos</title>
<sect1 xml:id="language.attributes.overview">
<title>Descripción general de atributos</title>
Expand Down Expand Up @@ -32,7 +32,7 @@

<example>
<title>Implementación de métodos opcionales de una interfaz mediante atributos</title>
<programlisting role="php">
<programlisting role="php" annotations="non-interactive">
<![CDATA[
<?php
interface ActionHandler
Expand Down Expand Up @@ -123,7 +123,7 @@ executeAction($copyAction);
<example>
<title>Sintaxis de atributos</title>

<programlisting role="php">
<programlisting role="php" annotations="non-interactive">
<![CDATA[
<?php
// a.php
Expand Down Expand Up @@ -224,7 +224,11 @@ function dumpAttributeData($reflection) {
}

dumpAttributeData(new ReflectionClass(Thing::class));
/*
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
string(11) "MyAttribute"
array(1) {
["value"]=>
Expand All @@ -234,10 +238,8 @@ object(MyAttribute)#3 (1) {
["value"]=>
int(1234)
}
*/

]]>
</programlisting>
</screen>
</example>

<para>
Expand All @@ -252,6 +254,21 @@ object(MyAttribute)#3 (1) {
<programlisting role="php">
<![CDATA[
<?php
#[Attribute]
class MyAttribute
{
public $value;

public function __construct($value)
{
$this->value = $value;
}
}

#[MyAttribute(value: 1234)]
class Thing
{
}

function dumpMyAttributeData($reflection) {
$attributes = $reflection->getAttributes(MyAttribute::class);
Expand Down Expand Up @@ -282,7 +299,7 @@ dumpMyAttributeData(new ReflectionClass(Thing::class));
<example>
<title>Clase de atributo simple</title>

<programlisting role="php">
<programlisting role="php" annotations="non-interactive">
<![CDATA[
<?php

Expand All @@ -307,7 +324,7 @@ class MyAttribute
<example>
<title>Usar la especificación de destino para restringir dónde se pueden usar los atributos</title>

<programlisting role="php">
<programlisting role="php" annotations="non-interactive">
<![CDATA[
<?php

Expand Down Expand Up @@ -350,7 +367,7 @@ class MyAttribute
<example>
<title>Usar IS_REPEATABLE para permitir que un atributo se use varias veces en una declaración</title>

<programlisting role="php">
<programlisting role="php" annotations="non-interactive">
<![CDATA[
<?php

Expand Down
15 changes: 3 additions & 12 deletions language/generators.xml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<!-- EN-Revision: 08e58ace7e5b538c8ed75d784a54885d5f785d30 Maintainer: PhilDaiguille Status: ready -->
<!-- EN-Revision: 50e6f42c83ac3f6de5e1086b649e06adedd562ff Maintainer: lacatoire Status: ready -->
<!-- Reviewed: no -->
<!-- CREDITS: DAnnebicque -->

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

<sect1 xml:id="language.generators.overview">
Expand Down Expand Up @@ -86,7 +86,6 @@ echo 'Números impares de un solo dígito desde xrange(): ';
foreach (xrange(1, 9, 2) as $number) {
echo "$number ";
}
?>
]]>
</programlisting>
&example.outputs;
Expand Down Expand Up @@ -166,7 +165,6 @@ $generator = gen_one_to_three();
foreach ($generator as $value) {
echo "$value\n";
}
?>
]]>
</programlisting>
&example.outputs;
Expand Down Expand Up @@ -231,7 +229,6 @@ foreach (input_parser($input) as $id => $fields) {
echo " $fields[0]\n";
echo " $fields[1]\n";
}
?>
]]>
</programlisting>
&example.outputs;
Expand Down Expand Up @@ -271,7 +268,6 @@ function gen_three_nulls() {
}

var_dump(iterator_to_array(gen_three_nulls()));
?>
]]>
</programlisting>
&example.outputs;
Expand Down Expand Up @@ -322,7 +318,6 @@ function &gen_reference() {
foreach (gen_reference() as &$number) {
echo (--$number).'... ';
}
?>
]]>
</programlisting>
&example.outputs;
Expand Down Expand Up @@ -388,7 +383,6 @@ function gen() {
}
// establece en false el segundo parámetro para obtener un array [0, 1, 2, 3, 4]
var_dump(iterator_to_array(gen()));
?>
]]>
</programlisting>
&example.outputs;
Expand Down Expand Up @@ -434,7 +428,6 @@ function eight() {
foreach (count_to_ten() as $num) {
echo "$num ";
}
?>
]]>
</programlisting>
&example.outputs;
Expand Down Expand Up @@ -478,7 +471,6 @@ foreach ($gen as $num) {
echo "$num ";
}
echo $gen->getReturn();
?>
]]>
</programlisting>
&example.outputs;
Expand All @@ -503,7 +495,7 @@ echo $gen->getReturn();
</para>

<informalexample>
<programlisting role="php">
<programlisting role="php" annotations="non-interactive">
<![CDATA[
<?php
function getLinesFromFile($fileName) {
Expand Down Expand Up @@ -561,7 +553,6 @@ class LineIterator implements Iterator {
fclose($this->fileHandle);
}
}
?>
]]>
</programlisting>
</informalexample>
Expand Down
Loading