Skip to content

Commit 996fb2c

Browse files
committed
[PHP 8.4] プロパティフック関係の、Reflection まわりの追加変更に追随
但し、 #271 で問題になっている propertyhooktype.xml は除く。
1 parent a8fc6c3 commit 996fb2c

File tree

18 files changed

+1676
-2
lines changed

18 files changed

+1676
-2
lines changed
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!-- $Revision$ -->
3+
<!-- EN-Revision: aaa628268c063a3fc93877d9a739c65b6b803eea Maintainer: mumumu Status: ready -->
4+
<refentry xml:id="reflectionclassconstant.gettype" xmlns="http://docbook.org/ns/docbook">
5+
<refnamediv>
6+
<refname>ReflectionClassConstant::getType</refname>
7+
<refpurpose>クラス定数の型を取得する</refpurpose>
8+
</refnamediv>
9+
10+
<refsect1 role="description">
11+
&reftitle.description;
12+
<methodsynopsis role="ReflectionClassConstant">
13+
<modifier>public</modifier> <type class="union"><type>ReflectionType</type><type>null</type></type><methodname>ReflectionClassConstant::getType</methodname>
14+
<void/>
15+
</methodsynopsis>
16+
<simpara>
17+
クラス定数に関連付けられた型を取得します。
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+
定数に型が指定されている場合、<classname>ReflectionType</classname> を返します。
30+
指定されていない場合は、&null; を返します。
31+
</simpara>
32+
</refsect1>
33+
34+
<refsect1 role="seealso">
35+
&reftitle.seealso;
36+
<simplelist>
37+
<member><methodname>ReflectionClassConstant::hasType</methodname></member>
38+
<member><classname>ReflectionType</classname></member>
39+
</simplelist>
40+
</refsect1>
41+
42+
</refentry>
43+
<!-- Keep this comment at the end of the file
44+
Local variables:
45+
mode: sgml
46+
sgml-omittag:t
47+
sgml-shorttag:t
48+
sgml-minimize-attributes:nil
49+
sgml-always-quote-attributes:t
50+
sgml-indent-step:1
51+
sgml-indent-data:t
52+
indent-tabs-mode:nil
53+
sgml-parent-document:nil
54+
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
55+
sgml-exposed-tags:nil
56+
sgml-local-catalogs:nil
57+
sgml-local-ecat-files:nil
58+
End:
59+
vim600: syn=xml fen fdm=syntax fdl=2 si
60+
vim: et tw=78 syn=sgml
61+
vi: ts=1 sw=1
62+
-->
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!-- $Revision$ -->
3+
<!-- EN-Revision: 8660511c7435b20a3ac80641fd124fb3fd04e43e Maintainer: mumumu Status: ready -->
4+
<refentry xml:id="reflectionclassconstant.hastype" xmlns="http://docbook.org/ns/docbook">
5+
<refnamediv>
6+
<refname>ReflectionClassConstant::hasType</refname>
7+
<refpurpose>クラス定数に型が指定されているかを調べる</refpurpose>
8+
</refnamediv>
9+
10+
<refsect1 role="description">
11+
&reftitle.description;
12+
<methodsynopsis role="ReflectionClassConstant">
13+
<modifier>public</modifier> <type>bool</type><methodname>ReflectionClassConstant::hasType</methodname>
14+
<void/>
15+
</methodsynopsis>
16+
<simpara>
17+
クラス定数に、型が関連付けられているかを調べます。
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; を返します。
30+
指定されていない場合は、&false; を返します。
31+
</simpara>
32+
</refsect1>
33+
34+
<refsect1 role="seealso">
35+
&reftitle.seealso;
36+
<simplelist>
37+
<member><methodname>ReflectionClassConstant::getType</methodname></member>
38+
<member><classname>ReflectionType</classname></member>
39+
</simplelist>
40+
</refsect1>
41+
42+
</refentry>
43+
<!-- Keep this comment at the end of the file
44+
Local variables:
45+
mode: sgml
46+
sgml-omittag:t
47+
sgml-shorttag:t
48+
sgml-minimize-attributes:nil
49+
sgml-always-quote-attributes:t
50+
sgml-indent-step:1
51+
sgml-indent-data:t
52+
indent-tabs-mode:nil
53+
sgml-parent-document:nil
54+
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
55+
sgml-exposed-tags:nil
56+
sgml-local-catalogs:nil
57+
sgml-local-ecat-files:nil
58+
End:
59+
vim600: syn=xml fen fdm=syntax fdl=2 si
60+
vim: et tw=78 syn=sgml
61+
vi: ts=1 sw=1
62+
-->
Lines changed: 176 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,176 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!-- $Revision$ -->
3+
<!-- EN-Revision: 1870b4c6aa53e14eec6201eb63f28ed6be6349f7 Maintainer: mumumu Status: ready -->
4+
<refentry xml:id="reflectionfunctionabstract.getclosurecalledclass" xmlns="http://docbook.org/ns/docbook">
5+
<refnamediv>
6+
<refname>ReflectionFunctionAbstract::getClosureCalledClass</refname>
7+
<refpurpose>クロージャ内部で static:: に対応するクラスを返す</refpurpose>
8+
</refnamediv>
9+
10+
<refsect1 role="description">
11+
&reftitle.description;
12+
<methodsynopsis role="ReflectionFunctionAbstract">
13+
<modifier>public</modifier> <type class="union"><type>ReflectionClass</type><type>null</type></type><methodname>ReflectionFunctionAbstract::getClosureCalledClass</methodname>
14+
<void/>
15+
</methodsynopsis>
16+
<simpara>
17+
<classname>Closure</classname> 内部で <literal>static::</literal>
18+
に対応するクラス名に解決されるクラスを、<classname>ReflectionClass</classname>
19+
として返します。
20+
</simpara>
21+
</refsect1>
22+
23+
<refsect1 role="parameters">
24+
&reftitle.parameters;
25+
&no.function.parameters;
26+
</refsect1>
27+
28+
<refsect1 role="returnvalues">
29+
&reftitle.returnvalues;
30+
<simpara>
31+
<classname>Closure</classname> 内部で <literal>static::</literal>
32+
で表現されるクラスに対応する <classname>ReflectionClass</classname> を返します。
33+
関数がクロージャでないか、グローバルスコープの場合は &null; を返します。
34+
</simpara>
35+
</refsect1>
36+
37+
<refsect1 role="examples">
38+
&reftitle.examples;
39+
<example>
40+
<title>
41+
この例は、オブジェクトコンテキスト内部のクロージャについて、
42+
<methodname>ReflectionFunctionAbstract::getClosureCalledClass</methodname>,
43+
<methodname>ReflectionFunctionAbstract::getClosureScopeClass</methodname>,
44+
<methodname>ReflectionFunctionAbstract::getClosureThis</methodname>
45+
の違いを示しています。
46+
</title>
47+
<programlisting role="php">
48+
<![CDATA[
49+
<?php
50+
51+
class A
52+
{
53+
public function getClosure()
54+
{
55+
var_dump(self::class, static::class);
56+
57+
return function() {};
58+
}
59+
}
60+
61+
class B extends A {}
62+
63+
$b = new B();
64+
$c = $b->getClosure();
65+
$r = new ReflectionFunction($c);
66+
67+
var_dump($r->getClosureThis()); // $this === $b, since a non-static closure take the object context
68+
var_dump($r->getClosureScopeClass()); // Corresponds to the self::class resolution inside a closure
69+
var_dump($r->getClosureCalledClass()); // Corresponds to the static::class resolution inside a closure
70+
71+
?>
72+
]]>
73+
</programlisting>
74+
&example.outputs;
75+
<screen>
76+
<![CDATA[
77+
string(1) "A"
78+
string(1) "B"
79+
object(B)#1 (0) {
80+
}
81+
object(ReflectionClass)#4 (1) {
82+
["name"]=>
83+
string(1) "A"
84+
}
85+
object(ReflectionClass)#4 (1) {
86+
["name"]=>
87+
string(1) "B"
88+
}
89+
]]>
90+
</screen>
91+
</example>
92+
<example>
93+
<title>
94+
この例は、オブジェクトコンテキストが存在しない static なクロージャについて、
95+
<methodname>ReflectionFunctionAbstract::getClosureCalledClass</methodname>,
96+
<methodname>ReflectionFunctionAbstract::getClosureScopeClass</methodname>,
97+
<methodname>ReflectionFunctionAbstract::getClosureThis</methodname>
98+
の違いを示しています。
99+
</title>
100+
<programlisting role="php">
101+
<![CDATA[
102+
<?php
103+
104+
class A
105+
{
106+
public function getClosure()
107+
{
108+
var_dump(self::class, static::class);
109+
110+
return static function() {};
111+
}
112+
}
113+
114+
class B extends A {}
115+
116+
$b = new B();
117+
$c = $b->getClosure();
118+
$r = new ReflectionFunction($c);
119+
120+
var_dump($r->getClosureThis()); // NULL, since the pseudo-variable $this is not available in a static context
121+
var_dump($r->getClosureScopeClass()); // Corresponds to the self::class resolution inside a closure
122+
var_dump($r->getClosureCalledClass()); // Corresponds to the static::class resolution inside a closure
123+
124+
?>
125+
]]>
126+
</programlisting>
127+
&example.outputs;
128+
<screen>
129+
<![CDATA[
130+
string(1) "A"
131+
string(1) "B"
132+
NULL
133+
object(ReflectionClass)#4 (1) {
134+
["name"]=>
135+
string(1) "A"
136+
}
137+
object(ReflectionClass)#4 (1) {
138+
["name"]=>
139+
string(1) "B"
140+
}
141+
142+
]]>
143+
</screen>
144+
</example>
145+
</refsect1>
146+
147+
<refsect1 role="seealso">
148+
&reftitle.seealso;
149+
<simplelist>
150+
<member><methodname>ReflectionFunctionAbstract::getClosureScopeClass</methodname></member>
151+
<member><methodname>ReflectionFunctionAbstract::getClosureThis</methodname></member>
152+
<member><xref linkend="language.oop5.late-static-bindings" /></member>
153+
</simplelist>
154+
</refsect1>
155+
156+
</refentry>
157+
<!-- Keep this comment at the end of the file
158+
Local variables:
159+
mode: sgml
160+
sgml-omittag:t
161+
sgml-shorttag:t
162+
sgml-minimize-attributes:nil
163+
sgml-always-quote-attributes:t
164+
sgml-indent-step:1
165+
sgml-indent-data:t
166+
indent-tabs-mode:nil
167+
sgml-parent-document:nil
168+
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
169+
sgml-exposed-tags:nil
170+
sgml-local-catalogs:nil
171+
sgml-local-ecat-files:nil
172+
End:
173+
vim600: syn=xml fen fdm=syntax fdl=2 si
174+
vim: et tw=78 syn=sgml
175+
vi: ts=1 sw=1
176+
-->
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!-- $Revision$ -->
3+
<!-- EN-Revision: 13b858f44464a73a1c93bb5f8b6d026216a8ce45 Maintainer: mumumu Status: ready -->
4+
<refentry xml:id="reflectionparameter.ispromoted" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
5+
<refnamediv>
6+
<refname>ReflectionParameter::isPromoted</refname>
7+
<refpurpose>パラメータがプロパティに昇格しているかを調べる</refpurpose>
8+
</refnamediv>
9+
10+
<refsect1 role="description">
11+
&reftitle.description;
12+
<methodsynopsis role="ReflectionParameter">
13+
<modifier>public</modifier> <type>bool</type><methodname>ReflectionParameter::isPromoted</methodname>
14+
<void/>
15+
</methodsynopsis>
16+
<simpara>
17+
パラメータが
18+
<link linkend="language.oop5.decon.constructor.promotion">コンストラクタのプロモーション</link>
19+
によってプロパティに昇格しているかを調べます。
20+
</simpara>
21+
</refsect1>
22+
23+
<refsect1 role="parameters">
24+
&reftitle.parameters;
25+
&no.function.parameters;</refsect1>
26+
27+
<refsect1 role="returnvalues">
28+
&reftitle.returnvalues;
29+
<simpara>
30+
パラメータがプロパティに昇格している場合は &true; を返します。
31+
そうでない場合は &false; を返します。
32+
</simpara>
33+
</refsect1>
34+
35+
<refsect1 role="seealso">
36+
&reftitle.seealso;
37+
<simplelist>
38+
<member><methodname>ReflectionProperty::isPromoted</methodname></member>
39+
</simplelist>
40+
</refsect1>
41+
42+
</refentry>
43+
<!-- Keep this comment at the end of the file
44+
Local variables:
45+
mode: sgml
46+
sgml-omittag:t
47+
sgml-shorttag:t
48+
sgml-minimize-attributes:nil
49+
sgml-always-quote-attributes:t
50+
sgml-indent-step:1
51+
sgml-indent-data:t
52+
indent-tabs-mode:nil
53+
sgml-parent-document:nil
54+
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
55+
sgml-exposed-tags:nil
56+
sgml-local-catalogs:nil
57+
sgml-local-ecat-files:nil
58+
End:
59+
vim600: syn=xml fen fdm=syntax fdl=2 si
60+
vim: et tw=78 syn=sgml
61+
vi: ts=1 sw=1
62+
-->

0 commit comments

Comments
 (0)