Skip to content

Commit c40f07c

Browse files
committed
Fix #80247: ReflectionType does not have an isBuiltin() method
Closes GH-273. git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@352224 c90b9560-bf6c-de11-be94-00142212c4b1
1 parent 26a93ee commit c40f07c

File tree

8 files changed

+221
-11
lines changed

8 files changed

+221
-11
lines changed

reference/reflection/book.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
&reference.reflection.reflectionparameter;
4141
&reference.reflection.reflectionproperty;
4242
&reference.reflection.reflectiontype;
43+
&reference.reflection.reflectionuniontype;
4344
&reference.reflection.reflectiongenerator;
4445
&reference.reflection.reflectionreference;
4546
&reference.reflection.reflector;

reference/reflection/reflectiontype/isbuiltin.xml renamed to reference/reflection/reflectionnamedtype/isbuiltin.xml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<!-- $Revision$ -->
33

4-
<refentry xml:id="reflectiontype.isbuiltin" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
4+
<refentry xml:id="reflectionnamedtype.isbuiltin" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
55
<refnamediv>
6-
<refname>ReflectionType::isBuiltin</refname>
6+
<refname>ReflectionNamedType::isBuiltin</refname>
77
<refpurpose>Checks if it is a built-in type</refpurpose>
88
</refnamediv>
99

1010
<refsect1 role="description">
1111
&reftitle.description;
1212
<methodsynopsis>
13-
<modifier>public</modifier> <type>bool</type><methodname>ReflectionType::isBuiltin</methodname>
13+
<modifier>public</modifier> <type>bool</type><methodname>ReflectionNamedType::isBuiltin</methodname>
1414
<void />
1515
</methodsynopsis>
1616
<para>
@@ -34,7 +34,7 @@
3434
&reftitle.examples;
3535
<para>
3636
<example>
37-
<title><methodname>ReflectionType::isBuiltin</methodname> example</title>
37+
<title><methodname>ReflectionNamedType::isBuiltin</methodname> example</title>
3838
<programlisting role="php">
3939
<![CDATA[
4040
<?php
@@ -50,7 +50,7 @@ var_dump($reflectionParams[1]->getType()->isBuiltin());
5050
var_dump($reflectionParams[2]->getType()->isBuiltin());
5151
]]>
5252
</programlisting>
53-
&example.outputs.similar;
53+
&example.outputs;
5454
<screen>
5555
<![CDATA[
5656
bool(true)
@@ -61,7 +61,7 @@ bool(false)
6161
</example>
6262
</para>
6363
<para>
64-
Note that the <methodname>ReflectionType::isBuiltin</methodname> method
64+
Note that the <methodname>ReflectionNamedType::isBuiltin</methodname> method
6565
does not distinguish between internal and custom classes. To make this
6666
distinction, the <methodname>ReflectionClass::isInternal</methodname> method
6767
should be used on the returned class name.

reference/reflection/reflectiontype.xml

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,45 @@
2828
<!-- {{{ Class synopsis -->
2929
<classsynopsisinfo>
3030
<ooclass>
31+
<modifier>abstract</modifier>
3132
<classname>ReflectionType</classname>
3233
</ooclass>
3334
</classsynopsisinfo>
3435
<!-- }}} -->
3536
<classsynopsisinfo role="comment">&Methods;</classsynopsisinfo>
36-
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('class.reflectiontype')/db:refentry/db:refsect1[@role='description']/descendant::db:methodsynopsis[1])" />
37+
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('class.reflectiontype')/db:refentry/db:refsect1[@role='description']/descendant::db:methodsynopsis[1])">
38+
<xi:fallback />
39+
</xi:include>
3740

3841
</classsynopsis>
3942
<!-- }}} -->
4043
</section>
4144

45+
<section role="changelog" xml:id="reflectiontype.changelog"><!-- {{{ -->
46+
&reftitle.changelog;
47+
<para>
48+
<informaltable>
49+
<tgroup cols="2">
50+
<thead>
51+
<row>
52+
<entry>&Version;</entry>
53+
<entry>&Description;</entry>
54+
</row>
55+
</thead>
56+
<tbody>
57+
<row>
58+
<entry>8.0.0</entry>
59+
<entry>
60+
<classname>ReflectionType</classname> has become abstract and <function>ReflectionType::isBuiltin</function>
61+
has been moved to <function>ReflectionNamedType::isBuiltin</function>.
62+
</entry>
63+
</row>
64+
</tbody>
65+
</tgroup>
66+
</informaltable>
67+
</para>
68+
</section><!-- }}} -->
69+
4270
</partintro>
4371

4472
&reference.reflection.entities.reflectiontype;

reference/reflection/reflectiontype/allowsnull.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ var_dump($reflectionParams[0]->getType()->allowsNull());
4747
var_dump($reflectionParams[1]->getType()->allowsNull());
4848
]]>
4949
</programlisting>
50-
&example.outputs.similar;
50+
&example.outputs;
5151
<screen>
5252
<![CDATA[
5353
bool(false)
@@ -62,7 +62,7 @@ bool(true)
6262
&reftitle.seealso;
6363
<para>
6464
<simplelist>
65-
<member><methodname>ReflectionType::isBuiltin</methodname></member>
65+
<member><methodname>ReflectionNamedType::isBuiltin</methodname></member>
6666
<member><methodname>ReflectionType::__toString</methodname></member>
6767
<member><methodname>ReflectionParameter::getType</methodname></member>
6868
</simplelist>

reference/reflection/reflectiontype/tostring.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,9 @@ string
8787
<para>
8888
<simplelist>
8989
<member><methodname>ReflectionNamedType::getName</methodname></member>
90+
<member><methodname>ReflectionNamedType::isBuiltin</methodname></member>
9091
<member><methodname>ReflectionType::allowsNull</methodname></member>
91-
<member><methodname>ReflectionType::isBuiltin</methodname></member>
92+
<member><methodname>ReflectionUnionType::getTypes</methodname></member>
9293
<member><methodname>ReflectionParameter::getType</methodname></member>
9394
</simplelist>
9495
</para>
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!-- $Revision$ -->
3+
4+
<phpdoc:classref xml:id="class.reflectionuniontype" xmlns:phpdoc="http://php.net/ns/phpdoc" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude">
5+
6+
<title>The ReflectionUnionType class</title>
7+
<titleabbrev>ReflectionUnionType</titleabbrev>
8+
9+
<partintro>
10+
11+
<!-- {{{ ReflectionUnionType intro -->
12+
<section xml:id="reflectionuniontype.intro">
13+
&reftitle.intro;
14+
<para>
15+
16+
</para>
17+
</section>
18+
<!-- }}} -->
19+
20+
<section xml:id="reflectionuniontype.synopsis">
21+
&reftitle.classsynopsis;
22+
23+
<!-- {{{ Synopsis -->
24+
<classsynopsis>
25+
<ooclass><classname>ReflectionUnionType</classname></ooclass>
26+
27+
<!-- {{{ Class synopsis -->
28+
<classsynopsisinfo>
29+
<ooclass>
30+
<classname>ReflectionUnionType</classname>
31+
</ooclass>
32+
33+
<ooclass>
34+
<modifier>extends</modifier>
35+
<classname>ReflectionType</classname>
36+
</ooclass>
37+
</classsynopsisinfo>
38+
<!-- }}} -->
39+
40+
<classsynopsisinfo role="comment">&Methods;</classsynopsisinfo>
41+
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('class.reflectionuniontype')/db:refentry/db:refsect1[@role='description']/descendant::db:methodsynopsis[not(@role='procedural')])">
42+
<xi:fallback />
43+
</xi:include>
44+
<classsynopsisinfo role="comment">&InheritedMethods;</classsynopsisinfo>
45+
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('class.reflectiontype')/db:refentry/db:refsect1[@role='description']/descendant::db:methodsynopsis[not(@role='procedural')])">
46+
<xi:fallback />
47+
</xi:include>
48+
49+
</classsynopsis>
50+
<!-- }}} -->
51+
52+
</section>
53+
54+
</partintro>
55+
56+
&reference.reflection.entities.reflectionuniontype;
57+
58+
</phpdoc:classref>
59+
60+
<!-- Keep this comment at the end of the file
61+
Local variables:
62+
mode: sgml
63+
sgml-omittag:t
64+
sgml-shorttag:t
65+
sgml-minimize-attributes:nil
66+
sgml-always-quote-attributes:t
67+
sgml-indent-step:1
68+
sgml-indent-data:t
69+
indent-tabs-mode:nil
70+
sgml-parent-document:nil
71+
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
72+
sgml-exposed-tags:nil
73+
sgml-local-catalogs:nil
74+
sgml-local-ecat-files:nil
75+
End:
76+
vim600: syn=xml fen fdm=syntax fdl=2 si
77+
vim: et tw=78 syn=sgml
78+
vi: ts=1 sw=1
79+
-->
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!-- $Revision$ -->
3+
4+
<refentry xml:id="reflectionuniontype.gettypes" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
5+
<refnamediv>
6+
<refname>ReflectionUnionType::getTypes</refname>
7+
<refpurpose>Returns the types included in the union type</refpurpose>
8+
</refnamediv>
9+
10+
<refsect1 role="description">
11+
&reftitle.description;
12+
<methodsynopsis>
13+
<modifier>public</modifier> <type>array</type><methodname>ReflectionUnionType::getTypes</methodname>
14+
<void />
15+
</methodsynopsis>
16+
<para>
17+
Returns the reflections of types included in the union type.
18+
</para>
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+
<para>
29+
An array of <classname>ReflectionType</classname> objects.
30+
</para>
31+
</refsect1>
32+
33+
<refsect1 role="examples">
34+
&reftitle.examples;
35+
<para>
36+
<example>
37+
<title><methodname>ReflectionUnionType::getTypes</methodname> example</title>
38+
<programlisting role="php">
39+
<![CDATA[
40+
<?php
41+
function someFunction(int|float $number) {}
42+
43+
$reflectionFunc = new ReflectionFunction('someFunction');
44+
$reflectionParam = $reflectionFunc->getParameters()[0];
45+
46+
var_dump($reflectionParam->getType()->getTypes());
47+
]]>
48+
</programlisting>
49+
&example.outputs.similar;
50+
<screen>
51+
<![CDATA[
52+
array(2) {
53+
[0] =>
54+
class ReflectionNamedType#4(0) {
55+
}
56+
[1] =>
57+
class ReflectionNamedType#5(0) {
58+
}
59+
}
60+
]]>
61+
</screen>
62+
</example>
63+
</para>
64+
</refsect1>
65+
66+
<refsect1 role="seealso">
67+
&reftitle.seealso;
68+
<para>
69+
<simplelist>
70+
<member><methodname>ReflectionType::allowsNull</methodname></member>
71+
<member><methodname>ReflectionParameter::getType</methodname></member>
72+
</simplelist>
73+
</para>
74+
</refsect1>
75+
76+
</refentry>
77+
78+
<!-- Keep this comment at the end of the file
79+
Local variables:
80+
mode: sgml
81+
sgml-omittag:t
82+
sgml-shorttag:t
83+
sgml-minimize-attributes:nil
84+
sgml-always-quote-attributes:t
85+
sgml-indent-step:1
86+
sgml-indent-data:t
87+
indent-tabs-mode:nil
88+
sgml-parent-document:nil
89+
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
90+
sgml-exposed-tags:nil
91+
sgml-local-catalogs:nil
92+
sgml-local-ecat-files:nil
93+
End:
94+
vim600: syn=xml fen fdm=syntax fdl=2 si
95+
vim: et tw=78 syn=sgml
96+
vi: ts=1 sw=1
97+
-->

reference/reflection/versions.xml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,11 +319,12 @@
319319

320320
<function name="reflectiontype" from="PHP 7"/>
321321
<function name="reflectiontype::allowsnull" from="PHP 7"/>
322-
<function name="reflectiontype::isbuiltin" from="PHP 7"/>
322+
323323
<function name="reflectiontype::__tostring" from="PHP 7"/>
324324

325325
<function name="reflectionnamedtype" from="PHP 7 &gt;= 7.1.0"/>
326326
<function name="reflectionnamedtype::getname" from="PHP 7 &gt;= 7.1.0"/>
327+
<function name="reflectionnamedtype::isbuiltin" from="PHP 7"/>
327328

328329
<function name="reflectiongenerator" from="PHP 7"/>
329330
<function name="reflectiongenerator::__construct" from="PHP 7"/>
@@ -337,6 +338,9 @@
337338
<function name="reflectionreference" from="PHP 7 &gt;= 7.4.0" />
338339
<function name="reflectionreference::fromarrayelement" from="PHP 7 &gt;= 7.4.0" />
339340
<function name="reflectionreference::getid" from="PHP 7 &gt;= 7.4.0" />
341+
342+
<function name="reflectionuniontype" from="PHP 8"/>
343+
<function name="reflectionuniontype::gettypes" from="PHP 8"/>
340344
</versions>
341345
<!-- Keep this comment at the end of the file
342346
Local variables:

0 commit comments

Comments
 (0)