From 64c183f2e215f032fab44f09b336f87c7ba83763 Mon Sep 17 00:00:00 2001 From: USAMI Kenta Date: Tue, 14 Jul 2026 21:02:17 +0900 Subject: [PATCH] Clarify forward_static_call docs --- .../functions/forward-static-call-array.xml | 33 +++++++++++-------- .../functions/forward-static-call.xml | 20 ++++++----- 2 files changed, 31 insertions(+), 22 deletions(-) diff --git a/reference/funchand/functions/forward-static-call-array.xml b/reference/funchand/functions/forward-static-call-array.xml index d2aba7efd68e..252bf3474f9d 100644 --- a/reference/funchand/functions/forward-static-call-array.xml +++ b/reference/funchand/functions/forward-static-call-array.xml @@ -3,7 +3,8 @@ forward_static_call_array - Call a static method and pass the arguments as array + Call a callback while preserving the current called class, with + parameters as an array @@ -13,15 +14,19 @@ callablecallback arrayargs - + Calls a user defined function or method given by the callback parameter. This function must be called within a method context, it can't be used outside a class. - It uses the late static - binding. - All arguments of the forwarded method are passed as values, - and as an array, similarly to call_user_func_array. - + When calling a method callback, it forwards the current + late static binding, + so static:: inside the method resolves to the current + called class. This is useful for static method callbacks that should behave + like forwarding calls such as parent:: or + self::. + Arguments for the callback are taken from the args + array, similarly to call_user_func_array. + @@ -41,14 +46,14 @@ args - - One parameter, gathering all the method parameter in one array. - + + The parameters to be passed to the callback, as an array. + - - Note that the parameters for forward_static_call_array are - not passed by reference. - + + To pass a parameter by reference, the corresponding element in + args must be a reference. + diff --git a/reference/funchand/functions/forward-static-call.xml b/reference/funchand/functions/forward-static-call.xml index 4a89c8568124..5f399bb3acc8 100644 --- a/reference/funchand/functions/forward-static-call.xml +++ b/reference/funchand/functions/forward-static-call.xml @@ -3,7 +3,7 @@ forward_static_call - Call a static method + Call a callback while preserving the current called class @@ -13,13 +13,17 @@ callablecallback mixedargs - + Calls a user defined function or method given by the callback parameter, with the following arguments. This function must be called within a method context, it can't be used outside a class. - It uses the late static - binding. - + When calling a method callback, it forwards the current + late static binding, + so static:: inside the method resolves to the current + called class. This is useful for static method callbacks that should behave + like forwarding calls such as parent:: or + self::. + @@ -39,9 +43,9 @@ args - - Zero or more parameters to be passed to the function. - + + Zero or more parameters to be passed to the callback. +