1
0
mirror of https://github.com/php/doc-zh.git synced 2026-03-24 23:22:14 +01:00
Files
2023-12-09 02:03:40 +08:00

106 lines
2.4 KiB
XML
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?xml version="1.0" encoding="utf-8"?>
<!-- EN-Revision: ec2fe9a592f794978114ef5021db9f1d00c2e05d Maintainer: daijie Status: ready -->
<!-- CREDITS: mowangjuanzi -->
<refentry xml:id="reflectionenum.isbacked" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>ReflectionEnum::isBacked</refname>
<refpurpose>检测 Enum 是否为回退BackedEnum</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis role="ReflectionEnum">
<modifier>public</modifier> <type>bool</type><methodname>ReflectionEnum::isBacked</methodname>
<void/>
</methodsynopsis>
<para>
回退 Enum 是具有本地 <type>string</type><type>int</type> 回退标量值。
并非所有枚举都是回退的。
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
&no.function.parameters;
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
如果枚举具有回退标量,返回 &true;,否则返回 &false;
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><methodname>ReflectionEnum::isBacked</methodname> 示例</title>
<programlisting role="php">
<![CDATA[
<?php
enum Suit
{
case Hearts;
case Diamonds;
case Clubs;
case Spades;
}
enum BackedSuit: string
{
case Hearts = 'H';
case Diamonds = 'D';
case Clubs = 'C';
case Spades = 'S';
}
var_dump((new ReflectionEnum(Suit::class))->isBacked());
var_dump((new ReflectionEnum(BackedSuit::class))->isBacked());
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
bool(false)
bool(true)
]]>
</screen>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><link linkend="language.enumerations">枚举</link></member>
<member><methodname>ReflectionEnum::getBackingType</methodname></member>
</simplelist>
</para>
</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
-->