Skip to content

Commit 969db61

Browse files
Add ReflectionProperty::isDynamic() (#4292)
1 parent 6c7da86 commit 969db61

File tree

2 files changed

+96
-0
lines changed

2 files changed

+96
-0
lines changed

reference/reflection/reflectionproperty/isdefault.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@
3939
<programlisting role="php">
4040
<![CDATA[
4141
<?php
42+
43+
#[\AllowDynamicProperties]
4244
class Foo {
4345
public $bar;
4446
}
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!-- $Revision$ -->
3+
<refentry xml:id="reflectionproperty.isdynamic" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
4+
<refnamediv>
5+
<refname>ReflectionProperty::isDynamic</refname>
6+
<refpurpose>Checks if property is a dynamic property</refpurpose>
7+
</refnamediv>
8+
9+
<refsect1 role="description">
10+
&reftitle.description;
11+
<methodsynopsis role="ReflectionProperty">
12+
<modifier>public</modifier> <type>bool</type><methodname>ReflectionProperty::isDynamic</methodname>
13+
<void/>
14+
</methodsynopsis>
15+
<simpara>
16+
Checks whether the property was declared at run-time, or whether the
17+
property was declared at compile-time.
18+
</simpara>
19+
</refsect1>
20+
21+
<refsect1 role="parameters">
22+
&reftitle.parameters;
23+
&no.function.parameters;
24+
</refsect1>
25+
26+
<refsect1 role="returnvalues">
27+
&reftitle.returnvalues;
28+
<simpara>
29+
&true; if the property was declared at run-time, or &false; if
30+
it was created at compile-time.
31+
</simpara>
32+
</refsect1>
33+
34+
<refsect1 role="examples">
35+
&reftitle.examples;
36+
<example>
37+
<title><methodname>ReflectionProperty::isDynamic</methodname> example</title>
38+
<programlisting role="php">
39+
<![CDATA[
40+
<?php
41+
42+
#[\AllowDynamicProperties]
43+
class Foo {
44+
public $bar;
45+
}
46+
47+
$o = new Foo();
48+
$o->bar = 42;
49+
$o->baz = 42;
50+
51+
$ro = new ReflectionObject($o);
52+
var_dump($ro->getProperty('bar')->isDynamic());
53+
var_dump($ro->getProperty('baz')->isDynamic());
54+
?>
55+
]]>
56+
</programlisting>
57+
&example.outputs;
58+
<screen>
59+
<![CDATA[
60+
bool(false)
61+
bool(true)
62+
]]>
63+
</screen>
64+
</example>
65+
</refsect1>
66+
67+
<refsect1 role="seealso">
68+
&reftitle.seealso;
69+
<simplelist>
70+
<member><methodname>ReflectionProperty::getValue</methodname></member>
71+
</simplelist>
72+
</refsect1>
73+
74+
</refentry>
75+
<!-- Keep this comment at the end of the file
76+
Local variables:
77+
mode: sgml
78+
sgml-omittag:t
79+
sgml-shorttag:t
80+
sgml-minimize-attributes:nil
81+
sgml-always-quote-attributes:t
82+
sgml-indent-step:1
83+
sgml-indent-data:t
84+
indent-tabs-mode:nil
85+
sgml-parent-document:nil
86+
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
87+
sgml-exposed-tags:nil
88+
sgml-local-catalogs:nil
89+
sgml-local-ecat-files:nil
90+
End:
91+
vim600: syn=xml fen fdm=syntax fdl=2 si
92+
vim: et tw=78 syn=sgml
93+
vi: ts=1 sw=1
94+
-->

0 commit comments

Comments
 (0)