svn: /phpdoc/zh/trunk/language/ functions.xml

[email protected] (Dai Jie)
Newsgroups php.doc.zh
Message-ID <[email protected]>
daijie                                   Sat, 13 Apr 2019 17:51:01 +0000

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

Log:
Translate Function Return type declarations to Chinese.

--
Provided by anonymous 97200 ([email protected])

Changed paths:
    U   phpdoc/zh/trunk/language/functions.xml

Modified: phpdoc/zh/trunk/language/functions.xml
===================================================================
--- phpdoc/zh/trunk/language/functions.xml	2019-04-13 17:50:38 UTC (rev 347223)
+++ phpdoc/zh/trunk/language/functions.xml	2019-04-13 17:51:01 UTC (rev 347224)
@@ -949,31 +949,24 @@
    </sect2>

    <sect2 xml:id="functions.returning-values.type-declaration">
-   <title>Return type declarations</title>
+   <title>返回值类型声明</title>

    <para>
-    PHP 7 adds support for return type declarations. Similarly to
-    <link linkend="functions.arguments.type-declaration">argument type declarations</link>,
-    return type declarations specify the type of the value that will be
-    returned from a function. The same
-    <link linkend="functions.arguments.type-declaration.types">types</link>
-    are available for return type declarations as are available for argument
-    type declarations.
+    PHP 7 增加了对返回值类型声明的支持。 就如
+    <link linkend="functions.arguments.type-declaration">类型声明</link>一样,
+    返回值类型声明将指定该函数返回值的类型。同样,返回值类型声明也与
+    <link linkend="functions.arguments.type-declaration.types">有效类型</link>
+    中可用的参数类型声明一致。
    </para>

    <para>
-    <link linkend="functions.arguments.type-declaration.strict">Strict typing</link>
-    also has an effect on return type declarations. In the default weak mode,
-    returned values will be coerced to the correct type if they are not
-    already of that type. In strong mode, the returned value must be of the
-    correct type, otherwise a <classname>TypeError</classname> will be thrown.
+    <link linkend="functions.arguments.type-declaration.strict">严格类型</link>
+    也会影响返回值类型声明。在默认的弱模式中,如果返回值与返回值的类型不一致,则会被强制转换为返回值声明的类型。在强模式中,返回值的类型必须正确,否则将会抛出一个<classname>TypeError</classname>异常.
    </para>

    <note>
     <para>
-     When overriding a parent method, the child's method must match any return
-     type declaration on the parent. If the parent doesn't define a return
-     type, then the child method may do so.
+     当覆盖一个父类方法时,子类方法的返回值类型声明必须与父类一致。如果父类方法没有定义返回类型,那么子类方法可以定义任意的返回值类型声明。
     </para>
    </note>

@@ -981,7 +974,7 @@
     &reftitle.examples;

     <example>
-     <title>Basic return type declaration</title>
+     <title>基础返回值类型声明</title>
      <programlisting role="php">
 <![CDATA[
 <?php
@@ -1003,7 +996,7 @@
      </example>

      <example>
-      <title>Strict mode in action</title>
+      <title>严格模式下执行</title>
       <programlisting role="php">
 <![CDATA[
 <?php
@@ -1033,7 +1026,7 @@
      </example>

      <example>
-      <title>Returning an object</title>
+      <title>返回一个对象</title>
       <programlisting role="php">
 <![CDATA[
 <?php
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.