<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/reserved.attributes.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'ja',
  ),
  'this' => 
  array (
    0 => 'class.attribute.php',
    1 => 'Attribute',
    2 => 'Attribute アトリビュート',
  ),
  'up' => 
  array (
    0 => 'reserved.attributes.php',
    1 => '定義済みのアトリビュート',
  ),
  'prev' => 
  array (
    0 => 'reserved.attributes.php',
    1 => '定義済みのアトリビュート',
  ),
  'next' => 
  array (
    0 => 'attribute.construct.php',
    1 => 'Attribute::__construct',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'ja',
    'path' => 'language/predefined/attributes/attribute.xml',
  ),
  'history' => 
  array (
  ),
  'extra_header_links' => 
  array (
    'rel' => 'alternate',
    'href' => '/manual/en/feeds/class.attribute.atom',
    'type' => 'application/atom+xml',
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="class.attribute" class="reference">
 <h1 class="title">Attribute アトリビュート</h1>
 

 <div class="partintro"><p class="verinfo">(PHP 8)</p>

  <div class="section" id="attribute.intro">
   <h2 class="title">はじめに</h2>
   <p class="para">
    アトリビュートを使うと、
    コンピューターが解析できる構造化されたメタデータの情報を、
    コードの宣言時に埋め込むことができます。
    つまり、クラス、メソッド、関数、パラメータ、プロパティ、クラス定数にアトリビュートを指定することができます。
    アトリビュートで定義されたメタデータは、
    実行時に <a href="book.reflection.php" class="link">リフレクションAPI</a> を使って調べることが出来ます。
    よって、アトリビュートは、
    コードに直接埋め込むことが出来る、
    設定のための言語とみなすことができます。
   </p>
  </div>

  <div class="section" id="attribute.synopsis">
   <h2 class="title">クラス概要</h2>

   <div class="classsynopsis"><div class="classsynopsisinfo">
    
     <span class="attribute"><a href="class.attribute.php">#[\Attribute]</a> </span><br>
     <span class="modifier">final</span>
     <span class="modifier">class</span> <strong class="classname"><strong class="classname">Attribute</strong></strong>
     {</div>

    <div class="classsynopsisinfo classsynopsisinfo_comment">/* 定数 */</div>
    <div class="fieldsynopsis">
     <span class="modifier">const</span>
     <span class="type"><a href="language.types.integer.php" class="type int">int</a></span>
      <var class="fieldsynopsis_varname"><a href="class.attribute.php#attribute.constants.target-class"><var class="varname">TARGET_CLASS</var></a></var>;</div>

    <div class="fieldsynopsis"><span class="modifier">const</span>
     <span class="type"><a href="language.types.integer.php" class="type int">int</a></span>
      <var class="fieldsynopsis_varname"><a href="class.attribute.php#attribute.constants.target-function"><var class="varname">TARGET_FUNCTION</var></a></var>;</div>

    <div class="fieldsynopsis"><span class="modifier">const</span>
     <span class="type"><a href="language.types.integer.php" class="type int">int</a></span>
      <var class="fieldsynopsis_varname"><a href="class.attribute.php#attribute.constants.target-method"><var class="varname">TARGET_METHOD</var></a></var>;</div>

    <div class="fieldsynopsis"><span class="modifier">const</span>
     <span class="type"><a href="language.types.integer.php" class="type int">int</a></span>
      <var class="fieldsynopsis_varname"><a href="class.attribute.php#attribute.constants.target-property"><var class="varname">TARGET_PROPERTY</var></a></var>;</div>

    <div class="fieldsynopsis"><span class="modifier">const</span>
     <span class="type"><a href="language.types.integer.php" class="type int">int</a></span>
      <var class="fieldsynopsis_varname"><a href="class.attribute.php#attribute.constants.target-class-constant"><var class="varname">TARGET_CLASS_CONSTANT</var></a></var>;</div>

    <div class="fieldsynopsis"><span class="modifier">const</span>
     <span class="type"><a href="language.types.integer.php" class="type int">int</a></span>
      <var class="fieldsynopsis_varname"><a href="class.attribute.php#attribute.constants.target-parameter"><var class="varname">TARGET_PARAMETER</var></a></var>;</div>

    <div class="fieldsynopsis"><span class="modifier">const</span>
     <span class="type"><a href="language.types.integer.php" class="type int">int</a></span>
      <var class="fieldsynopsis_varname"><a href="class.attribute.php#attribute.constants.target-constant"><var class="varname">TARGET_CONSTANT</var></a></var>;</div>

    <div class="fieldsynopsis"><span class="modifier">const</span>
     <span class="type"><a href="language.types.integer.php" class="type int">int</a></span>
      <var class="fieldsynopsis_varname"><a href="class.attribute.php#attribute.constants.target-all"><var class="varname">TARGET_ALL</var></a></var>;</div>

    <div class="fieldsynopsis"><span class="modifier">const</span>
     <span class="type"><a href="language.types.integer.php" class="type int">int</a></span>
      <var class="fieldsynopsis_varname"><a href="class.attribute.php#attribute.constants.is-repeatable"><var class="varname">IS_REPEATABLE</var></a></var>;</div>


    <div class="classsynopsisinfo classsynopsisinfo_comment">/* プロパティ */</div>
    <div class="fieldsynopsis"><span class="modifier">public</span>
     <span class="type"><a href="language.types.integer.php" class="type int">int</a></span>
      <var class="varname"><a href="class.attribute.php#attribute.props.flags">$<var class="varname">flags</var></a></var>;</div>


    <div class="classsynopsisinfo classsynopsisinfo_comment">/* メソッド */</div>
    <div class="constructorsynopsis dc-description">
   <span class="modifier">public</span> <span class="methodname"><a href="attribute.construct.php" class="methodname">__construct</a></span>(<span class="methodparam"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$flags</code><span class="initializer"> = <strong><code><a href="class.attribute.php#attribute.constants.target-all">Attribute::TARGET_ALL</a></code></strong></span></span>)</div>

   }</div>
  </div>

  <div class="section" id="attribute.constants">
   <h2 class="title">定義済み定数</h2>
   <dl>
    
     <dt id="attribute.constants.target-class"><strong><code><a href="class.attribute.php#attribute.constants.target-class">Attribute::TARGET_CLASS</a></code></strong></dt>
     <dd>
      <p class="para"/>
     </dd>
    

    
     <dt id="attribute.constants.target-function"><strong><code><a href="class.attribute.php#attribute.constants.target-function">Attribute::TARGET_FUNCTION</a></code></strong></dt>
     <dd>
      <p class="para"/>
     </dd>
    

    
     <dt id="attribute.constants.target-method"><strong><code><a href="class.attribute.php#attribute.constants.target-method">Attribute::TARGET_METHOD</a></code></strong></dt>
     <dd>
      <p class="para"/>
     </dd>
    

    
     <dt id="attribute.constants.target-property"><strong><code><a href="class.attribute.php#attribute.constants.target-property">Attribute::TARGET_PROPERTY</a></code></strong></dt>
     <dd>
      <p class="para"/>
     </dd>
    

    
     <dt id="attribute.constants.target-class-constant"><strong><code><a href="class.attribute.php#attribute.constants.target-class-constant">Attribute::TARGET_CLASS_CONSTANT</a></code></strong></dt>
     <dd>
      <p class="para"/>
     </dd>
    

    
     <dt id="attribute.constants.target-parameter"><strong><code><a href="class.attribute.php#attribute.constants.target-parameter">Attribute::TARGET_PARAMETER</a></code></strong></dt>
     <dd>
      <p class="para"/>
     </dd>
    

    
     <dt id="attribute.constants.target-constant"><strong><code><a href="class.attribute.php#attribute.constants.target-constant">Attribute::TARGET_CONSTANT</a></code></strong></dt>
     <dd>
      <p class="para"/>
     </dd>
    

    
     <dt id="attribute.constants.target-all"><strong><code><a href="class.attribute.php#attribute.constants.target-all">Attribute::TARGET_ALL</a></code></strong></dt>
     <dd>
      <p class="para"/>
     </dd>
    

    
     <dt id="attribute.constants.is-repeatable"><strong><code><a href="class.attribute.php#attribute.constants.is-repeatable">Attribute::IS_REPEATABLE</a></code></strong></dt>
     <dd>
      <p class="para"/>
     </dd>
    
   </dl>
  </div>

  <div class="section" id="attribute.props">
   <h2 class="title">プロパティ</h2>
   <dl>
    
     <dt id="attribute.props.flags"><var class="varname">flags</var></dt>
     <dd>
      <p class="para"/>
     </dd>
    
   </dl>
  </div>

  <div class="section">
   <h2 class="title">変更履歴</h2>
   <table class="doctable informaltable">
    
     <thead>
      <tr>
       <th>バージョン</th>
       <th>説明</th>
      </tr>

     </thead>

     <tbody class="tbody">
      <tr>
       <td>8.5.0</td>
       <td>
        <strong><code><a href="class.attribute.php#attribute.constants.target-constant">Attribute::TARGET_CONSTANT</a></code></strong> が追加されました。
       </td>
      </tr>

     </tbody>
    
   </table>

  </div>

  <div class="section" id="attribute.seealso">
   <h2 class="title">参考</h2>
   <p class="para"><a href="language.attributes.php" class="link">アトリビュートの概要</a></p>
  </div>
 </div>

 






<h2>目次</h2><ul class="chunklist chunklist_reference"><li><a href="attribute.construct.php">Attribute::__construct</a> — 新しい Attribute のインスタンスを作成する</li></ul>
</div>
<?php manual_footer($setup); ?>