Skip to content

Commit f908fff

Browse files
Use "singleton type" instead of "value type" (#4332)
1 parent a8863b0 commit f908fff

File tree

4 files changed

+29
-21
lines changed

4 files changed

+29
-21
lines changed

language/types.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ int(16)
131131
&language.types.void;
132132
&language.types.never;
133133
&language.types.relative-class-types;
134-
&language.types.value;
134+
&language.types.singleton;
135135
&language.types.iterable;
136136
&language.types.declarations;
137137
&language.types.type-juggling;

language/types/declarations.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ Stack trace:
271271
<title>Union types</title>
272272
<warning>
273273
<simpara>
274-
It is not possible to combine the two value types <type>false</type>
274+
It is not possible to combine the two singleton types <type>false</type>
275275
and <type>true</type> together in a union type.
276276
Use <type>bool</type> instead.
277277
</simpara>

language/types/value.xml renamed to language/types/singleton.xml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,25 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<sect1 xml:id="language.types.value">
3-
<title>Value types</title>
2+
<sect1 xml:id="language.types.singleton">
3+
<title>Singleton types</title>
44

55
<para>
6-
Value types are those which not only check the type of a value but also
7-
the value itself. PHP has support for two value types:
8-
<type>false</type> as of PHP 8.0.0, and <type>true</type>
6+
Singleton types are those which allow only one value.
7+
PHP has support for two singleton types:
8+
<type>false</type> as of PHP 8.0.0 and <type>true</type>
99
as of PHP 8.2.0.
1010
</para>
1111

1212
<warning>
1313
<simpara>
14-
Prior to PHP 8.2.0 the <type>false</type> type could only be used as part of a
14+
Prior to PHP 8.2.0 the <type>false</type> type
15+
could only be used as part of a
1516
<link linkend="language.types.type-system.composite.union">union type</link>.
1617
</simpara>
1718
</warning>
1819

1920
<note>
2021
<simpara>
21-
It is not possible to define custom value types. Consider using an
22+
It is not possible to define custom singleton types. Consider using an
2223
<link linkend="language.types.enumerations">enumerations</link> instead.
2324
</simpara>
2425
</note>

language/types/type-system.xml

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,6 @@
2727
<listitem>
2828
<simpara>Built-in types</simpara>
2929
<itemizedlist>
30-
<listitem>
31-
<simpara><type>null</type> type</simpara>
32-
</listitem>
3330
<listitem>
3431
<simpara>
3532
Scalar types:
@@ -70,18 +67,28 @@
7067
<type>self</type>, <type>parent</type>, and <type>static</type>
7168
</simpara>
7269
</listitem>
73-
</itemizedlist>
74-
</listitem>
75-
<listitem>
76-
<simpara>
77-
<link linkend="language.types.value">Value types</link>
78-
</simpara>
79-
<itemizedlist>
8070
<listitem>
81-
<simpara><type>false</type></simpara>
71+
<simpara>
72+
<link linkend="language.types.singleton">Singleton types</link>
73+
</simpara>
74+
<itemizedlist>
75+
<listitem>
76+
<simpara><type>false</type></simpara>
77+
</listitem>
78+
<listitem>
79+
<simpara><type>true</type></simpara>
80+
</listitem>
81+
</itemizedlist>
8282
</listitem>
8383
<listitem>
84-
<simpara><type>true</type></simpara>
84+
<simpara>
85+
Unit types
86+
</simpara>
87+
<itemizedlist>
88+
<listitem>
89+
<simpara><type>null</type></simpara>
90+
</listitem>
91+
</itemizedlist>
8592
</listitem>
8693
</itemizedlist>
8794
</listitem>

0 commit comments

Comments
 (0)