[DOC-CVS] [doc-en] master: Clarify forward_static_call_array() behavior outside a class context (#5241)

[email protected] (Louis-Arnaud via GitHub)
Newsgroups php.doc.cvs
Message-ID <[email protected]>
Author: Louis-Arnaud (lacatoire)
Committer: GitHub (web-flow)
Pusher: lacatoire
Date: 2026-08-19T08:39:56+02:00

Commit: https://github.com/php/doc-en/commit/846dfb87daacac70877c332686d60c7dfd0f15d8
Raw diff: https://github.com/php/doc-en/commit/846dfb87daacac70877c332686d60c7dfd0f15d8.diff

Clarify forward_static_call_array() behavior outside a class context (#5241)

The description claimed the function must be called within a method
context. It can be called anywhere: outside a class it behaves like
call_user_func_array(), without late static binding.

The sibling forward_static_call() does require an active class scope,
so a note records the asymmetry.

Fixes #3282

Changed paths:
  M  reference/funchand/functions/forward-static-call-array.xml


Diff:

diff --git a/reference/funchand/functions/forward-static-call-array.xml b/reference/funchand/functions/forward-static-call-array.xml
index d2aba7efd68e..fcb899adbb32 100644
--- a/reference/funchand/functions/forward-static-call-array.xml
+++ b/reference/funchand/functions/forward-static-call-array.xml
@@ -13,15 +13,23 @@
    <methodparam><type>callable</type><parameter>callback</parameter></methodparam>
    <methodparam><type>array</type><parameter>args</parameter></methodparam>
   </methodsynopsis>
-  <para>
+  <simpara>
    Calls a user defined function or method given by the <parameter>callback</parameter>
-   parameter. This function must be called within a method context, it can't be 
-   used outside a class.
-   It uses the <link linkend="language.oop5.late-static-bindings">late static
-   binding</link>.
-   All arguments of the forwarded method are passed as values,
-   and as an array, similarly to <function>call_user_func_array</function>.
-  </para>
+   parameter, with arguments passed as an array, similarly to
+   <function>call_user_func_array</function>.
+   When called from within a method context, it uses the
+   <link linkend="language.oop5.late-static-bindings">late static binding</link>.
+   When called outside a class context, it behaves like
+   <function>call_user_func_array</function>, without late static binding.
+  </simpara>
+  <note>
+   <simpara>
+    Unlike <function>forward_static_call</function>, this function does not
+    require an active class scope: calling
+    <function>forward_static_call</function> outside a class throws an
+    <exceptionname>Error</exceptionname>, while this function does not.
+   </simpara>
+  </note>
  </refsect1>
 
  <refsect1 role="parameters">
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.