Skip to content

Commit

Permalink
Fix #81065: Changes to Reflection modifiers not documented
Browse files Browse the repository at this point in the history
  • Loading branch information
cmb69 committed May 23, 2021
1 parent c50bbed commit 6f41560
Show file tree
Hide file tree
Showing 7 changed files with 79 additions and 22 deletions.
6 changes: 6 additions & 0 deletions appendices/migration74/incompatible.xml
Expand Up @@ -249,6 +249,12 @@
supported and resulted in corrupted reflection objects. It has been
explicitly prohibited now.
</para>

<para>
The values of the class constant of <classname>ReflectionClassConstant</classname>,
<classname>ReflectionMethod</classname> and <classname>ReflectionProperty</classname>
have changed.
</para>
</sect2>

<sect2 xml:id="migration74.incompatible.spl">
Expand Down
13 changes: 13 additions & 0 deletions reference/reflection/reflectionclassconstant.xml
Expand Up @@ -41,16 +41,19 @@
<modifier>const</modifier>
<type>int</type>
<varname linkend="reflectionclassconstant.constants.is-public">ReflectionClassConstant::IS_PUBLIC</varname>
<initializer>1</initializer>
</fieldsynopsis>
<fieldsynopsis>
<modifier>const</modifier>
<type>int</type>
<varname linkend="reflectionclassconstant.constants.is-protected">ReflectionClassConstant::IS_PROTECTED</varname>
<initializer>2</initializer>
</fieldsynopsis>
<fieldsynopsis>
<modifier>const</modifier>
<type>int</type>
<varname linkend="reflectionclassconstant.constants.is-private">ReflectionClassConstant::IS_PRIVATE</varname>
<initializer>4</initializer>
</fieldsynopsis>

<classsynopsisinfo role="comment">&Properties;</classsynopsisinfo>
Expand Down Expand Up @@ -114,6 +117,7 @@
<para>
Indicates <link linkend="language.oop5.visibility">public</link>
constants.
Prior to PHP 7.4.0, the value was <literal>256</literal>.
</para>
</listitem>
</varlistentry>
Expand All @@ -124,6 +128,7 @@
<para>
Indicates <link linkend="language.oop5.visibility">protected</link>
constants.
Prior to PHP 7.4.0, the value was <literal>512</literal>.
</para>
</listitem>
</varlistentry>
Expand All @@ -134,11 +139,19 @@
<para>
Indicates <link linkend="language.oop5.visibility">private</link>
constants.
Prior to PHP 7.4.0, the value was <literal>1024</literal>.
</para>
</listitem>
</varlistentry>

</variablelist>
<note>
<para>
The values of these constants may change between PHP versions.
It is recommended to always use the constants
and not rely on the values directly.
</para>
</note>
</section>
</section>
<!-- }}} -->
Expand Down
4 changes: 2 additions & 2 deletions reference/reflection/reflectionclassconstant/getmodifiers.xml
Expand Up @@ -27,8 +27,8 @@
&reftitle.returnvalues;
<para>
A numeric representation of the modifiers.
The actual meanings of these modifiers are described in the
<link linkend="reflectionmethod.constants.modifiers">predefined constants</link>.
The actual meaning of these modifiers are described under
<link linkend="reflectionclassconstant.constants.modifiers">predefined constants</link>.
</para>
</refsect1>

Expand Down
49 changes: 37 additions & 12 deletions reference/reflection/reflectionmethod.xml
Expand Up @@ -46,37 +46,37 @@
<modifier>const</modifier>
<type>int</type>
<varname linkend="reflectionmethod.constants.is-static">ReflectionMethod::IS_STATIC</varname>
<initializer>1</initializer>
<initializer>16</initializer>
</fieldsynopsis>
<fieldsynopsis>
<modifier>const</modifier>
<type>int</type>
<varname linkend="reflectionmethod.constants.is-public">ReflectionMethod::IS_PUBLIC</varname>
<initializer>256</initializer>
<initializer>1</initializer>
</fieldsynopsis>
<fieldsynopsis>
<modifier>const</modifier>
<type>int</type>
<varname linkend="reflectionmethod.constants.is-protected">ReflectionMethod::IS_PROTECTED</varname>
<initializer>512</initializer>
<initializer>2</initializer>
</fieldsynopsis>
<fieldsynopsis>
<modifier>const</modifier>
<type>int</type>
<varname linkend="reflectionmethod.constants.is-private">ReflectionMethod::IS_PRIVATE</varname>
<initializer>1024</initializer>
<initializer>4</initializer>
</fieldsynopsis>
<fieldsynopsis>
<modifier>const</modifier>
<type>int</type>
<varname linkend="reflectionmethod.constants.is-abstract">ReflectionMethod::IS_ABSTRACT</varname>
<initializer>2</initializer>
<initializer>64</initializer>
</fieldsynopsis>
<fieldsynopsis>
<modifier>const</modifier>
<type>int</type>
<varname linkend="reflectionmethod.constants.is-final">ReflectionMethod::IS_FINAL</varname>
<initializer>4</initializer>
<initializer>32</initializer>
</fieldsynopsis>

<classsynopsisinfo role="comment">&Properties;</classsynopsisinfo>
Expand Down Expand Up @@ -136,46 +136,71 @@
<varlistentry xml:id="reflectionmethod.constants.is-static">
<term><constant>ReflectionMethod::IS_STATIC</constant></term>
<listitem>
<para>Indicates that the method is static.</para>
<para>
Indicates that the method is static.
Prior to PHP 7.4.0, the value was <literal>1</literal>.
</para>
</listitem>
</varlistentry>

<varlistentry xml:id="reflectionmethod.constants.is-public">
<term><constant>ReflectionMethod::IS_PUBLIC</constant></term>
<listitem>
<para>Indicates that the method is public.</para>
<para>
Indicates that the method is public.
Prior to PHP 7.4.0, the value was <literal>256</literal>.
</para>
</listitem>
</varlistentry>

<varlistentry xml:id="reflectionmethod.constants.is-protected">
<term><constant>ReflectionMethod::IS_PROTECTED</constant></term>
<listitem>
<para>Indicates that the method is protected.</para>
<para>
Indicates that the method is protected.
Prior to PHP 7.4.0, the value was <literal>512</literal>.
</para>
</listitem>
</varlistentry>

<varlistentry xml:id="reflectionmethod.constants.is-private">
<term><constant>ReflectionMethod::IS_PRIVATE</constant></term>
<listitem>
<para>Indicates that the method is private.</para>
<para>
Indicates that the method is private.
Prior to PHP 7.4.0, the value was <literal>1024</literal>.
</para>
</listitem>
</varlistentry>

<varlistentry xml:id="reflectionmethod.constants.is-abstract">
<term><constant>ReflectionMethod::IS_ABSTRACT</constant></term>
<listitem>
<para>Indicates that the method is abstract.</para>
<para>
Indicates that the method is abstract.
Prior to PHP 7.4.0, the value was <literal>2</literal>.
</para>
</listitem>
</varlistentry>

<varlistentry xml:id="reflectionmethod.constants.is-final">
<term><constant>ReflectionMethod::IS_FINAL</constant></term>
<listitem>
<para>Indicates that the method is final.</para>
<para>
Indicates that the method is final.
Prior to PHP 7.4.0, the value was <literal>4</literal>.
</para>
</listitem>
</varlistentry>

</variablelist>
<note>
<para>
The values of these constants may change between PHP versions.
It is recommended to always use the constants
and not rely on the values directly.
</para>
</note>
</section>
</section>
<!-- }}} -->
Expand Down
8 changes: 4 additions & 4 deletions reference/reflection/reflectionmethod/getmodifiers.xml
Expand Up @@ -26,8 +26,8 @@
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
A numeric representation of the modifiers. The modifiers are listed below.
The actual meanings of these modifiers are described in the
A numeric representation of the modifiers.
The actual meaning of these modifiers are described under
<link linkend="reflectionmethod.constants.modifiers">predefined constants</link>.
</para>
</refsect1>
Expand Down Expand Up @@ -70,10 +70,10 @@ echo implode(' ', Reflection::getModifierNames($bar->getModifiers()));
<screen>
<![CDATA[
Modifiers for method foo():
261
49
final public static
Modifiers for method bar():
65792
1
public
]]>
</screen>
Expand Down
19 changes: 15 additions & 4 deletions reference/reflection/reflectionproperty.xml
Expand Up @@ -41,25 +41,25 @@
<modifier>const</modifier>
<type>int</type>
<varname linkend="reflectionproperty.constants.is-static">ReflectionProperty::IS_STATIC</varname>
<initializer>1</initializer>
<initializer>16</initializer>
</fieldsynopsis>
<fieldsynopsis>
<modifier>const</modifier>
<type>int</type>
<varname linkend="reflectionproperty.constants.is-public">ReflectionProperty::IS_PUBLIC</varname>
<initializer>256</initializer>
<initializer>1</initializer>
</fieldsynopsis>
<fieldsynopsis>
<modifier>const</modifier>
<type>int</type>
<varname linkend="reflectionproperty.constants.is-protected">ReflectionProperty::IS_PROTECTED</varname>
<initializer>512</initializer>
<initializer>2</initializer>
</fieldsynopsis>
<fieldsynopsis>
<modifier>const</modifier>
<type>int</type>
<varname linkend="reflectionproperty.constants.is-private">ReflectionProperty::IS_PRIVATE</varname>
<initializer>1024</initializer>
<initializer>4</initializer>
</fieldsynopsis>

<classsynopsisinfo role="comment">&Properties;</classsynopsisinfo>
Expand Down Expand Up @@ -124,6 +124,7 @@
<para>
Indicates <link linkend="language.oop5.static">static</link>
properties.
Prior to PHP 7.4.0, the value was <literal>1</literal>.
</para>
</listitem>
</varlistentry>
Expand All @@ -134,6 +135,7 @@
<para>
Indicates <link linkend="language.oop5.visibility">public</link>
properties.
Prior to PHP 7.4.0, the value was <literal>256</literal>.
</para>
</listitem>
</varlistentry>
Expand All @@ -144,6 +146,7 @@
<para>
Indicates <link linkend="language.oop5.visibility">protected</link>
properties.
Prior to PHP 7.4.0, the value was <literal>512</literal>.
</para>
</listitem>
</varlistentry>
Expand All @@ -154,11 +157,19 @@
<para>
Indicates <link linkend="language.oop5.visibility">private</link>
properties.
Prior to PHP 7.4.0, the value was <literal>1024</literal>.
</para>
</listitem>
</varlistentry>

</variablelist>
<note>
<para>
The values of these constants may change between PHP versions.
It is recommended to always use the constants
and not rely on the values directly.
</para>
</note>
</section>
</section>
<!-- }}} -->
Expand Down
2 changes: 2 additions & 0 deletions reference/reflection/reflectionproperty/getmodifiers.xml
Expand Up @@ -30,6 +30,8 @@
&reftitle.returnvalues;
<para>
A numeric representation of the modifiers.
The actual meaning of these modifiers are described under
<link linkend="reflectionproperty.constants.modifiers">predefined constants</link>.
</para>
</refsect1>

Expand Down

0 comments on commit 6f41560

Please sign in to comment.