Skip to content
Merged
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: mumumu Status: ready -->
<!-- EN-Revision: 50e6f42c83ac3f6de5e1086b649e06adedd562ff Maintainer: mumumu Status: ready -->

<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>アトリビュート</title>
<sect1 xml:id="language.attributes.overview">
<title>アトリビュートの概要</title>
Expand Down Expand Up @@ -38,7 +38,7 @@

<example>
<title>アトリビュートを使い、インターフェイスのオプションのメソッドを実装する</title>
<programlisting role="php">
<programlisting role="php" annotations="non-interactive">
<![CDATA[
<?php
interface ActionHandler
Expand Down Expand Up @@ -129,7 +129,7 @@ executeAction($copyAction);
<example>
<title>アトリビュートの文法</title>

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

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

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

<para>
Expand All @@ -258,6 +260,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 @@ -287,7 +304,7 @@ dumpMyAttributeData(new ReflectionClass(Thing::class));
<example>
<title>単純なアトリビュートクラスの例</title>

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

Expand All @@ -311,7 +328,7 @@ class MyAttribute
<example>
<title>アトリビュートを使える場所を限定するために、ターゲットとなるクラスを作る</title>

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

Expand Down Expand Up @@ -354,7 +371,7 @@ class MyAttribute
<example>
<title>宣言時にアトリビュートを複数回使えるように、IS_REPEATABLE を使う</title>

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

Expand Down
Loading
Loading