com doc/zh: [WIP] 翻译 php8.0 不 兼容变更: appendices/migration 80/incompatible.xml
[email protected] (CHU Zhaowei) Sat, 02 Jan 2021 19:26:14 +0000
| Newsgroups | php.doc.zh |
|---|---|
| Message-ID | <[email protected]> |
Commit: 7542e2f07d6c63fb65c63403b9a548b902de1c29 Author: CHU Zhaowei <[email protected]> Sun, 3 Jan 2021 03:26:14 +0800 Parents: ed0c308e3d337fe6afc6d6aa9ab822617f5184d6 Branches: master Link: http://git.php.net/?p=doc/zh.git;a=commitdiff;h=7542e2f07d6c63fb65c63403b9a548b902de1c29 Log: [WIP] 翻译 php8.0 不兼容变更 Changed paths: M appendices/migration80/incompatible.xml Diff: diff --git a/appendices/migration80/incompatible.xml b/appendices/migration80/incompatible.xml index 9ae09dc3..c67dec4d 100644 --- a/appendices/migration80/incompatible.xml +++ b/appendices/migration80/incompatible.xml @@ -10,13 +10,12 @@ <title>PHP 核心中不向后兼容的变更</title> <sect3 xml:id="migration80.incompatible.core.string-number-comparision"> - <title>String to Number Comparison</title> + <title>字符串与数字的比较</title> <para> - Non-strict comparisons between numbers and non-numeric strings now work by casting the number to - string and comparing the strings. Comparisons between numbers and numeric strings continue to - work as before. Notably, this means that <code>0 == "not-a-number"</code> is considered false - now. + 数字与非数字形式的字符串之间的非严格比较现在将首先将数字转为字符串,然后比较这两个字符串。 + 数字与数字形式的字符串之间的比较仍然像之前那样进行。 + 请注意,这意味着 <code>0 == "not-a-number"</code> 现在将被认为是 false 。 <informaltable> <tgroup cols="3"> <thead> @@ -70,31 +69,30 @@ <itemizedlist> <listitem> <para> - <literal>match</literal> is now a reserved keyword. + <literal>match</literal> 现在是一个保留字。 </para> </listitem> <listitem> <para> - Assertion failures now throw by default. If the old behavior is desired, - <code>assert.exception=0</code> can be set in the INI settings. + 断言(Assertion)失败现在默认抛出异常。如果想要改回之前的行为,可以在 INI 设置中设置 + <code>assert.exception=0</code> 。 </para> </listitem> <listitem> <para> - Methods with the same name as the class are no longer interpreted as constructors. The - <link linkend="object.construct">__construct()</link> method should be used instead. + 与类名相同的方法名将不再被当做构造方法。应该使用<link linkend="object.construct">__construct()</link> + 来取代它。 </para> </listitem> <listitem> <para> - The ability to call non-static methods statically has been removed. Thus - <function>is_callable</function> will fail when checking for a non-static method with a classname - (must check with an object instance). + 不再允许通过静态调用的方式去调用非静态方法。因此<function>is_callable</function>在检查一个类名与非静态方法 + 时将返回失败(应当检查一个类的实例)。 </para> </listitem> <listitem> <para> - The <code>(real)</code> and <code>(unset)</code> casts have been removed. + <code>(real)</code> 和 <code>(unset)</code> 转换已被移除。 </para> </listitem> <listitem>