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

[email protected] (Yoshinari Takaoka)
Newsgroups php.doc.ja
Message-ID <[email protected]>
mumumu                                   Sun, 29 Nov 2020 00:39:12 +0000

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

Log:
Function trailing commas

* Trailing commas in function parameter list.
* Trailing commas in use clause.
* Minor language change along the way.

Closes GH-241.

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

Modified: phpdoc/ja/trunk/language/functions.xml
===================================================================
--- phpdoc/ja/trunk/language/functions.xml	2020-11-28 23:40:48 UTC (rev 351739)
+++ phpdoc/ja/trunk/language/functions.xml	2020-11-29 00:39:12 UTC (rev 351740)
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <!-- $Revision$ -->
-<!-- EN-Revision: 351365 Maintainer: takagi Status: ready -->
+<!-- EN-Revision: 351733 Maintainer: takagi Status: ready -->
 <!-- CREDITS: hirokawa,mumumu -->
  <chapter xml:id="language.functions" xmlns="http://docbook.org/ns/docbook">
   <title>関数</title>
@@ -205,7 +205,31 @@
      </programlisting>
     </example>
    </para>
-
+   <para>
+    PHP 8.0.0 以降では、引数リストの最後にカンマを付けることができます。
+    このカンマは無視されます。
+    これは、引数リストや変数名が長かったりした場合に、
+    引数を縦に並べるのに便利です。
+   </para>
+   <example>
+    <title>関数の引数リストの最後にカンマを付ける</title>
+    <programlisting role="php">
+<![CDATA[
+<?php
+function takes_many_args(
+    $first_arg,
+    $second_arg,
+    $a_very_long_argument_name,
+    $arg_with_default = 5,
+    $again = 'a default string', // この最後のカンマは、8.0.0 より前では許されません。
+)
+{
+    // ...
+}
+?>
+]]>
+    </programlisting>
+   </example>
    <sect2 xml:id="functions.arguments.by-reference">
     <title>引数の参照渡し</title>

@@ -958,6 +982,10 @@
     </screen>
    </example>

+   <para>
+    PHP 8.0.0 以降では、親のスコープを継承した変数の一覧の最後にカンマを付けられるようになりました。
+    このカンマは無視されます。
+   </para>
    <simpara>
     親のスコープからの変数の引き継ぎは、グローバル変数を使うのとは
     <emphasis>異なります</emphasis>。グローバル変数は、
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.