svn: /phpdoc/ja/trunk/language/ exceptions.xml

From: Date: Thu, 26 Nov 2020 17:06:10 +0000
Subject: svn: /phpdoc/ja/trunk/language/ exceptions.xml
Groups: php.doc.ja 
Request: Send a blank email to doc-ja+get-5840@lists.php.net to get a copy of this message
mumumu Thu, 26 Nov 2020 17:06:10 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=351674 Log: Exception updates * Empty catch statements * Throw as an expression * Various other cleanup while I was there to remove comments I also deleted a crapload of comments. It's so satisfying. Closes GH-238. Changed paths: U phpdoc/ja/trunk/language/exceptions.xml Modified: phpdoc/ja/trunk/language/exceptions.xml =================================================================== --- phpdoc/ja/trunk/language/exceptions.xml 2020-11-26 16:09:55 UTC (rev 351673) +++ phpdoc/ja/trunk/language/exceptions.xml 2020-11-26 17:06:10 UTC (rev 351674) @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> <!-- $Revision$ --> -<!-- EN-Revision: 351652 Maintainer: hirokawa Status: working --> +<!-- EN-Revision: 351652 Maintainer: hirokawa Status: ready --> <!-- CREDITS: takagi,mumumu --> <chapter xml:id="language.exceptions" xmlns="http://docbook.org/ns/docbook"> @@ -193,14 +193,15 @@ 各 &try; ブロックには、対応する &catch; ブロックあるいは &finally; ブロックが存在する必要があります。 </para> - <!-- to be translated --> <para> - If an exception is thrown and its current function scope has no &catch; - block, the exception will "bubble up" the call stack to the calling - function until it finds a matching &catch; block. All &finally; blocks it encounters - along the way will be executed. If the call stack is unwound all the way to the - global scope without encountering a matching &catch; block, the program will - terminate with a fatal error unless a global exception handler has been set. + 例外がスローされ、現在の関数スコープに &catch; ブロックがなかった場合、 + その例外は、マッチする &catch; + ブロックが見つかるまで関数のコールスタックを "遡って" いきます。 + その途中で見つかった全ての &finally; ブロックが実行されます。 + グローバルスコープに遡るまで全てのコールスタックを探しても、 + マッチする &catch; ブロックが見つからない場合は、 + グローバルな例外ハンドラが設定されていない限り Fatal Error となり、 + プログラムが終了します。 </para> <para> スローされるオブジェクトは、<classname>Exception</classname> クラスあるいは @@ -208,10 +209,11 @@ それ以外のオブジェクトをスローしようとすると PHP の Fatal Error が発生します。 </para> - <!-- to be translated --> <para> - As of PHP 8.0.0, the &throw; keyword is an expression and may be used in any expression - context. In prior versions it was a statement and was required to be on its own line. + PHP 8.0.0 以降では、&throw; キーワードは式として扱えるようになり、 + 様々なコンテクストで使えるようになりました。 + これより前のバージョンでは、&throw; は文であり、 + それが現れる行でだけでしか使えませんでした。 </para> </simplesect> @@ -218,14 +220,13 @@ <simplesect xml:id="language.exceptions.catch"> <title><literal>catch</literal></title> - <!-- to be translated --> <para> - A &catch; block defines how to respond to a thrown exception. A &catch; - block defines one or more types of exception or error it can handle, and - optionally a variable to which to assign the exception. (The variable was - required prior to PHP 8.0.0.) The first &catch; block a thrown exception - or error encounters that matches the type of the thrown object will handle - the object. + &catch; ブロックは、スローされた例外にどのように反応するかを定義します。 + &catch; ブロックは、扱えるひとつ以上の例外またはエラー型を定義します。 + そして、オプションで例外を代入できる変数も定義できます。 + (PHP 8.0.0 より前のバージョンでは、この変数定義は必須です) + スローされた例外またはエラーにマッチする最初の &catch; + ブロックが、そのオブジェクトを処理します。 </para> <para> さまざまな型の例外を捕捉するために @@ -235,8 +236,7 @@ ブロック内は処理されず、それ以降から処理が続けられます。 &catch; ブロックの中から例外を &throw; する (あるいは &throw; しなおす) こともできます。 - <!-- to be translated --> - If not, execution will continue after the &catch; block that was triggered. + &throw; し直さない場合、その &catch; ブロックの後から処理が続けられます。 </para> <para> 例外が投げられた場合、その命令に続くコードは実行されず、 @@ -252,11 +252,10 @@ パイプ文字 (<literal>|</literal>) を使って指定できるようになりました。 これは、異なるクラス改装からの例外を同時に扱う必要がある場合に有用です。 </para> - <!-- to be translted --> <para> - As of PHP 8.0.0, the variable name for a caught exception is optional. - If not specified, the &catch; block will still execute but will not - have access to the thrown object. + PHP 8.0.0 以降では、キャッチされた例外に対応する変数はオプションになりました。 + 指定されない場合、&catch; ブロックは実行されるものの、 + 投げられたオブジェクトへアクセスすることは出来ません。 </para> <para> &finally; ブロックと &return; 文の間には注意すべき相互作用があります。 @@ -280,13 +279,14 @@ </simplesect> <simplesect xml:id="language.exceptions.exception-handler"> - <title><literal>Global exception handler</literal></title> + <title><literal>グローバルな例外ハンドラ</literal></title> <para> - If an exception is allowed to bubble up to the global scope, it may be caught - by a global exception handler if set. The <function>set_exception_handler</function> - function can set a function that will be called in place of a &catch; block if no - other block is invoked. The effect is essentially the same as if the entire program - were wrapped in a &try;-&catch; block with that function as the &catch;. + 例外がグローバルスコープにまで遡った場合、 + 設定されていれば、グローバルな例外ハンドラがそれをキャッチすることができます。 + 他の &catch; ブロックが呼び出されなかった場合に、 + &catch; の代わりに呼び出される関数を + <function>set_exception_handler</function> 関数で設定できます。 + その効果は、プログラム全体を &try;-&catch; ブロックで囲むことと同じです。 </para> </simplesect> @@ -503,10 +503,9 @@ ]]> </screen> </example> - <!-- to be translated --> <example> - <title>Omitting the caught variable</title> - <para>Only permitted in PHP 8.0.0 and later.</para> + <title>キャッチする時に変数を省略する</title> + <para>PHP 8.0.0 以降でのみ許されます</para> <programlisting role="php"> <![CDATA[ <?php @@ -527,8 +526,8 @@ </programlisting> </example> <example> - <title>Throw as an expression</title> - <para>Only permitted in PHP 8.0.0 and later.</para> + <title>throw を 式として扱う</title> + <para>PHP 8.0.0 以降でのみ許されます</para> <programlisting role="php"> <![CDATA[ <?php

« previous php.doc.ja (#5840) next »