svn: /phpdoc/zh/trunk/appendices/migration80/ new-features.xml

[email protected] (Dai Jie) Fri, 27 Nov 2020 07:57:41 +0000
Newsgroups php.doc.zh
Message-ID <[email protected]>
daijie                                   Fri, 27 Nov 2020 07:57:41 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=351697

Log:
Sync with en

Changed paths:
    U   phpdoc/zh/trunk/appendices/migration80/new-features.xml

Modified: phpdoc/zh/trunk/appendices/migration80/new-features.xml
===================================================================
--- phpdoc/zh/trunk/appendices/migration80/new-features.xml	2020-11-27 07:15:13 UTC (rev 351696)
+++ phpdoc/zh/trunk/appendices/migration80/new-features.xml	2020-11-27 07:57:41 UTC (rev 351697)
@@ -30,11 +30,10 @@
   </sect3>

   <sect3 xml:id="migration80.new-features.core.property-promotion">
-   <title>Constructor Property Promotion</title>
+   <title>构造器属性提升(Constructor Property Promotion)</title>

    <para>
-    Support for constructor property promotion (declaring properties in the constructor signature)
-    has been added.
+    新增构造器属性提升功能(在构造函数中声明类的属性)。
     <!-- RFC: https://wiki.php.net/rfc/constructor_promotion -->
    </para>
   </sect3>
@@ -104,7 +103,7 @@
     </listitem>
     <listitem>
      <para>
-      <type>static</type> (as in "late static binding") can now be used as a return type:
+      <type>static</type> ("后期静态绑定"中) 可以作为返回类型:
      </para>
      <para>
       <programlisting role="php">
@@ -129,36 +128,36 @@
     </listitem>
     <listitem>
      <para>
-      &new; and &instanceof; can now be used with arbitrary expressions,
-      using <code>new (expression)(...$args)</code> and <code>$obj instanceof (expression)</code>.
+      &new;、&instanceof; 可用于任何表达式,
+      用法为 <code>new (expression)(...$args)</code> 和 <code>$obj instanceof (expression)</code>。
       <!-- RFC: https://wiki.php.net/rfc/variable_syntax_tweaks -->
      </para>
     </listitem>
     <listitem>
      <para>
-      Some consistency fixes to variable syntax have been applied, for example writing
-      <code>Foo::BAR::$baz</code> is now allowed.
+      添加对一些变量语法一致性的修复,例如现在能够编写
+      <code>Foo::BAR::$baz</code>。
       <!-- RFC: https://wiki.php.net/rfc/variable_syntax_tweaks -->
      </para>
     </listitem>
     <listitem>
      <para>
-      Added <interfacename>Stringable</interfacename> interface, which is automatically implemented if
-      a class defines a <link linkend="object.tostring">__toString()</link> method.
+      添加 <interfacename>Stringable</interfacename> interface,
+      当一个类定义 <link linkend="object.tostring">__toString()</link> 方法后会自动实现该接口。
       <!-- RFC: https://wiki.php.net/rfc/stringable -->
      </para>
     </listitem>
     <listitem>
      <para>
-      Traits can now define abstract private methods.
-      Such methods must be implemented by the class using the trait.
+      Trait 可以定义私有抽象方法(abstract private method)。
+      类必须实现 trait 定义的该方法。
       <!-- RFC: https://wiki.php.net/rfc/abstract_trait_method_validation -->
      </para>
     </listitem>
     <listitem>
      <para>
-      <literal>throw</literal> can now be used as an expression.
-      That allows usages like:
+      可作为表达式使用 <literal>throw</literal>。
+      使得可以编写以下用法:
       <programlisting role="php">
 <![CDATA[
 <?php
@@ -171,13 +170,13 @@
     </listitem>
     <listitem>
      <para>
-      An optional trailing comma is now allowed in parameter lists.
+      参数列表中的末尾逗号为可选。
       <programlisting role="php">
 <![CDATA[
 <?php
 function functionWithLongSignature(
     Type1 $parameter1,
-    Type2 $parameter2, // <-- This comma is now allowed.
+    Type2 $parameter2, // <-- 这个逗号也被允许了
 ) {
 }
 ]]>
@@ -187,14 +186,13 @@
     </listitem>
     <listitem>
      <para>
-      It is now possible to write <code>catch (Exception)</code> to catch an exception without storing
-      it in a variable.
+     现在允许 <code>catch (Exception)</code> 一个 exception 而无需捕获到变量中。
       <!-- RFC: https://wiki.php.net/rfc/non-capturing_catches -->
      </para>
     </listitem>
     <listitem>
      <para>
-      Support for <type>mixed</type> type has been added.
+      支持 <type>mixed</type> 类型。
       <!-- RFC: https://wiki.php.net/rfc/mixed_type_v2 -->
      </para>
     </listitem>