reference/classobj/functions/get-class.xml
4f36c26a72c40b16e955c3c1c88041910932d0bf
...
...
@@ -23,17 +23,14 @@
23
23
<term><parameter>object</parameter></term>
24
24
<listitem>
25
25
<para>
26
-
The tested object. This parameter may be omitted when inside a class.
26
+
The tested object.
27
27
</para>
28
28
<note>
29
29
<simpara>
30
30
Explicitly passing &null; as the <parameter>object</parameter> is no
31
-
longer allowed as of PHP 7.2.0.
32
-
</simpara>
33
-
<simpara>
34
-
The parameter is still optional and calling <function>get_class</function>
35
-
without a parameter from inside a class will work, but passing &null; now
36
-
emits an <constant>E_WARNING</constant> notice.
31
+
longer allowed as of PHP 7.2.0 and emits an <constant>E_WARNING</constant>.
32
+
As of PHP 8.0.0, a <classname>TypeError</classname> is emitted when
33
+
&null; is used.
37
34
</simpara>
38
35
</note>
39
36
</listitem>
...
...
@@ -45,12 +42,7 @@
45
42
&reftitle.returnvalues;
46
43
<para>
47
44
Returns the name of the class of which <parameter>object</parameter> is an
48
-
instance. Returns &false; if <parameter>object</parameter> is not an
49
-
object.
50
-
</para>
51
-
<para>
52
-
If <parameter>object</parameter> is omitted when inside a class, the
53
-
name of that class is returned.
45
+
instance.
54
46
</para>
55
47
<para>
56
48
If the <parameter>object</parameter> is an instance of a class which exists
...
...
@@ -61,7 +53,13 @@
61
53
&reftitle.errors;
62
54
<para>
63
55
If <function>get_class</function> is called with anything other than an
64
-
object, an <constant>E_WARNING</constant> level error is raised.
56
+
object, <classname>TypeError</classname> is raised. Prior to PHP 8.0.0,
57
+
an <constant>E_WARNING</constant> level error was raised.
58
+
</para>
59
+
<para>
60
+
If <function>get_class</function> is called with no arguments from outside a class,
61
+
an <classname>Error</classname> is thrown. Prior to PHP 8.0.0,
62
+
an <constant>E_WARNING</constant> level error was raised.
65
63
</para>
66
64
</refsect1>
67
65
<refsect1 role="changelog">
...
...
@@ -77,18 +75,29 @@
77
75
</thead>
78
76
<tbody>
79
77
<row>
80
-
<entry>7.2.0</entry>
78
+
<entry>8.3.0</entry>
81
79
<entry>
82
-
&null; was removed as the default value for <parameter>object</parameter>,
83
-
and is no longer a valid input.
80
+
Calling <function>get_class</function> without an argument now emits an
81
+
<constant>E_DEPRECATED</constant> warning;
82
+
previously, calling this function inside a class returned the name of that class.
84
83
</entry>
85
84
</row>
86
85
<row>
87
-
<entry>5.3.0</entry>
86
+
<entry>8.0.0</entry>
88
87
<entry>
89
-
&null; became the default value for <parameter>object</parameter>,
90
-
so passing &null; to <parameter>object</parameter> now has the same
91
-
result as not passing any value.
88
+
Calling this function from outside a class, without any arguments,
89
+
will now throw an <classname>Error</classname>.
90
+
Previously, an <constant>E_WARNING</constant> was raised
91
+
and the function returned &false;.
92
+
</entry>
93
+
</row>
94
+
<row>
95
+
<entry>7.2.0</entry>
96
+
<entry>
97
+
Prior to this version the default value for <parameter>object</parameter>
98
+
was &null; and it had the same effect as not passing any value. Now
99
+
&null; has been removed as the default value for <parameter>object</parameter>,
100
+
and is no longer a valid input.
92
101
</entry>
93
102
</row>
94
103
</tbody>
...
...
@@ -199,6 +208,7 @@ string(11) "Foo\Bar\Baz"
199
208
<member><function>get_called_class</function></member>
200
209
<member><function>get_parent_class</function></member>
201
210
<member><function>gettype</function></member>
211
+
<member><function>get_debug_type</function></member>
202
212
<member><function>is_subclass_of</function></member>
203
213
</simplelist>
204
214
</para>
205
215