Skip to content

Commit 7c21781

Browse files
doc-en と同期し 7 モジュールを完訳(既訳更新 20 件) (#415)
* imagick: 例外クラスの methodsynopsis xpointer の誤りを原文に合わせて修正(5ファイル) 自前のメソッドを持たない例外クラスで &Methods; の include が存在しない refentry を指しており、&InheritedMethods; も role にクラス名自身を使って いたため、どちらも空のノードセットを選択していた。 php/doc-en@1fe6141098 * soap: サンプルコードの new 演算子の欠落を原文に合わせて修正(4ファイル) php/doc-en@84534c795f * snmp: 関数名 snmp2_get_next の誤りを snmp2_getnext に修正 php/doc-en@84534c795f * ssh2: ssh2_sftp_* の戻り値型への false の追加を同期(4ファイル) 失敗時に false を返す旨が、シグネチャと戻り値の節の両方に追加された。 php/doc-en@cad275c0c1 * ReturnTypeWillChange の説明の改稿を同期(3ファイル) 暫定的な戻り値の型のフェーズについての説明が書き直され、ユーザー定義 クラスのメソッドをオーバーライドする場合の挙動が独立した段落になった。 空の xi:fallback の除去もあわせて反映した。 reflection 側は説明文に class.returntypewillchange へのリンクが追加された。 php/doc-en@52e8875935 php/doc-en@603435cd84 * array/exec/intl: コード例の修正を同期(3ファイル) array_merge: 短縮配列構文への変更と、(array) キャストの例の削除 php/doc-en@52209b319a exec: 不要な初期化の削除と、$retval の $result_code への改名 php/doc-en@462dddda87 intl_get_error_message: サンプルの差し替えと出力例の追加 php/doc-en@d5e705df75
1 parent 7040277 commit 7c21781

20 files changed

Lines changed: 128 additions & 161 deletions

language/predefined/attributes/returntypewillchange.xml

Lines changed: 29 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<!-- $Revision$ -->
3-
<!-- EN-Revision: 0019a7e201442447fd746c2852d28ba839ed15ae Maintainer: mumumu Status: ready -->
3+
<!-- EN-Revision: 52e88759354dd18104d8c067780be9f582f20136 Maintainer: mumumu Status: ready -->
44
<reference xml:id="class.returntypewillchange" role="class" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude">
55
<title>ReturnTypeWillChange アトリビュート</title>
66
<titleabbrev>ReturnTypeWillChange</titleabbrev>
@@ -9,32 +9,48 @@
99

1010
<section xml:id="returntypewillchange.intro">
1111
&reftitle.intro;
12+
<simpara>
13+
PHP 8.1.0 以降、内部クラスのメソッドが戻り値の型を宣言するようになる、
14+
暫定的な移行フェーズが始まりました。
15+
</simpara>
16+
1217
<simpara>
1318
ほとんどの final でない内部メソッドは、
14-
それをオーバライドする際
19+
それをオーバーライドする際
1520
互換性がある戻り値の型を宣言することが必須になっています。
1621
そうしない場合、継承が有効かを検証する際に、
17-
推奨されない警告が発生します。
18-
これは、暫定的な戻り値の型のフェーズを導入するものです。
19-
つまり、戻り値の型に互換性がない場合、将来のバージョンでそれが強制されるまでは、
20-
エンジンは致命的なエラーではなく、推奨されない警告を発生させます。
22+
シグネチャが共変性のルールに違反しているという推奨されない警告が発生します。
23+
</simpara>
24+
25+
<simpara>
26+
将来のバージョンの PHP では、メソッドのシグネチャが厳密にチェックされるようになり、
27+
互換性がない場合は致命的なエラーが発生するようになります。
28+
</simpara>
29+
30+
<simpara>
2131
PHP のバージョン間の互換性を保ちたいがために、
22-
戻り値の型を宣言できない場合、
32+
戻り値の型を宣言できない場合や、
33+
オーバーライドするメソッドが互換性のない戻り値の型を宣言している場合は、
2334
アトリビュート <code>#[\ReturnTypeWillChange]</code>
2435
を追加することで警告を抑止できます。
2536
</simpara>
2637

2738
<warning>
39+
<simpara>
40+
ユーザー定義のクラスで定義されたメソッドをオーバーライドする場合、
41+
戻り値の型は厳密にチェックされます。
42+
オーバーライドするメソッドにこのアトリビュートが指定されていても、
43+
型に互換性がない場合は致命的なエラーが発生します。
44+
</simpara>
45+
2846
<simpara>
2947
<classname>ReturnTypeWillChange</classname> アトリビュートが推奨されない警告を抑止するのは、
3048
暫定的な戻り値の型のフェーズの間<emphasis>だけ</emphasis>です。
31-
ユーザー定義のクラスで定義されたメソッドをオーバーライドする場合には、何の効果もありません。
32-
内部メソッドが strict な型を採用すると、
33-
オーバーライドするメソッドのシグネチャの不一致は致命的なエラーを引き起こすようになり、
34-
このアトリビュートは何の効果も持たなくなります。
49+
厳密な型チェックが強制されるようになると、このアトリビュートは機能しなくなり、
50+
内部クラスのメソッドをオーバーライドする際にシグネチャの互換性がないと、
51+
致命的なエラーが発生するようになります。
3552
</simpara>
3653
</warning>
37-
3854
</section>
3955

4056
<section xml:id="returntypewillchange.synopsis">
@@ -48,9 +64,7 @@
4864
</ooclass>
4965

5066
<classsynopsisinfo role="comment">&Methods;</classsynopsisinfo>
51-
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('class.returntypewillchange')/db:refentry/db:refsect1[@role='description']/descendant::db:constructorsynopsis[@role='ReturnTypeWillChange'])">
52-
<xi:fallback/>
53-
</xi:include>
67+
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('class.returntypewillchange')/db:refentry/db:refsect1[@role='description']/descendant::db:constructorsynopsis[@role='ReturnTypeWillChange'])"/>
5468
</classsynopsis>
5569

5670
</section>

reference/array/functions/array-merge.xml

Lines changed: 16 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<!-- $Revision$ -->
3-
<!-- EN-Revision: 2e60c5134e7a847c99f81eb3f7ecee1f5efeeace Maintainer: hirokawa Status: ready -->
3+
<!-- EN-Revision: 52209b319aabbecad59f887b6dff3fb15156f1ff Maintainer: hirokawa Status: ready -->
44
<!-- CREDITS: shimooka,mumumu -->
55
<refentry xml:id="function.array-merge" xmlns="http://docbook.org/ns/docbook">
66
<refnamediv>
@@ -83,11 +83,13 @@
8383
<programlisting role="php">
8484
<![CDATA[
8585
<?php
86-
$array1 = array("color" => "red", 2, 4);
87-
$array2 = array("a", "b", "color" => "green", "shape" => "trapezoid", 4);
86+
87+
$array1 = ["color" => "red", 2, 4];
88+
$array2 = ["a", "b", "color" => "green", "shape" => "trapezoid", 4];
89+
8890
$result = array_merge($array1, $array2);
91+
8992
print_r($result);
90-
?>
9193
]]>
9294
</programlisting>
9395
&example.outputs;
@@ -113,11 +115,13 @@ Array
113115
<programlisting role="php">
114116
<![CDATA[
115117
<?php
116-
$array1 = array();
117-
$array2 = array(1 => "data");
118+
119+
$array1 = [];
120+
$array2 = [1 => "data"];
121+
118122
$result = array_merge($array1, $array2);
123+
119124
print_r($result);
120-
?>
121125
]]>
122126
</programlisting>
123127
<para>
@@ -140,11 +144,13 @@ Array
140144
<programlisting role="php">
141145
<![CDATA[
142146
<?php
143-
$array1 = array(0 => 'zero_a', 2 => 'two_a', 3 => 'three_a');
144-
$array2 = array(1 => 'one_b', 3 => 'three_b', 4 => 'four_b');
147+
148+
$array1 = [0 => 'zero_a', 2 => 'two_a', 3 => 'three_a'];
149+
$array2 = [1 => 'one_b', 3 => 'three_b', 4 => 'four_b'];
150+
145151
$result = $array1 + $array2;
152+
146153
var_dump($result);
147-
?>
148154
]]>
149155
</programlisting>
150156
<para>
@@ -166,31 +172,6 @@ array(5) {
166172
[4]=>
167173
string(6) "four_b"
168174
}
169-
]]>
170-
</screen>
171-
</example>
172-
</para>
173-
<para>
174-
<example>
175-
<title><function>array_merge</function> で配列以外の型を扱う例</title>
176-
<programlisting role="php">
177-
<![CDATA[
178-
<?php
179-
$beginning = 'foo';
180-
$end = array(1 => 'bar');
181-
$result = array_merge((array) $beginning, (array) $end);
182-
print_r($result);
183-
?>
184-
]]>
185-
</programlisting>
186-
&example.outputs;
187-
<screen role="php">
188-
<![CDATA[
189-
Array
190-
(
191-
[0] => foo
192-
[1] => bar
193-
)
194175
]]>
195176
</screen>
196177
</example>

reference/exec/functions/exec.xml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<!-- $Revision$ -->
3-
<!-- EN-Revision: b412bbd26214f7281ac7dd858710e09952a275f2 Maintainer: hirokawa Status: ready -->
3+
<!-- EN-Revision: 462dddda87baa86fd760dcb1e3a0d2096e00a59b Maintainer: hirokawa Status: ready -->
44
<!-- CREDITS: shimooka,mumumu -->
55
<!-- splitted from ./en/functions/exec.xml, last change in rev 1.2 -->
66
<refentry xml:id="function.exec" xmlns="http://docbook.org/ns/docbook">
@@ -130,10 +130,8 @@
130130
<?php
131131
// ("whoami" コマンドをパスに有するシステム上で)
132132
// 実行中のphp/httpdプロセスを所有するユーザーの名前を出力
133-
$output=null;
134-
$retval=null;
135-
exec('whoami', $output, $retval);
136-
echo "Returned with status $retval and output:\n";
133+
exec('whoami', $output, $result_code);
134+
echo "Returned with status $result_code and output:\n";
137135
print_r($output);
138136
?>
139137
]]>

reference/imagick/imagickdrawexception.xml

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<!-- $Revision$ -->
3-
<!-- EN-Revision: 4947a993e6d5050f4271f3c5eb7b1cd4b7c1c2e4 Maintainer: mumumu Status: ready -->
3+
<!-- EN-Revision: 1fe6141098fa1ea26b0030cc9cbd3a8516c25961 Maintainer: mumumu Status: ready -->
44
<reference role="exception" xml:id="class.imagickdrawexception" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude">
55
<title>The ImagickDrawException class</title>
66
<titleabbrev>ImagickDrawException</titleabbrev>
@@ -40,20 +40,12 @@
4040
</oointerface>
4141
</classsynopsisinfo>
4242
<classsynopsisinfo role="comment">&InheritedProperties;</classsynopsisinfo>
43-
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('exception.synopsis')/descendant::db:fieldsynopsis)">
44-
<xi:fallback/>
45-
</xi:include>
43+
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('exception.synopsis')/descendant::db:fieldsynopsis)"/>
4644

4745

48-
<classsynopsisinfo role="comment">&Methods;</classsynopsisinfo>
49-
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('class.imagickdrawexception')/db:refentry/db:refsect1[@role='description']/descendant::db:methodsynopsis[@role='ImagickDrawException'])">
50-
<xi:fallback/>
51-
</xi:include>
52-
5346
<classsynopsisinfo role="comment">&InheritedMethods;</classsynopsisinfo>
54-
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('class.exception')/db:refentry/db:refsect1[@role='description']/descendant::db:methodsynopsis[@role='ImagickDrawException'])">
55-
<xi:fallback/>
56-
</xi:include>
47+
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('class.exception')/db:refentry/db:refsect1[@role='description']/descendant::db:constructorsynopsis[@role='Exception'])"/>
48+
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('class.exception')/db:refentry/db:refsect1[@role='description']/descendant::db:methodsynopsis[@role='Exception'])"/>
5749

5850
</classsynopsis>
5951
<!-- }}} -->

reference/imagick/imagickexception.xml

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<!-- $Revision$ -->
3-
<!-- EN-Revision: 4947a993e6d5050f4271f3c5eb7b1cd4b7c1c2e4 Maintainer: mumumu Status: ready -->
3+
<!-- EN-Revision: 1fe6141098fa1ea26b0030cc9cbd3a8516c25961 Maintainer: mumumu Status: ready -->
44
<reference role="exception" xml:id="class.imagickexception" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude">
55
<title>The ImagickException class</title>
66
<titleabbrev>ImagickException</titleabbrev>
@@ -40,20 +40,12 @@
4040
</oointerface>
4141
</classsynopsisinfo>
4242
<classsynopsisinfo role="comment">&InheritedProperties;</classsynopsisinfo>
43-
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('exception.synopsis')/descendant::db:fieldsynopsis)">
44-
<xi:fallback/>
45-
</xi:include>
43+
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('exception.synopsis')/descendant::db:fieldsynopsis)"/>
4644

4745

48-
<classsynopsisinfo role="comment">&Methods;</classsynopsisinfo>
49-
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('class.imagickexception')/db:refentry/db:refsect1[@role='description']/descendant::db:methodsynopsis[@role='ImagickException'])">
50-
<xi:fallback/>
51-
</xi:include>
52-
5346
<classsynopsisinfo role="comment">&InheritedMethods;</classsynopsisinfo>
54-
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('class.exception')/db:refentry/db:refsect1[@role='description']/descendant::db:methodsynopsis[@role='ImagickException'])">
55-
<xi:fallback/>
56-
</xi:include>
47+
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('class.exception')/db:refentry/db:refsect1[@role='description']/descendant::db:constructorsynopsis[@role='Exception'])"/>
48+
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('class.exception')/db:refentry/db:refsect1[@role='description']/descendant::db:methodsynopsis[@role='Exception'])"/>
5749

5850
</classsynopsis>
5951
<!-- }}} -->

reference/imagick/imagickkernelexception.xml

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<!-- $Revision$ -->
3-
<!-- EN-Revision: 4947a993e6d5050f4271f3c5eb7b1cd4b7c1c2e4 Maintainer: mumumu Status: ready -->
3+
<!-- EN-Revision: 1fe6141098fa1ea26b0030cc9cbd3a8516c25961 Maintainer: mumumu Status: ready -->
44

55
<reference xml:id="class.imagickkernelexception" role="exception" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude">
66

@@ -38,20 +38,12 @@
3838
</classsynopsisinfo>
3939
<!-- }}} -->
4040
<classsynopsisinfo role="comment">&InheritedProperties;</classsynopsisinfo>
41-
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('exception.synopsis')/descendant::db:fieldsynopsis)">
42-
<xi:fallback/>
43-
</xi:include>
41+
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('exception.synopsis')/descendant::db:fieldsynopsis)"/>
4442

4543

46-
<classsynopsisinfo role="comment">&Methods;</classsynopsisinfo>
47-
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('class.imagickkernelexception')/db:refentry/db:refsect1[@role='description']/descendant::db:methodsynopsis[@role='ImagickKernelException'])">
48-
<xi:fallback/>
49-
</xi:include>
50-
5144
<classsynopsisinfo role="comment">&InheritedMethods;</classsynopsisinfo>
52-
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('class.exception')/db:refentry/db:refsect1[@role='description']/descendant::db:methodsynopsis[@role='ImagickKernelException'])">
53-
<xi:fallback/>
54-
</xi:include>
45+
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('class.exception')/db:refentry/db:refsect1[@role='description']/descendant::db:constructorsynopsis[@role='Exception'])"/>
46+
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('class.exception')/db:refentry/db:refsect1[@role='description']/descendant::db:methodsynopsis[@role='Exception'])"/>
5547

5648
</classsynopsis>
5749
<!-- }}} -->

reference/imagick/imagickpixelexception.xml

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<!-- $Revision$ -->
3-
<!-- EN-Revision: 4947a993e6d5050f4271f3c5eb7b1cd4b7c1c2e4 Maintainer: mumumu Status: ready -->
3+
<!-- EN-Revision: 1fe6141098fa1ea26b0030cc9cbd3a8516c25961 Maintainer: mumumu Status: ready -->
44
<reference role="exception" xml:id="class.imagickpixelexception" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude">
55
<title>The ImagickPixelException class</title>
66
<titleabbrev>ImagickPixelException</titleabbrev>
@@ -40,20 +40,12 @@
4040
</oointerface>
4141
</classsynopsisinfo>
4242
<classsynopsisinfo role="comment">&InheritedProperties;</classsynopsisinfo>
43-
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('exception.synopsis')/descendant::db:fieldsynopsis)">
44-
<xi:fallback/>
45-
</xi:include>
43+
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('exception.synopsis')/descendant::db:fieldsynopsis)"/>
4644

4745

48-
<classsynopsisinfo role="comment">&Methods;</classsynopsisinfo>
49-
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('class.imagickpixelexception')/db:refentry/db:refsect1[@role='description']/descendant::db:methodsynopsis[@role='ImagickPixelException'])">
50-
<xi:fallback/>
51-
</xi:include>
52-
5346
<classsynopsisinfo role="comment">&InheritedMethods;</classsynopsisinfo>
54-
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('class.exception')/db:refentry/db:refsect1[@role='description']/descendant::db:methodsynopsis[@role='ImagickPixelException'])">
55-
<xi:fallback/>
56-
</xi:include>
47+
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('class.exception')/db:refentry/db:refsect1[@role='description']/descendant::db:constructorsynopsis[@role='Exception'])"/>
48+
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('class.exception')/db:refentry/db:refsect1[@role='description']/descendant::db:methodsynopsis[@role='Exception'])"/>
5749

5850
</classsynopsis>
5951
<!-- }}} -->

reference/imagick/imagickpixeliteratorexception.xml

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<!-- $Revision$ -->
3-
<!-- EN-Revision: 4947a993e6d5050f4271f3c5eb7b1cd4b7c1c2e4 Maintainer: mumumu Status: ready -->
3+
<!-- EN-Revision: 1fe6141098fa1ea26b0030cc9cbd3a8516c25961 Maintainer: mumumu Status: ready -->
44
<reference role="exception" xml:id="class.imagickpixeliteratorexception" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude">
55
<title>The ImagickPixelIteratorException class</title>
66
<titleabbrev>ImagickPixelIteratorException</titleabbrev>
@@ -40,20 +40,12 @@
4040
</oointerface>
4141
</classsynopsisinfo>
4242
<classsynopsisinfo role="comment">&InheritedProperties;</classsynopsisinfo>
43-
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('exception.synopsis')/descendant::db:fieldsynopsis)">
44-
<xi:fallback/>
45-
</xi:include>
43+
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('exception.synopsis')/descendant::db:fieldsynopsis)"/>
4644

4745

48-
<classsynopsisinfo role="comment">&Methods;</classsynopsisinfo>
49-
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('class.imagickpixeliteratorexception')/db:refentry/db:refsect1[@role='description']/descendant::db:methodsynopsis[@role='ImagickPixelIteratorException'])">
50-
<xi:fallback/>
51-
</xi:include>
52-
5346
<classsynopsisinfo role="comment">&InheritedMethods;</classsynopsisinfo>
54-
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('class.exception')/db:refentry/db:refsect1[@role='description']/descendant::db:methodsynopsis[@role='ImagickPixelIteratorException'])">
55-
<xi:fallback/>
56-
</xi:include>
47+
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('class.exception')/db:refentry/db:refsect1[@role='description']/descendant::db:constructorsynopsis[@role='Exception'])"/>
48+
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('class.exception')/db:refentry/db:refsect1[@role='description']/descendant::db:methodsynopsis[@role='Exception'])"/>
5749

5850
</classsynopsis>
5951
<!-- }}} -->

reference/intl/functions/intl-get-error-message.xml

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<!-- $Revision$ -->
3-
<!-- EN-Revision: fed3682684f1af372dc9a7f15d0468e5a884ab16 Maintainer: takagi Status: ready -->
3+
<!-- EN-Revision: d5e705df751e5d590449c2f910be5753896a7722 Maintainer: takagi Status: ready -->
44
<refentry xml:id="function.intl-get-error-message">
55
<refnamediv>
66
<refname>intl_get_error_message</refname>
@@ -32,20 +32,30 @@
3232

3333
<refsect1 role="examples">
3434
&reftitle.examples;
35-
<para>
36-
<example>
37-
<title><function>intl_get_error_message</function> の例</title>
38-
<programlisting role="php">
35+
<example>
36+
<title><function>intl_get_error_message</function> の例</title>
37+
<programlisting role="php">
3938
<![CDATA[
4039
<?php
41-
if( Collator::getAvailableLocales() === false ) {
42-
show_error( intl_get_error_message() );
40+
41+
$bundle = resourcebundle_create('en_US', __DIR__ . '/does-not-exist', false);
42+
43+
if ($bundle === null) {
44+
$errorCode = intl_get_error_code();
45+
46+
printf("Error name: %s\n", intl_error_name($errorCode));
47+
printf("Error message: %s\n", intl_get_error_message());
4348
}
44-
?>
4549
]]>
46-
</programlisting>
47-
</example>
48-
</para>
50+
</programlisting>
51+
</example>
52+
&example.outputs;
53+
<screen>
54+
<![CDATA[
55+
Error name: U_MISSING_RESOURCE_ERROR
56+
Error message: resourcebundle_create(): Cannot load libICU resource bundle: U_MISSING_RESOURCE_ERROR
57+
]]>
58+
</screen>
4959
</refsect1>
5060

5161
<refsect1 role="seealso">

0 commit comments

Comments
 (0)