svn: /phpdoc/kr/trunk/ language/functions.xml language/oop5.xml reference/info/ini.xml

[email protected] (Yu Ilho) Sat, 05 Sep 2015 14:05:56 +0000
Newsgroups php.doc.kr
Message-ID <[email protected]>
acidd15                                  Sat, 05 Sep 2015 14:05:56 +0000

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

Log:
fix the error of manual build

Changed paths:
    U   phpdoc/kr/trunk/language/functions.xml
    U   phpdoc/kr/trunk/language/oop5.xml
    U   phpdoc/kr/trunk/reference/info/ini.xml
svn-diffs-337756.txt (text/x-diff, 21 KB)
Modified: phpdoc/kr/trunk/language/functions.xml
===================================================================
--- phpdoc/kr/trunk/language/functions.xml	2015-09-04 21:04:10 UTC (rev 337755)
+++ phpdoc/kr/trunk/language/functions.xml	2015-09-05 14:05:56 UTC (rev 337756)
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- EN-Revision: 333678 Maintainer: progcom Status: ready -->
-<!-- CREDITS: fuzzy74 -->
+<!-- EN-Revision: 337738 Maintainer: progcom Status: ready -->
+<!-- CREDITS: fuzzy74,acidd15 -->
  <chapter xml:id="language.functions" xmlns="http://docbook.org/ns/docbook">
   <title>함수</title>

@@ -135,9 +135,7 @@
    </simpara>

    <para>
-    PHP에서 재귀 함수 호출을 할 수 있습니다. 그러나 100-200 재귀 레벨을
-    넘어서는 함수/메소드 호출을 피하십시오. 스택 한계에 도달하여 현재
-    스크립트가 중단될 수 있습니다.
+    PHP에서 재귀 함수 호출을 할 수 있습니다.
     <example>
      <title>재귀 함수</title>
      <programlisting role="php">
@@ -154,6 +152,14 @@
 ]]>
      </programlisting>
     </example>
+   <note>
+    <simpara>
+     100-200 재귀 레벨을
+     어서는 함수/메소드 호출을 피하십시오. 스택 한계에 도달하여 현재
+     크립트가 중단될 수 있습니다.
+     특히, 무한재귀호출은 프로그래밍 오류로 간주합니다.
+    </simpara>
+   </note>
    </para>

   </sect1>
@@ -165,6 +171,7 @@
     함수 인수를 통해서 함수에 정보를 넘겨줄수 있다. 이런 함수 인수는
     콤마(,)로 구별되는 표현 목록이다.
    </simpara>
+
    <para>
     PHP는 값에 의한 인수 전달(passing by value) (기본값),
     <link linkend="functions.arguments.by-reference">참조에 의한 전달</link>,
@@ -189,7 +196,6 @@
      </programlisting>
     </example>
    </para>
-
    <sect2 xml:id="functions.arguments.by-reference">
     <title>참조에 의한 인수 전달하기</title>

@@ -220,9 +226,7 @@
       </programlisting>
      </example>
     </para>
-
    </sect2>
-
    <sect2 xml:id="functions.arguments.default">
     <title>기본 인수 값</title>

@@ -343,9 +347,340 @@
       PHP 5부터, 기본값을 참조로 넘길 수 있습니다.
      </simpara>
     </note>
+</sect2>

+   <sect2 xml:id="functions.arguments.type-declaration">
+    <title>Type declarations</title>
+
+    <note>
+     <para>
+      Type declarations were also known as type hints in PHP 5.
+     </para>
+    </note>
+
+    <para>
+     Type declarations allow functions to require that parameters are of a
+     certain type at call time. If the given value is of the incorrect type,
+     then an error is generated: in PHP 5, this will be a recoverable fatal
+     error, while PHP 7 will throw a <classname>TypeError</classname>
+     exception.
+    </para>
+
+    <para>
+     To specify a type declaration, the type name should be added before the
+     parameter name. The declaration can be made to accept &null; values if
+     the default value of the parameter is set to &null;.
+    </para>
+
+    <sect3 xml:id="functions.arguments.type-declaration.types">
+     <title>Valid types</title>
+     <informaltable>
+      <tgroup cols="3">
+       <thead>
+        <row>
+         <entry>Type</entry>
+         <entry>Description</entry>
+         <entry>Minimum PHP version</entry>
+        </row>
+       </thead>
+       <tbody>
+        <row>
+         <entry>Class/interface name</entry>
+         <entry>
+          The parameter must be an &instanceof; the given class or interface
+          name.
+         </entry>
+         <entry>PHP 5.0.0</entry>
+        </row>
+        <row>
+         <entry><literal>self</literal></entry>
+         <entry>
+          The parameter must be an &instanceof; the same class as the one the
+          method is defined on. This can only be used on class and instance
+          methods.
+         </entry>
+         <entry>PHP 5.0.0</entry>
+        </row>
+        <row>
+         <entry><type>array</type></entry>
+         <entry>
+          The parameter must be an <type>array</type>.
+         </entry>
+         <entry>PHP 5.1.0</entry>
+        </row>
+        <row>
+         <entry><type>callable</type></entry>
+         <entry>
+          The parameter must be a valid <type>callable</type>.
+         </entry>
+         <entry>PHP 5.4.0</entry>
+        </row>
+        <row>
+         <entry><type>bool</type></entry>
+         <entry>
+          The parameter must be a <type>boolean</type> value.
+         </entry>
+         <entry>PHP 7.0.0</entry>
+        </row>
+        <row>
+         <entry><type>float</type></entry>
+         <entry>
+          The parameter must be a <type>float</type>ing point number.
+         </entry>
+         <entry>PHP 7.0.0</entry>
+        </row>
+        <row>
+         <entry><type>int</type></entry>
+         <entry>
+          The parameter must be an <type>integer</type>.
+         </entry>
+         <entry>PHP 7.0.0</entry>
+        </row>
+        <row>
+         <entry><type>string</type></entry>
+         <entry>
+          The parameter must be a <type>string</type>.
+         </entry>
+         <entry>PHP 7.0.0</entry>
+        </row>
+       </tbody>
+      </tgroup>
+     </informaltable>
+    </sect3>
+
+    <sect3 xml:id="functions.arguments.type-declaration.examples">
+     &reftitle.examples;
+     <example>
+      <title>Basic class type declaration</title>
+      <programlisting role="php">
+<![CDATA[
+<?php
+class C {}
+class D extends C {}
+
+// This doesn't extend C.
+class E {}
+
+function f(C $c) {
+    echo get_class($c)."\n";
+}
+
+f(new C);
+f(new D);
+f(new E);
+?>
+]]>
+      </programlisting>
+      &example.outputs;
+      <screen>
+<![CDATA[
+C
+D
+
+Fatal error: Uncaught TypeError: Argument 1 passed to f() must be an instance of C, instance of E given, called in - on line 14 and defined in -:8
+Stack trace:
+#0 -(14): f(Object(E))
+#1 {main}
+  thrown in - on line 8
+]]>
+      </screen>
+     </example>
+
+     <example>
+      <title>Basic interface type declaration</title>
+      <programlisting role="php">
+<![CDATA[
+<?php
+interface I { public function f(); }
+class C implements I { public function f() {} }
+
+// This doesn't implement I.
+class E {}
+
+function f(I $i) {
+    echo get_class($i)."\n";
+}
+
+f(new C);
+f(new E);
+?>
+]]>
+      </programlisting>
+      &example.outputs;
+      <screen>
+<![CDATA[
+C
+
+Fatal error: Uncaught TypeError: Argument 1 passed to f() must implement interface I, instance of E given, called in - on line 13 and defined in -:8
+Stack trace:
+#0 -(13): f(Object(E))
+#1 {main}
+  thrown in - on line 8
+]]>
+      </screen>
+     </example>
+
+     <example>
+      <title>Nullable type declaration</title>
+      <programlisting role="php">
+<![CDATA[
+<?php
+class C {}
+
+function f(C $c = null) {
+    var_dump($c);
+}
+
+f(new C);
+f(null);
+?>
+]]>
+      </programlisting>
+      &example.outputs;
+      <screen>
+<![CDATA[
+object(C)#1 (0) {
+}
+NULL
+]]>
+      </screen>
+     </example>
+    </sect3>
+
+    <sect3 xml:id="functions.arguments.type-declaration.strict">
+     <title>Strict typing</title>
+
+     <para>
+      By default, PHP will coerce values of the wrong type into the expected
+      scalar type if possible. For example, a function that is given an
+      <type>integer</type> for a parameter that expects a <type>string</type>
+      will get a variable of type <type>string</type>.
+     </para>
+
+     <para>
+      It is possible to enable strict mode on a per-file basis. In strict
+      mode, only a variable of exact type of the type declaration will be
+      accepted, or a <classname>TypeError</classname> will be thrown. The
+      only exception to this rule is that an <type>integer</type> may be given
+      to a function expecting a <type>float</type>.
+     </para>
+
+     <para>
+      To enable strict mode, the &declare; statement is used with the
+      <literal>strict_types</literal> declaration:
+     </para>
+
+     <caution>
+      <para>
+       Enabling strict mode will also affect
+       <link linkend="functions.returning-values.type-declaration">return type declarations</link>.
+      </para>
+     </caution>
+
+     <note>
+      <para>
+       Strict typing applies to function calls made from
+       <emphasis>within</emphasis> the file with strict typing enabled, not to
+       the functions declared within that file. If a file without strict
+       typing enabled makes a call to a function that was defined in a file
+       with strict typing, the caller's preference (weak typing) will be
+       respected, and the value will be coerced.
+      </para>
+     </note>
+
+     <note>
+      <para>
+       Strict typing is only defined for scalar type declarations, and as
+       such, requires PHP 7.0.0 or later, as scalar type declarations were
+       added in that version.
+      </para>
+     </note>
+
+     <example>
+      <title>Strict typing</title>
+      <programlisting role="php">
+<![CDATA[
+<?php
+declare(strict_types=1);
+
+function sum(int $a, int $b) {
+    return $a + $b;
+}
+
+var_dump(sum(1, 2));
+var_dump(sum(1.5, 2.5));
+?>
+]]>
+      </programlisting>
+      &example.outputs;
+      <screen>
+<![CDATA[
+int(3)
+
+Fatal error: Uncaught TypeError: Argument 1 passed to sum() must be of the type integer, float given, called in - on line 9 and defined in -:4
+Stack trace:
+#0 -(9): sum(1.5, 2.5)
+#1 {main}
+  thrown in - on line 4
+]]>
+      </screen>
+     </example>
+
+     <example>
+      <title>Weak typing</title>
+      <programlisting role="php">
+<![CDATA[
+<?php
+function sum(int $a, int $b) {
+    return $a + $b;
+}
+
+var_dump(sum(1, 2));
+
+// These will be coerced to integers: note the output below!
+var_dump(sum(1.5, 2.5));
+?>
+]]>
+      </programlisting>
+      &example.outputs;
+      <screen>
+<![CDATA[
+int(3)
+int(3)
+]]>
+      </screen>
+     </example>
+
+     <example>
+      <title>Catching <classname>TypeError</classname></title>
+      <programlisting role="php">
+<![CDATA[
+<?php
+declare(strict_types=1);
+
+function sum(int $a, int $b) {
+    return $a + $b;
+}
+
+try {
+    var_dump(sum(1, 2));
+    var_dump(sum(1.5, 2.5));
+} catch (TypeError $e) {
+    echo 'Error: '.$e->getMessage();
+}
+?>
+]]>
+      </programlisting>
+      &example.outputs;
+      <screen>
+<![CDATA[
+int(3)
+Error: Argument 1 passed to sum() must be of the type integer, float given, called in - on line 10
+]]>
+      </screen>
+     </example>
+    </sect3>
    </sect2>
-
    <sect2 xml:id="functions.variable-arg-list">
     <title>가변 길이 인수 목록</title>

@@ -513,7 +848,6 @@
     </sect3>

    </sect2>
-
   </sect1>

   <sect1 xml:id="functions.returning-values">
@@ -525,12 +859,16 @@
     현재 함수를 호출한 코드줄로 제어를 되돌린다.
     자세한 정보는 <function>return</function>섹션을 참고할것.
    </para>
+
    <note>
     <para>
      If the <function>return</function> is omitted the value &null; will be
      returned.
     </para>
    </note>
+
+   <sect2>
+    <title>Use of return</title>
    <para>
     <example>
      <title><function>return</function>의 사용예</title>
@@ -593,6 +931,117 @@
     참조에 관한 자세한 정보는, <link linkend="language.references">참조 표현</link>섹션을
     참고.
    </simpara>
+</sect2>
+
+  <sect2 xml:id="functions.returning-values.type-declaration">
+   <title>Return type declarations</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.
+   </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.
+   </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>
+
+   <sect3 xml:id="functions.returning-values.type-declaration.examples">
+    &reftitle.examples;
+
+    <example>
+     <title>Basic return type declaration</title>
+     <programlisting role="php">
+<![CDATA[
+<?php
+function sum($a, $b): float {
+    return $a + $b;
+}
+
+// Note that a float will be returned.
+var_dump(sum(1, 2));
+?>
+]]>
+      </programlisting>
+      &example.outputs;
+      <screen>
+<![CDATA[
+float(3)
+]]>
+      </screen>
+     </example>
+
+     <example>
+      <title>Strict mode in action</title>
+      <programlisting role="php">
+<![CDATA[
+<?php
+declare(strict_types=1);
+
+function sum($a, $b): int {
+    return $a + $b;
+}
+
+var_dump(sum(1, 2));
+var_dump(sum(1, 2.5));
+?>
+]]>
+      </programlisting>
+      &example.outputs;
+      <screen>
+<![CDATA[
+int(3)
+
+Fatal error: Uncaught TypeError: Return value of sum() must be of the type integer, float returned in - on line 5 in -:5
+Stack trace:
+#0 -(9): sum(1, 2.5)
+#1 {main}
+  thrown in - on line 5
+]]>
+      </screen>
+     </example>
+
+     <example>
+      <title>Returning an object</title>
+      <programlisting role="php">
+<![CDATA[
+<?php
+class C {}
+
+function getC(): C {
+    return new C;
+}
+
+var_dump(getC());
+?>
+]]>
+      </programlisting>
+      &example.outputs;
+      <screen>
+<![CDATA[
+object(C)#1 (0) {
+}
+]]>
+      </screen>
+     </example>
+    </sect3>
+   </sect2>
   </sect1>

   <sect1 xml:id="functions.variable-functions">
@@ -700,12 +1149,71 @@
      </programlisting>
     </example>
    </para>
+   <para>
+     As of PHP 5.4.0, you can call any <type>callable</type> stored in a variable.
+    <example>
+     <title>Complex callables</title>
+     <programlisting role="php">
+<![CDATA[
+class Foo
+{
+    static function bar()
+    {
+        echo "bar\n";
+    }
+    function baz()
+    {
+        echo "baz\n";
+    }
+}
+
+$func = array("Foo", "bar");
+$func(); // prints "bar"
+$f = array(new Foo, "baz");
+$func(); // prints "baz"
+$f = "Foo::bar";
+$func(); // prints "bar" as of PHP 7.0.0; prior, it raised a fatal error
+]]>
+     </programlisting>
+    </example>
+   </para>

    <para>
-    또 <function>call_user_func</function>,
+    또 <function>is_callable</function>,
+    <function>call_user_func</function>,
     <link linkend="language.variables.variable">variable variables</link>,
     <function>function_exists</function>섹션을 참고
    </para>
+
+   <sect2 role="changelog">
+    &reftitle.changelog;
+    <para>
+     <informaltable>
+      <tgroup cols="2">
+       <thead>
+        <row>
+         <entry>&Version;</entry>
+         <entry>&Description;</entry>
+        </row>
+       </thead>
+       <tbody>
+        <row>
+         <entry>7.0.0</entry>
+         <entry>
+          'ClassName::methodName' is allowed as variable function.
+         </entry>
+        </row>
+        <row>
+         <entry>5.4.0</entry>
+         <entry>
+          Arrays, which are valid callables, are allowed as variable functions.
+         </entry>
+        </row>
+       </tbody>
+      </tgroup>
+     </informaltable>
+    </para>
+   </sect2>
   </sect1>

   <sect1 xml:id="functions.internal">
@@ -807,7 +1315,70 @@

    <simpara>
     Closures may also inherit variables from the parent scope.
-    Any such variables must be passed to the <literal>use</literal> language construct.
+    Any such variables must be passed to the <literal>use</literal> language construct.
+   </simpara>
+
+   <example>
+    <title>Inheriting variables from the parent scope</title>
+    <programlisting role="php">
+<![CDATA[
+<?php
+$message = 'hello';
+
+// No "use"
+$example = function () {
+    var_dump($message);
+};
+echo $example();
+
+// Inherit $message
+$example = function () use ($message) {
+    var_dump($message);
+};
+echo $example();
+
+// Inherited variable's value is from when the function
+// is defined, not when called
+$message = 'world';
+echo $example();
+
+// Reset message
+$message = 'hello';
+
+// Inherit by-reference
+$example = function () use (&$message) {
+    var_dump($message);
+};
+echo $example();
+
+// The changed value in the parent scope
+// is reflected inside the function call
+$message = 'world';
+echo $example();
+
+// Closures can also accept regular arguments
+$example = function ($arg) use ($message) {
+    var_dump($arg . ' ' . $message);
+};
+$example("hello");
+?>
+]]>
+    </programlisting>
+    &example.outputs.similar;
+    <screen>
+<![CDATA[
+Notice: Undefined variable: message in /example.php on line 6
+NULL
+string(5) "hello"
+string(5) "hello"
+string(5) "hello"
+string(5) "world"
+string(11) "hello world"
+]]>
+    </screen>
+   </example>
+
+   <simpara>
     Inheriting variables from the parent scope is <emphasis>not</emphasis>
     the same as using global variables.
     Global variables exist in the global scope, which is the same no

Modified: phpdoc/kr/trunk/language/oop5.xml
===================================================================
--- phpdoc/kr/trunk/language/oop5.xml	2015-09-04 21:04:10 UTC (rev 337755)
+++ phpdoc/kr/trunk/language/oop5.xml	2015-09-05 14:05:56 UTC (rev 337756)
@@ -1,5 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
-<!-- EN-Revision: 325666 Maintainer: progcom Status: ready -->
+<!-- EN-Revision: 337370 Maintainer: progcom Status: ready -->
+<!-- CREDITS: acidd15 -->
  <chapter xml:id="language.oop5" xmlns="http://docbook.org/ns/docbook">
   <title>클래스와 객체</title>

@@ -41,6 +42,7 @@
   &language.oop5.abstract;
   &language.oop5.interfaces;
   &language.oop5.traits;
+  &language.oop5.anonymous;
   &language.oop5.overloading;
   &language.oop5.iterations;
   &language.oop5.magic;

Modified: phpdoc/kr/trunk/reference/info/ini.xml
===================================================================
--- phpdoc/kr/trunk/reference/info/ini.xml	2015-09-04 21:04:10 UTC (rev 337755)
+++ phpdoc/kr/trunk/reference/info/ini.xml	2015-09-05 14:05:56 UTC (rev 337756)
@@ -1,5 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
-<!-- EN-Revision: 324588 Maintainer: progcom Status: ready -->
+<!-- EN-Revision: 337554 Maintainer: progcom Status: ready -->
+<!-- CREDITS: acidd15 -->
 <section xml:id="info.configuration" xmlns="http://docbook.org/ns/docbook">
  &reftitle.runtime;
  &extension.runtime;
@@ -47,6 +48,12 @@
      <entry></entry>
     </row>
     <row>
+     <entry><link linkend="ini.assert.exception">assert.exception</link></entry>
+     <entry>"0"</entry>
+     <entry>PHP_INI_ALL</entry>
+     <entry>Available since PHP 7.0.0.</entry>
+    </row>
+    <row>
      <entry><link linkend="ini.enable-dl">enable_dl</link></entry>
      <entry>"1"</entry>
      <entry>PHP_INI_SYSTEM</entry>
@@ -166,6 +173,19 @@
      </para>
     </listitem>
    </varlistentry>
+
+   <varlistentry xml:id="ini.assert.exception">
+    <term>
+     <parameter>assert.exception</parameter>
+     <type>boolean</type>
+    </term>
+    <listitem>
+     <para>
+      Issue an <classname>AssertionError</classname> exception for the failed
+      assertion.
+     </para>
+    </listitem>
+   </varlistentry>

    <varlistentry xml:id="ini.enable-dl">
     <term>
@@ -228,8 +248,7 @@
     <listitem>
      <para>
       POST, GET, 파일 업로드 등의 입력 데이터 처리에 허용하는 최대 시간을
-      설정합니다. 이 시간은 서버에 모든 데이터가 도착한 시간부터 스크립트
-      실행을 시작하는 사이로 측정됩니다.
+      설정합니다. 타이밍은 PHP가 호출되는 순간부터 시작해서 실행이 시작될때 끝납니다.
      </para>
     </listitem>
    </varlistentry>
@@ -242,7 +261,7 @@
     <listitem>
      <para>
       <link linkend="language.variables.external">입력 변수</link>(즉,
-      <varname>$_GET</varname>, <varname>$_POST</varname>..)의
+      <varname>$_GET</varname>, <varname>$_POST</varname>.)의
       최대 중첩 깊이를 설정합니다.
      </para>
     </listitem>
@@ -256,11 +275,10 @@
     <listitem>
      <para>
       받아들일 수 있는 <link linkend="language.variables.external">입력
-      변수</link> 수입니다. hash collisions를 사용하는 denial of service
+      변수</link> 수입니다(제한은 $_GET, $_POST, $_COOKIE 수퍼글로벌 변수 각각에 적용됩니다). hash collisions를 사용하는 denial of service
      공격을 방어하기 위하여 사용합니다. 이 지시어에 지정된 수보다 많은 입력
      변수가 존재할 경우 <constant>E_WARNING</constant>이 발생하고, 요청의
-     나머지 변수는 무시됩니다. 이 제한은 다중 차원 입력 배열에 대해서는 각
-     중첩 레벨에 대하여 적용됩니다.
+     나머지 변수는 무시됩니다.
      </para>
     </listitem>
    </varlistentry>