Skip to content

Commit 911fe79

Browse files
authored
Use &true;/&false;/&null; entities for boolean/null constants (#5641)
* Use &true;/&false;/&null; entities for boolean/null constants Replace <literal>true/false/null</literal> with the standard entities where they denote the PHP boolean/null constant. Quoted strings, JSON/INI literals, SQL NULL and type notations are intentionally left untouched.
1 parent 74b6239 commit 911fe79

21 files changed

Lines changed: 50 additions & 50 deletions

File tree

language/control-structures/include.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ include 'http://www.example.com/file.php?foo=1&bar=2';
181181
</para>
182182
<simpara>
183183
Handling Returns: <literal>include</literal> returns
184-
<literal>FALSE</literal> on failure and raises a warning. Successful
184+
&false; on failure and raises a warning. Successful
185185
includes, unless overridden by the included file, return
186186
<literal>1</literal>. It is possible to execute a <function>return</function>
187187
statement inside an included file in order to terminate processing in

language/enumerations.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ $ref = &$suit->value;
294294
</member>
295295
<member>
296296
<literal>tryFrom(int|string): ?self</literal> will take a scalar and return the
297-
corresponding Enum Case. If one is not found, it will return <literal>null</literal>.
297+
corresponding Enum Case. If one is not found, it will return &null;.
298298
This is mainly useful in cases where the input scalar is untrusted and the caller wants
299299
to implement their own error handling or default-value logic.
300300
</member>

language/oop5/overloading.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@
116116
<para>
117117
PHP will not call an overloaded method from within the same overloaded method.
118118
That means, for example, writing <code>return $this->foo</code> inside of
119-
<link linkend="object.get">__get()</link> will return <literal>null</literal>
119+
<link linkend="object.get">__get()</link> will return &null;
120120
and raise an <constant>E_WARNING</constant> if there is no <literal>foo</literal> property defined,
121121
rather than calling <link linkend="object.get">__get()</link> a second time.
122122
However, overload methods may invoke other overload methods implicitly (such as

language/predefined/weakreference.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ NULL
9191
<entry>8.4.0</entry>
9292
<entry>
9393
The output of <methodname>WeakReference::__debugInfo</methodname> now includes
94-
the referenced object, or <literal>NULL</literal> if the reference is no longer
94+
the referenced object, or &null; if the reference is no longer
9595
valid.
9696
</entry>
9797
</row>

language/types/array.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ var_dump($array1, $array2);
115115
<listitem>
116116
<simpara>
117117
<type>Null</type> will be cast to the empty string, i.e. the key
118-
<literal>null</literal> will actually be stored under <literal>""</literal>.
118+
&null; will actually be stored under <literal>""</literal>.
119119
</simpara>
120120
</listitem>
121121
<listitem>

language/types/declarations.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -304,14 +304,14 @@ Stack trace:
304304
</note>
305305

306306
<note>
307-
<para>
307+
<simpara>
308308
It is also possible to achieve nullable arguments by making
309-
<literal>null</literal> the default value.
309+
&null; the default value.
310310
This is not recommended as if the default value is changed in a child
311311
class a type compatibility violation will be raised as the
312312
<type>null</type> type will need to be added to the type declaration.
313313
This behavior is also deprecated since PHP 8.4.
314-
</para>
314+
</simpara>
315315
<example>
316316
<title>Old way to make arguments nullable</title>
317317
<programlisting role="php">

reference/datetime/dateinterval/createfromdatestring.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@
8989
<entry>
9090
<methodname>DateInterval::createFromDateString</methodname> now throws
9191
<exceptionname>DateMalformedIntervalStringException</exceptionname> if an
92-
invalid string is passed. Previously, it returned <literal>false</literal>,
92+
invalid string is passed. Previously, it returned &false;,
9393
and a warning was emitted.
9494
<function>date_interval_create_from_date_string</function> has not been
9595
changed.

reference/datetime/datetime/modify.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@
7878
<entry>
7979
<methodname>DateTime::modify</methodname> now throws
8080
<exceptionname>DateMalformedStringException</exceptionname> if an
81-
invalid string is passed. Previously, it returned <literal>false</literal>,
81+
invalid string is passed. Previously, it returned &false;,
8282
and a warning was emitted.
8383
<function>date_modify</function> has not been changed.
8484
</entry>

reference/datetime/datetimeimmutable/modify.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@
7171
<entry>
7272
<methodname>DateTimeImmutable::modify</methodname> now throws
7373
<exceptionname>DateMalformedStringException</exceptionname> if an
74-
invalid string is passed. Previously, it returned <literal>false</literal>,
74+
invalid string is passed. Previously, it returned &false;,
7575
and a warning was emitted.
7676
</entry>
7777
</row>

reference/filter/constants.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -285,14 +285,14 @@
285285
<simpara>
286286
Returns &true; for <literal>"1"</literal>,
287287
<literal>1</literal> including binary, octal and hexadecimal notations, <literal>1.0</literal> including scientific notation,
288-
<literal>"true"</literal>, <literal>true</literal>,
288+
<literal>"true"</literal>, &true;,
289289
<literal>"on"</literal>,
290290
and <literal>"yes"</literal>.
291291
</simpara>
292292
<simpara>
293293
Returns &false; for <literal>"0"</literal>,
294294
<literal>0</literal> including binary, octal and hexadecimal notations, <literal>0.0</literal> including scientific notation,
295-
<literal>"false"</literal>, <literal>false</literal>,
295+
<literal>"false"</literal>, &false;,
296296
<literal>"off"</literal>,
297297
<literal>"no"</literal>, and
298298
<literal>""</literal>.

0 commit comments

Comments
 (0)