Skip to content

Commit

Permalink
Update language
Browse files Browse the repository at this point in the history
  • Loading branch information
mowangjuanzi committed Jul 31, 2023
1 parent d508b7b commit fa79756
Show file tree
Hide file tree
Showing 16 changed files with 82 additions and 148 deletions.
4 changes: 2 additions & 2 deletions language/generators.xml
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ Single digit odd numbers from xrange(): 1 3 5 7 9
</note>

<sect2 xml:id="control-structures.yield">
<title><command>yield</command>关键字</title>
<title><command>yield</command> 关键字</title>

<para>
生成器函数的核心是<command>yield</command>关键字。它最简单的调用形式看起来像一个return申明,不同之处在于普通return会返回值并终止函数的执行,而yield会返回一个值给循环调用此生成器的代码并且只是暂停执行生成器函数。
Expand Down Expand Up @@ -524,7 +524,7 @@ class LineIterator implements Iterator {
<para>
不过,这也付出了灵活性的代价:
生成器是一个只能向前的迭代器,一旦开始遍历就无法后退。
意思也就是说,同样的生成器无法遍历多遍:要么再次调用生成器函数,重新生成后再遍历。
意思也就是说,同样的生成器无法遍历多次:要么再次调用生成器函数,重新生成后再遍历。
</para>

<simplesect role="seealso">
Expand Down
3 changes: 1 addition & 2 deletions language/oop5.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
<!-- $Revision$ -->
<!-- EN-Revision: a9a6224ca97531df0a4e4b9b16b59c3f2baf1b09 Maintainer: verdana Status: ready -->
<!-- CREDITS: dallas, HonestQiao -->
<!-- $Author$ -->
<chapter xml:id="language.oop5" xmlns="http://docbook.org/ns/docbook">
<title>类与对象</title>

Expand All @@ -19,7 +18,7 @@
linkend="language.oop5.cloning">对象复制</link>。
</para>
<para>
PHP 对待对象的方式与引用和句柄相同,即每个变量都持有对象的引用,而不是整个对象的拷贝。参见
PHP 对待对象的方式等同于引用或句柄,即每个变量都持有对象的引用,而不是整个对象的复制。参见
<link linkend="language.oop5.references">对象和引用</link>。
</para>
&tip.userlandnaming;
Expand Down
15 changes: 7 additions & 8 deletions language/oop5/visibility.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<!-- $Author$ -->
<!-- EN-Revision: f5e5b54129045a7d02c5285a88cea0abff8ffb6f Maintainer: lm92 Status: ready -->
<!-- CREDITS: Luffy -->
<!-- CREDITS: Luffy, mowangjuanzi -->
<sect1 xml:id="language.oop5.visibility" xmlns="http://docbook.org/ns/docbook">
<title>访问控制(可见性)</title>
<para>
Expand Down Expand Up @@ -80,7 +79,7 @@ $obj2->printHello(); // 输出 Public2、Protected2 和 Undefined
<sect2 xml:id="language.oop5.visiblity-methods">
<title>方法的访问控制</title>
<para>
类中的方法可以被定义为公有,私有或受保护。如果没有设置这些关键字,则该方法默认为公有
类中的方法可以被定义为 public、private 或 protected。如果没有设置这些关键字,则该方法默认为 public
</para>
<para>
<example>
Expand Down Expand Up @@ -179,7 +178,7 @@ $myFoo->test(); // Bar::testPrivate
<sect2 xml:id="language.oop5.visiblity-constants">
<title>常量的控制访问</title>
<para>
PHP 7.1.0 开始,类的常量可以定义为公有、私有或受保护。如果没有设置这些关键字,则该常量默认为公有
PHP 7.1.0 开始,类的常量可以定义为 public、private 或 protected。如果没有设置这些关键字,则该常量默认为 public
</para>
<para>
<example>
Expand Down Expand Up @@ -243,11 +242,11 @@ $myclass2->foo2(); // 将会输出:Public Protected,MY_PRIVATE 是私有常
<sect2 xml:id="language.oop5.visibility-other-objects">
<title>其它对象的访问控制</title>
<para>
同一个类的对象即使不是同一个实例也可以互相访问对方的私有与受保护成员
同一个类的对象即使不是同一个实例也可以互相访问对方的 private 与 protected 成员
这是由于在这些对象的内部具体实现的细节都是已知的。
</para>
<example>
<title>访问同一个对象类型的私有成员</title>
<title>访问同一个对象类型的 private 成员</title>
<programlisting role="php">
<![CDATA[
<?php
Expand All @@ -267,11 +266,11 @@ class Test
public function baz(Test $other)
{
// 我们可以改变私有属性
// 我们可以改变 private 属性
$other->foo = 'hello';
var_dump($other->foo);
// 我们也可以调用私有方法
// 我们也可以调用 private 方法
$other->bar();
}
}
Expand Down
14 changes: 4 additions & 10 deletions language/predefined/arrayaccess.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<!-- EN-Revision: 256ea6817f61ec176c4b1dab7eaf797cceed4d69 Maintainer: mowangjuanzi Status: ready -->
<!-- EN-Revision: 9eb4a46bba05da229be4c8f7a3cb64702e1a2f95 Maintainer: mowangjuanzi Status: ready -->
<phpdoc:classref xml:id="class.arrayaccess" xmlns:phpdoc="http://php.net/ns/phpdoc" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude">

<title>ArrayAccess(数组式访问)接口</title>
Expand All @@ -22,15 +22,9 @@

<!-- {{{ Synopsis -->
<classsynopsis class="interface">
<ooclass>
<classname>ArrayAccess</classname>
</ooclass>

<classsynopsisinfo>
<oointerface>
<interfacename>ArrayAccess</interfacename>
</oointerface>
</classsynopsisinfo>
<oointerface>
<interfacename>ArrayAccess</interfacename>
</oointerface>

<classsynopsisinfo role="comment">&Methods;</classsynopsisinfo>
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('class.arrayaccess')/db:refentry/db:refsect1[@role='description']/descendant::db:methodsynopsis[@role='ArrayAccess'])">
Expand Down
21 changes: 8 additions & 13 deletions language/predefined/backedenum.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- EN-Revision: 96a8379cd86b3ca4f1f5b2b94c5fb263f38050fd Maintainer: daijie Status: ready -->
<!-- EN-Revision: 9eb4a46bba05da229be4c8f7a3cb64702e1a2f95 Maintainer: daijie Status: ready -->
<!-- CREDITS: Luffy, mowangjuanzi -->
<phpdoc:classref xml:id="class.backedenum" xmlns:phpdoc="http://php.net/ns/phpdoc" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude">
<title>BackedEnum 接口</title>
Expand All @@ -24,19 +24,14 @@

<!-- {{{ Synopsis -->
<classsynopsis class="interface">
<ooclass>
<classname>BackedEnum</classname>
</ooclass>
<oointerface>
<interfacename>BackedEnum</interfacename>
</oointerface>

<classsynopsisinfo>
<oointerface>
<interfacename>BackedEnum</interfacename>
</oointerface>

<oointerface>
<interfacename>UnitEnum</interfacename>
</oointerface>
</classsynopsisinfo>
<oointerface>
<modifier>extends</modifier>
<interfacename>UnitEnum</interfacename>
</oointerface>

<classsynopsisinfo role="comment">&Methods;</classsynopsisinfo>
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('class.backedenum')/db:refentry/db:refsect1[@role='description']/descendant::db:methodsynopsis[@role='BackedEnum'])">
Expand Down
23 changes: 9 additions & 14 deletions language/predefined/iterator.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<!-- EN-Revision: 96a8379cd86b3ca4f1f5b2b94c5fb263f38050fd Maintainer: HonestQiao Status: ready -->
<!-- EN-Revision: 9eb4a46bba05da229be4c8f7a3cb64702e1a2f95 Maintainer: HonestQiao Status: ready -->
<!-- CREDITS: Luffy, mowangjuanzi -->
<phpdoc:classref xml:id="class.iterator" xmlns:phpdoc="http://php.net/ns/phpdoc" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude">

Expand All @@ -23,19 +23,14 @@

<!-- {{{ Synopsis -->
<classsynopsis class="interface">
<ooclass>
<classname>Iterator</classname>
</ooclass>

<classsynopsisinfo>
<oointerface>
<interfacename>Iterator</interfacename>
</oointerface>

<oointerface>
<interfacename>Traversable</interfacename>
</oointerface>
</classsynopsisinfo>
<oointerface>
<interfacename>Iterator</interfacename>
</oointerface>

<oointerface>
<modifier>extends</modifier>
<interfacename>Traversable</interfacename>
</oointerface>

<classsynopsisinfo role="comment">&Methods;</classsynopsisinfo>
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('class.iterator')/db:refentry/db:refsect1[@role='description']/descendant::db:methodsynopsis[@role='Iterator'])">
Expand Down
23 changes: 9 additions & 14 deletions language/predefined/iteratoraggregate.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<!-- EN-Revision: 96a8379cd86b3ca4f1f5b2b94c5fb263f38050fd Maintainer: Luffy Status: ready -->
<!-- EN-Revision: 9eb4a46bba05da229be4c8f7a3cb64702e1a2f95 Maintainer: Luffy Status: ready -->
<!-- CREDITS: mowangjuanzi -->
<phpdoc:classref xml:id="class.iteratoraggregate" xmlns:phpdoc="http://php.net/ns/phpdoc" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude">

Expand All @@ -23,19 +23,14 @@

<!-- {{{ Synopsis -->
<classsynopsis class="interface">
<ooclass>
<classname>IteratorAggregate</classname>
</ooclass>

<classsynopsisinfo>
<oointerface>
<interfacename>IteratorAggregate</interfacename>
</oointerface>

<oointerface>
<interfacename>Traversable</interfacename>
</oointerface>
</classsynopsisinfo>
<oointerface>
<interfacename>IteratorAggregate</interfacename>
</oointerface>

<oointerface>
<modifier>extends</modifier>
<interfacename>Traversable</interfacename>
</oointerface>

<classsynopsisinfo role="comment">&Methods;</classsynopsisinfo>
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('class.iteratoraggregate')/db:refentry/db:refsect1[@role='description']/descendant::db:methodsynopsis[@role='IteratorAggregate'])">
Expand Down
14 changes: 4 additions & 10 deletions language/predefined/serializable.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<!-- EN-Revision: 96a8379cd86b3ca4f1f5b2b94c5fb263f38050fd Maintainer: mowangjuanzi Status: ready -->
<!-- EN-Revision: 9eb4a46bba05da229be4c8f7a3cb64702e1a2f95 Maintainer: mowangjuanzi Status: ready -->
<phpdoc:classref xml:id="class.serializable" xmlns:phpdoc="http://php.net/ns/phpdoc" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude">

<title>Serializable 接口</title>
Expand Down Expand Up @@ -39,15 +39,9 @@

<!-- {{{ Synopsis -->
<classsynopsis class="interface">
<ooclass>
<classname>Serializable</classname>
</ooclass>

<classsynopsisinfo>
<oointerface>
<interfacename>Serializable</interfacename>
</oointerface>
</classsynopsisinfo>
<oointerface>
<interfacename>Serializable</interfacename>
</oointerface>

<classsynopsisinfo role="comment">&Methods;</classsynopsisinfo>
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('class.serializable')/db:refentry/db:refsect1[@role='description']/descendant::db:methodsynopsis[@role='Serializable'])">
Expand Down
21 changes: 8 additions & 13 deletions language/predefined/throwable.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<!-- EN-Revision: 96a8379cd86b3ca4f1f5b2b94c5fb263f38050fd Maintainer: daijie Status: ready -->
<!-- EN-Revision: 9eb4a46bba05da229be4c8f7a3cb64702e1a2f95 Maintainer: daijie Status: ready -->
<!-- CREDITS: mowangjuanzi -->
<phpdoc:classref xml:id="class.throwable" xmlns:phpdoc="http://php.net/ns/phpdoc" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude">

Expand Down Expand Up @@ -30,19 +30,14 @@

<!-- {{{ Synopsis -->
<classsynopsis class="interface">
<ooclass>
<classname>Throwable</classname>
</ooclass>
<ooexception>
<exceptionname>Throwable</exceptionname>
</ooexception>

<classsynopsisinfo>
<oointerface>
<interfacename>Throwable</interfacename>
</oointerface>

<oointerface>
<interfacename>Stringable</interfacename>
</oointerface>
</classsynopsisinfo>
<oointerface>
<modifier>extends</modifier>
<interfacename>Stringable</interfacename>
</oointerface>

<classsynopsisinfo role="comment">&Methods;</classsynopsisinfo>
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('class.throwable')/db:refentry/db:refsect1[@role='description']/descendant::db:methodsynopsis[@role='Throwable'])">
Expand Down
14 changes: 4 additions & 10 deletions language/predefined/traversable.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<!-- EN-Revision: 96a8379cd86b3ca4f1f5b2b94c5fb263f38050fd Maintainer: mowangjuanzi Status: ready -->
<!-- EN-Revision: 9eb4a46bba05da229be4c8f7a3cb64702e1a2f95 Maintainer: mowangjuanzi Status: ready -->
<phpdoc:classref xml:id="class.traversable" xmlns:phpdoc="http://php.net/ns/phpdoc" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude">

<title> <interfacename>Traversable</interfacename> (遍历)接口</title>
Expand Down Expand Up @@ -42,15 +42,9 @@

<!-- {{{ Synopsis -->
<classsynopsis class="interface">
<ooclass>
<classname>Traversable</classname>
</ooclass>

<classsynopsisinfo>
<oointerface>
<interfacename>Traversable</interfacename>
</oointerface>
</classsynopsisinfo>
<oointerface>
<interfacename>Traversable</interfacename>
</oointerface>
</classsynopsis>
<!-- }}} -->

Expand Down
14 changes: 4 additions & 10 deletions language/predefined/unitenum.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- EN-Revision: 96a8379cd86b3ca4f1f5b2b94c5fb263f38050fd Maintainer: daijie Status: ready -->
<!-- EN-Revision: 9eb4a46bba05da229be4c8f7a3cb64702e1a2f95 Maintainer: daijie Status: ready -->
<!-- CREDITS: Luffy, mowangjuanzi -->
<phpdoc:classref xml:id="class.unitenum" xmlns:phpdoc="http://php.net/ns/phpdoc" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude">
<title>UnitEnum 接口</title>
Expand All @@ -24,15 +24,9 @@

<!-- {{{ Synopsis -->
<classsynopsis class="interface">
<ooclass>
<classname>UnitEnum</classname>
</ooclass>

<classsynopsisinfo>
<oointerface>
<interfacename>UnitEnum</interfacename>
</oointerface>
</classsynopsisinfo>
<oointerface>
<interfacename>UnitEnum</interfacename>
</oointerface>

<classsynopsisinfo role="comment">&Methods;</classsynopsisinfo>
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('class.unitenum')/db:refentry/db:refsect1[@role='description']/descendant::db:methodsynopsis[@role='UnitEnum'])">
Expand Down
Loading

0 comments on commit fa79756

Please sign in to comment.