reference/spl/functions/class-uses.xml
42bd1bfed391b287e55e47fed1b8f8d22a033ee0
...
...
@@ -10,13 +10,13 @@
10
10
<refsect1 role="description">
11
11
&reftitle.description;
12
12
<methodsynopsis>
13
-
<type>array</type><methodname>class_uses</methodname>
14
-
<methodparam><type>mixed</type><parameter>class</parameter></methodparam>
13
+
<type class="union"><type>array</type><type>false</type></type><methodname>class_uses</methodname>
14
+
<methodparam><type class="union"><type>object</type><type>string</type></type><parameter>object_or_class</parameter></methodparam>
15
15
<methodparam choice="opt"><type>bool</type><parameter>autoload</parameter><initializer>&true;</initializer></methodparam>
16
16
</methodsynopsis>
17
17
<para>
18
18
This function returns an array with the names of the traits that the
19
-
given <parameter>class</parameter> uses. This does however not include
19
+
given <parameter>object_or_class</parameter> uses. This does however not include
20
20
any traits used by a parent class.
21
21
</para>
22
22
</refsect1>
...
...
@@ -26,7 +26,7 @@
26
26
<para>
27
27
<variablelist>
28
28
<varlistentry>
29
-
<term><parameter>class</parameter></term>
29
+
<term><parameter>object_or_class</parameter></term>
30
30
<listitem>
31
31
<para>
32
32
An object (class instance) or a string (class name).
...
...
@@ -37,8 +37,8 @@
37
37
<term><parameter>autoload</parameter></term>
38
38
<listitem>
39
39
<para>
40
-
Whether to allow this function to load the class automatically through
41
-
the <function>__autoload</function> magic method.
40
+
Whether to <link linkend="language.oop5.autoload">autoload</link>
41
+
if not already loaded.
42
42
</para>
43
43
</listitem>
44
44
</varlistentry>
...
...
@@ -50,7 +50,7 @@
50
50
<refsect1 role="returnvalues">
51
51
&reftitle.returnvalues;
52
52
<para>
53
-
An array on success, or &false; on error.
53
+
An array on success, or &false; when the given class doesn't exist.
54
54
</para>
55
55
</refsect1>
56
56

...
...
@@ -72,11 +72,9 @@ print_r(class_uses(new bar));
72
72

73
73
print_r(class_uses('bar'));
74
74

75
-
function __autoload($class_name) {
76
-
require_once $class_name . '.php';
77
-
}
75
+
spl_autoload_register();
78
76

79
-
// use __autoload to load the 'not_loaded' class
77
+
// use autoloading to load the 'not_loaded' class
80
78
print_r(class_uses('not_loaded', true));
81
79

82
80
?>
...
...
@@ -89,12 +87,10 @@ Array
89
87
(
90
88
[foo] => foo
91
89
)
92
-

93
90
Array
94
91
(
95
92
[foo] => foo
96
93
)
97
-

98
94
Array
99
95
(
100
96
[trait_of_not_loaded] => trait_of_not_loaded
...
...
@@ -115,7 +111,6 @@ Array
115
111
</para>
116
112
</refsect1>
117
113
</refentry>
118
-

119
114
<!-- Keep this comment at the end of the file
120
115
Local variables:
121
116
mode: sgml
122
117