svn: /phpdoc/ja/trunk/language/oop5/ traits.xml

From: Date: Fri, 20 Dec 2019 03:10:19 +0000
Subject: svn: /phpdoc/ja/trunk/language/oop5/ traits.xml
Groups: php.doc.ja 
Request: Send a blank email to doc-ja+get-5210@lists.php.net to get a copy of this message
mumumu Fri, 20 Dec 2019 03:10:19 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=348629 Log: sync with en Changed paths: U phpdoc/ja/trunk/language/oop5/traits.xml Modified: phpdoc/ja/trunk/language/oop5/traits.xml =================================================================== --- phpdoc/ja/trunk/language/oop5/traits.xml 2019-12-20 02:57:34 UTC (rev 348628) +++ phpdoc/ja/trunk/language/oop5/traits.xml 2019-12-20 03:10:19 UTC (rev 348629) @@ -1,6 +1,8 @@ <?xml version="1.0" encoding="utf-8"?> <!-- $Revision$ --> -<!-- EN-Revision: 342154 Maintainer: takagi Status: working --> +<!-- EN-Revision: 346323 Maintainer: takagi Status: ready --> +<!-- CREDITS: mumumu --> + <sect1 xml:id="language.oop5.traits" xmlns="http://docbook.org/ns/docbook"> <title>トレイト</title> <para> @@ -239,10 +241,10 @@ </example> <note> <para> - <!-- to be translated --> - Prior to PHP 7.0, defining a property in a class with the same name as in a trait - would throw an <constant>E_STRICT</constant> if the class definition was compatible - (same visibility and initial value). + PHP 7.0 より前のバージョンでは、 + トレイトに存在する名前と同じ名前をクラスのプロパティに定義すると、 + クラス定義に互換性(公開範囲と初期値が同じ)があっても、 + <constant>E_STRICT</constant> レベルの警告が発生していました。 </para> </note> </sect2> @@ -332,6 +334,13 @@ <para> トレイトでは、抽象メソッドを使ってクラスの要件を指定できます。 </para> + <caution> + <simpara> + 具象クラスでは、 + 具象メソッドを同じ名前で定義することによって、要件を満たせます。 + つまり、シグナチャは異なっていても構いません。 + </simpara> + </caution> <example xml:id="language.oop5.traits.abstract.ex1"> <title>抽象メソッドによる、要件の明示</title> <programlisting role="php"> @@ -439,12 +448,13 @@ </programlisting> </example> <para> - トレイトでプロパティを定義したときは、クラスでは同じ名前のプロパティを定義できません。 - <!-- to be translated --> - unless it is compatible (same visibility and initial value), - otherwise a fatal error is issued. - Before PHP 7.0.0, defining a property in the class with the same visibility - and initial value as in the trait, raised an E_STRICT notice. + トレイトでプロパティを定義したときは、 + クラスではそれと互換性(公開範囲と初期値が同じ)がない同じ名前のプロパティを定義できません。 + 互換性がない名前を定義すると、致命的なエラーが発生します。 + PHP 7.0.0 より前のバージョンでは、 + トレイトに存在する名前と同じ名前をクラスのプロパティに定義すると、 + クラス定義に互換性(公開範囲と初期値が同じ)があっても、 + <constant>E_STRICT</constant> レベルの警告が発生していました。 </para> <example xml:id="language.oop5.traits.properties.conflicts"> <title>衝突の解決</title>

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