|
3 | 3 | <refentry xml:id="function.forward-static-call-array" xmlns="http://docbook.org/ns/docbook"> |
4 | 4 | <refnamediv> |
5 | 5 | <refname>forward_static_call_array</refname> |
6 | | - <refpurpose>Call a static method and pass the arguments as array</refpurpose> |
| 6 | + <refpurpose>Call a callback while preserving the current called class, with |
| 7 | + parameters as an array</refpurpose> |
7 | 8 | </refnamediv> |
8 | 9 |
|
9 | 10 | <refsect1 role="description"> |
|
17 | 18 | Calls a user defined function or method given by the <parameter>callback</parameter> |
18 | 19 | parameter. This function must be called within a method context, it can't be |
19 | 20 | used outside a class. |
20 | | - It uses the <link linkend="language.oop5.late-static-bindings">late static |
21 | | - binding</link>. |
22 | | - All arguments of the forwarded method are passed as values, |
23 | | - and as an array, similarly to <function>call_user_func_array</function>. |
| 21 | + When calling a method callback, it forwards the current |
| 22 | + <link linkend="language.oop5.late-static-bindings">late static binding</link>, |
| 23 | + so <literal>static::</literal> inside the method resolves to the current |
| 24 | + called class. This is useful for static method callbacks that should behave |
| 25 | + like forwarding calls such as <literal>parent::</literal> or |
| 26 | + <literal>self::</literal>. |
| 27 | + Arguments for the callback are taken from the <parameter>args</parameter> |
| 28 | + array, similarly to <function>call_user_func_array</function>. |
24 | 29 | </para> |
25 | 30 | </refsect1> |
26 | 31 |
|
|
42 | 47 | <term><parameter>args</parameter></term> |
43 | 48 | <listitem> |
44 | 49 | <para> |
45 | | - One parameter, gathering all the method parameter in one array. |
| 50 | + The parameters to be passed to the callback, as an array. |
46 | 51 | </para> |
47 | 52 | <note> |
48 | 53 | <para> |
49 | | - Note that the parameters for <function>forward_static_call_array</function> are |
50 | | - not passed by reference. |
| 54 | + To pass a parameter by reference, the corresponding element in |
| 55 | + <parameter>args</parameter> must be a reference. |
51 | 56 | </para> |
52 | 57 | </note> |
53 | 58 | </listitem> |
|
0 commit comments