-
Notifications
You must be signed in to change notification settings - Fork 801
Add ReflectionProperty::isDynamic()
#4292
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,6 +39,8 @@ | |
<programlisting role="php"> | ||
<![CDATA[ | ||
<?php | ||
|
||
#[\AllowDynamicProperties] | ||
class Foo { | ||
public $bar; | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<!-- $Revision$ --> | ||
<refentry xml:id="reflectionproperty.isdynamic" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> | ||
<refnamediv> | ||
<refname>ReflectionProperty::isDynamic</refname> | ||
<refpurpose>Checks if property is a dynamic property</refpurpose> | ||
</refnamediv> | ||
|
||
<refsect1 role="description"> | ||
&reftitle.description; | ||
<methodsynopsis role="ReflectionProperty"> | ||
<modifier>public</modifier> <type>bool</type><methodname>ReflectionProperty::isDynamic</methodname> | ||
<void/> | ||
</methodsynopsis> | ||
<simpara> | ||
Checks whether the property was declared at run-time, or whether the | ||
property was declared at compile-time. | ||
</simpara> | ||
</refsect1> | ||
|
||
<refsect1 role="parameters"> | ||
&reftitle.parameters; | ||
&no.function.parameters; | ||
</refsect1> | ||
|
||
<refsect1 role="returnvalues"> | ||
&reftitle.returnvalues; | ||
<simpara> | ||
&true; if the property was declared at run-time, or &false; if | ||
it was created at compile-time. | ||
</simpara> | ||
</refsect1> | ||
|
||
<refsect1 role="examples"> | ||
&reftitle.examples; | ||
<example> | ||
<title><methodname>ReflectionProperty::isDynamic</methodname> example</title> | ||
<programlisting role="php"> | ||
<![CDATA[ | ||
<?php | ||
|
||
#[\AllowDynamicProperties] | ||
class Foo { | ||
public $bar; | ||
} | ||
Comment on lines
+43
to
+45
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You need to add the dynamic property attribute to the class, otherwise a deprecation notice would be in the output There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Alright, also added to |
||
|
||
$o = new Foo(); | ||
$o->bar = 42; | ||
$o->baz = 42; | ||
|
||
$ro = new ReflectionObject($o); | ||
var_dump($ro->getProperty('bar')->isDynamic()); | ||
var_dump($ro->getProperty('baz')->isDynamic()); | ||
?> | ||
]]> | ||
</programlisting> | ||
&example.outputs; | ||
<screen> | ||
<![CDATA[ | ||
bool(false) | ||
bool(true) | ||
]]> | ||
</screen> | ||
</example> | ||
</refsect1> | ||
|
||
<refsect1 role="seealso"> | ||
&reftitle.seealso; | ||
<simplelist> | ||
<member><methodname>ReflectionProperty::getValue</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 | ||
--> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure about this wording, maybe something like:
? But I still not amazed by my wording.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I actually used the same wording as
isDefault()
, if it matters.