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

109 lines
2.9 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<!-- EN-Revision: a16ad380e58039833f84dac4ad95893104868338 Maintainer: mumumu Status: ready -->
<refentry xml:id="reflectionproperty.isvirtual" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>ReflectionProperty::isVirtual</refname>
<refpurpose>プロパティが仮想プロパティかどうかを判定する</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis role="ReflectionProperty">
<modifier>public</modifier> <type>bool</type><methodname>ReflectionProperty::isVirtual</methodname>
<void/>
</methodsynopsis>
<simpara>
プロパティが仮想プロパティかどうかを判定します。
</simpara>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
&no.function.parameters;
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<simpara>
プロパティが仮想プロパティの場合 &true; を返します。
そうでない場合、&false; を返します。
</simpara>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<example xml:id="reflectionproperty.isvirtual.example.basic">
<title><methodname>ReflectionProperty::isVirtual</methodname> の例</title>
<programlisting role="php">
<![CDATA[
<?php
class Example
{
// どのフックもプロパティを参照していないので
// これは仮想プロパティです
public string $name { get => "Name here"; }
// このフックはプロパティを名前で参照しているので
// 仮想プロパティではありません
public int $age {
set {
if ($value <= 0) {
throw new \InvalidArgumentException();
}
$this->age = $value;
}
}
// フックがないプロパティは常に仮想プロパティです
public string $job;
}
$rClass = new \ReflectionClass(Example::class);
var_dump($rClass->getProperty('name')->isVirtual());
var_dump($rClass->getProperty('age')->isVirtual());
var_dump($rClass->getProperty('job')->isVirtual());
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
bool(true)
bool(false)
bool(false)
]]>
</screen>
</example>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<simplelist>
<member><link linkend="language.oop5.property-hooks.virtual">仮想プロパティ</link></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
-->