1
0
mirror of https://github.com/php/doc-ja.git synced 2026-03-24 07:02:08 +01:00
Files
Yoshinari Takaoka 996fb2ce5d [PHP 8.4] プロパティフック関係の、Reflection まわりの追加変更に追随
但し、 #271 で問題になっている propertyhooktype.xml は除く。
2025-09-07 16:22:39 +09:00

111 lines
3.0 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<!-- EN-Revision: a16ad380e58039833f84dac4ad95893104868338 Maintainer: mumumu Status: ready -->
<refentry xml:id="reflectionproperty.gethooks" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>ReflectionProperty::getHooks</refname>
<refpurpose>このプロパティに指定された全てのフックを配列で返す</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis role="ReflectionProperty">
<modifier>public</modifier> <type>array</type><methodname>ReflectionProperty::getHooks</methodname>
<void/>
</methodsynopsis>
<simpara>
このプロパティに指定された全てのフックを配列で返します。
</simpara>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
&no.function.parameters;
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<simpara>
対象となるフックをキーとする <classname>ReflectionMethod</classname>
の配列を返します。
たとえば <literal>get</literal><literal>set</literal> のフックを持つプロパティの場合、
<literal>get</literal><literal>set</literal> のキーを持つ2要素を持つ配列を返します。
それらのそれぞれの要素は <classname>ReflectionMethod</classname> です。
返される要素の順番は定義されていません。
フックが定義されていない場合、空の配列が返されます。
</simpara>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<example xml:id="reflectionproperty.gethooks.example.basic">
<title><methodname>ReflectionProperty::getHooks</methodname> の例</title>
<programlisting role="php">
<![CDATA[
<?php
class Example
{
public string $name { get => "Name here"; }
public int $count;
}
$rClass = new \ReflectionClass(Example::class);
$rProp = $rClass->getProperty('name');
var_dump($rProp->getHooks());
$rProp = $rClass->getProperty('count');
var_dump($rProp->getHooks());
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
array(1) {
["get"]=>
object(ReflectionMethod)#3 (2) {
["name"]=>
string(10) "$name::get"
["class"]=>
string(7) "Example"
}
}
array(0) {
}
]]>
</screen>
</example>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<simplelist>
<member><classname>ReflectionMethod</classname></member>
<member><methodname>ReflectionProperty::hasHooks</methodname></member>
</simplelist>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->