Skip to content
Merged
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,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- EN-Revision: 0f14761ba340c6e49797706ac3f0cf1147d97253 Maintainer: leonardolara Status: ready --><!-- CREDITS: marcosmarcolin, adiel, leonardolara -->
<chapter xml:id="language.attributes" xmlns="http://docbook.org/ns/docbook">
<!-- EN-Revision: 50e6f42c83ac3f6de5e1086b649e06adedd562ff Maintainer: leonardolara Status: ready --><!-- CREDITS: marcosmarcolin, adiel, leonardolara -->
<chapter xml:id="language.attributes" xmlns="http://docbook.org/ns/docbook" annotations="interactive">
<title>Atributos</title>
<sect1 xml:id="language.attributes.overview">
<title>Visão geral dos atributos</title>
Expand Down Expand Up @@ -30,7 +30,7 @@

<example>
<title>Implementando métodos opcionais de uma interface com Atributos</title>
<programlisting role="php">
<programlisting role="php" annotations="non-interactive">
<![CDATA[
<?php
interface ActionHandler
Expand Down Expand Up @@ -121,7 +121,7 @@ executeAction($copyAction);
<example>
<title>Sintaxe de Atributo</title>

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

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

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

<para>
Expand All @@ -250,6 +252,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 @@ -280,7 +297,7 @@ dumpMyAttributeData(new ReflectionClass(Thing::class));
<example>
<title>Classe de Atributo Simples</title>

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

Expand All @@ -305,7 +322,7 @@ class MyAttribute
<example>
<title>Usando a especificação de destino para restringir onde os atributos podem ser usados</title>

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

Expand Down Expand Up @@ -348,7 +365,7 @@ class MyAttribute
<example>
<title>Usando IS_REPEATABLE para permitir o atributo em uma declaração várias vezes</title>

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

Expand Down
Loading