Skip to content

Commit

Permalink
Update appendices/language
Browse files Browse the repository at this point in the history
  • Loading branch information
mowangjuanzi committed Jan 17, 2025
1 parent 149e387 commit 0fac33c
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 64 deletions.
6 changes: 3 additions & 3 deletions appendices/ini.list.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: d4d5216e7a965ca194f6b1c9dee84cecab2674e5 Maintainer: Avenger Status: ready -->
<!-- EN-Revision: cc5b61f3f889ae2d65a7007e9bdd34981b8aba50 Maintainer: Avenger Status: ready -->
<!-- CREDITS: Luffy, mowangjuanzi -->
<section xml:id="ini.list" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude">
<title>&php.ini; 配置选项列表</title>
Expand Down Expand Up @@ -455,7 +455,7 @@
<row>
<entry>mail.force_extra_parameters</entry>
<entry>&null;</entry>
<entry>&php.ini; only</entry>
<entry><constant>INI_SYSTEM</constant></entry>
<entry></entry>
</row>
<row>
Expand Down Expand Up @@ -507,7 +507,7 @@
<entry><link linkend="ini.open-basedir">open_basedir</link></entry>
<entry>&null;</entry>
<entry><constant>INI_ALL</constant></entry>
<entry>在 PHP &lt; 5.2.3 时是 <constant>INI_SYSTEM</constant>。</entry>
<entry></entry>
</row>
<row>
<entry><link linkend="ini.output-buffering">output_buffering</link></entry>
Expand Down
11 changes: 5 additions & 6 deletions language/control-structures/require.xml
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<!-- EN-Revision: 84b8fca68fc762fefe85acde180a38b2e77a28b9 Maintainer: dallas Status: ready -->
<!-- EN-Revision: 30c0106d51ac2786b81b27709ca88f1daf07e716 Maintainer: dallas Status: ready -->
<!-- CREDITS: mowangjuanzi -->
<sect1 xml:id="function.require" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>require</title>
<?phpdoc print-version-for="require"?>

<para>
<literal>require</literal> 和 <function>include</function>
几乎完全一样,除了处理失败的方式不同之外。<function>require</function>
在出错时产生 <constant>E_COMPILE_ERROR</constant>
级别的错误。换句话说将导致脚本中止而 <function>include</function>
只产生警告(<constant>E_WARNING</constant>),脚本会继续运行。
<literal>require</literal> 跟 <function>include</function> 相同,只是在失败时还会产生
<classname>Error</classname> 异常(PHP 8.0.0 之前为 <constant>E_COMPILE_ERROR</constant>
级别错误),而 <function>include</function> 只会产生警告(<constant>E_WARNING</constant> 级别错误)。
</para>
<para>
参见 <function>include</function> 文档了解详情。
Expand Down
5 changes: 2 additions & 3 deletions language/enumerations.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- EN-Revision: 83e2056f071742c44d2b0bdbc8574d73697c7a08 Maintainer: daijie Status: ready -->
<!-- EN-Revision: 3d5ec5f3634cc9abcbfea7200067861025e9b13e Maintainer: daijie Status: ready -->
<!-- CREDITS: Luffy, mowangjuanzi -->
<chapter xml:id="language.enumerations" xmlns="http://docbook.org/ns/docbook">
<title>枚举</title>
Expand Down Expand Up @@ -510,8 +510,7 @@ enum Size

<para>枚举也能使用 trait,行为和 class 一样。
留意在枚举中 <literal>use</literal> trait 不允许包含属性。
只能包含方法、静态方法。
包含属性的 trait 会导致 fatal 错误。
只能包含方法、静态方法和常量。包含属性的 trait 会导致 fatal 错误。
</para>

<programlisting role="php">
Expand Down
38 changes: 15 additions & 23 deletions language/oop5/lazy-objects.xml
Original file line number Diff line number Diff line change
Expand Up @@ -239,37 +239,30 @@ var_dump($post->id);
<title>非触发操作</title>

<simpara>
The following specific methods or low-level operations allow access or
modification of lazy objects without triggering initialization:
以下特定方法或低级操作允许访问或修改延迟对象而无需触发初始化:
</simpara>

<simplelist>
<member>
Marking properties as non-lazy with
<methodname>ReflectionProperty::skipLazyInitialization</methodname> or
<methodname>ReflectionProperty::setRawValueWithoutLazyInitialization</methodname>.
使用 <methodname>ReflectionProperty::skipLazyInitialization</methodname> 或
<methodname>ReflectionProperty::setRawValueWithoutLazyInitialization</methodname>
将属性标注为非延迟。
</member>
<member>
Retrieving the internal representation of properties using
<function>get_mangled_object_vars</function> or by
<link linkend="language.types.array.casting">casting the object to an
array</link>.
使用 <function>get_mangled_object_vars</function> 或将<link
linkend="language.types.array.casting">对象转换为数组</link>来检索属性的内部表示。
</member>
<member>
Using <function>serialize</function> when
<constant>ReflectionClass::SKIP_INITIALIZATION_ON_SERIALIZE</constant>
is set, unless
<link linkend="object.serialize">__serialize()</link> or
<link linkend="object.sleep">__sleep()</link> trigger initialization.
当设置了 <constant>ReflectionClass::SKIP_INITIALIZATION_ON_SERIALIZE</constant> 时使用
<function>serialize</function>,除非使用 <link linkend="object.serialize">__serialize()</link>
或 <link linkend="object.sleep">__sleep()</link> 触发初始化。
</member>
<member>
Calling to <methodname>ReflectionObject::__toString</methodname>.
调用 <methodname>ReflectionObject::__toString</methodname>
</member>
<member>
Using <function>var_dump</function> or
<function>debug_zval_dump</function>, unless
<link linkend="object.debuginfo">__debugInfo()</link> triggers
initialization.
使用 <function>var_dump</function> 或 <function>debug_zval_dump</function>,除非使用
<link linkend="object.debuginfo">__debugInfo()</link> 触发初始化。
</member>
</simplelist>
</sect3>
Expand All @@ -279,15 +272,14 @@ var_dump($post->id);
<title>初始化序列</title>

<simpara>
This section outlines the sequence of operations performed when
initialization is triggered, based on the strategy in use.
本节概述了根据所使用的执行策略触发初始化时的操作顺序。
</simpara>

<sect3>
<title>幽灵对象</title>
<simplelist>
<member>
The object is marked as non-lazy.
对象标记为非延迟。
</member>
<member>
Properties not initialized with
Expand Down Expand Up @@ -316,7 +308,7 @@ var_dump($post->id);
<title>代理对象</title>
<simplelist>
<member>
The object is marked as non-lazy.
对象标记为非延迟。
</member>
<member>
Unlike ghost objects, the properties of the object are not modified at
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<!-- EN-Revision: 9eb4a46bba05da229be4c8f7a3cb64702e1a2f95 Maintainer: Szopen Xiao Status: ready -->
<!-- EN-Revision: 267a3d4e60d8a6da941e72d195386b5841052cca Maintainer: Szopen Xiao Status: ready -->
<!-- CREDITS: mowangjuanzi -->
<reference xml:id="class.countable" role="class" 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 @@ -39,7 +39,7 @@

</partintro>

&reference.spl.entities.countable;
&language.predefined.countable.count;

</reference>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<!-- EN-Revision: d51166ca16fda8e766849505b84f9306ef443f71 Maintainer: Szopen Xiao Status: ready -->
<!-- EN-Revision: 527e9b11ab0c1f678743a76773bbc795f9f6f05f Maintainer: Szopen Xiao Status: ready -->
<!-- CREDITS: mowangjuanzi -->
<refentry xml:id="countable.count" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refentry xml:id="countable.count" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
<refname>Countable::count</refname>
<refpurpose>统计对象的元素个数</refpurpose>
Expand All @@ -14,10 +14,10 @@
<modifier>public</modifier> <type>int</type><methodname>Countable::count</methodname>
<void/>
</methodsynopsis>
<para>
当在实现了 <classname>Countable</classname> 的对象上执行 <function>count</function>
函数时,会执行此方法。
</para>
<simpara>
当 <function>count</function> 的 <parameter>value</parameter> 是实现
<classname>Countable</classname> 的对象时,会执行此方法。
</simpara>
</refsect1>

<refsect1 role="parameters">
Expand All @@ -27,41 +27,40 @@

<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
<simpara>
<type>int</type> 形式的自定义计数。
</para>
<note>
<para>
返回值强制转换为 <type>int</type>。
</para>
</note>
</simpara>
</refsect1>

<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>Countable::count</function> 示例</title>
<programlisting role="php">
<example>
<title><function>Countable::count</function> 示例</title>
<programlisting role="php">
<![CDATA[
<?php
class myCounter implements Countable {
class Counter implements Countable
{
private $count = 0;
public function count() {
public function count(): int
{
return ++$this->count;
}
}
$counter = new myCounter;
$counter = new Counter;
for($i=0; $i<10; ++$i) {
for ($i = 0; $i < 10; ++$i) {
echo "I have been count()ed " . count($counter) . " times\n";
}
?>
]]>
</programlisting>
&example.outputs.similar;
<screen>
</programlisting>
&example.outputs.similar;
<screen>
<![CDATA[
I have been count()ed 1 times
I have been count()ed 2 times
Expand All @@ -74,9 +73,8 @@ I have been count()ed 8 times
I have been count()ed 9 times
I have been count()ed 10 times
]]>
</screen>
</example>
</para>
</screen>
</example>
</refsect1>

</refentry>
Expand Down

0 comments on commit 0fac33c

Please sign in to comment.