@@ -1539,15 +1539,25 @@ protected function is_token_namespaced( $stackPtr ) {
15391539 /**
15401540 * Check if a token is (part of) a parameter for a function call to a select list of functions.
15411541 *
1542+ * This is useful, for instance, when trying to determine the context a variable is used in.
1543+ *
1544+ * For example: this function could be used to determine if the variable `$foo` is used
1545+ * in a global function call to the function `is_foo()`.
1546+ * In that case, a call to this function would return the stackPtr to the T_STRING `is_foo`
1547+ * for code like: `is_foo( $foo, 'some_other_param' )`, while it would return `false` for
1548+ * the following code `is_bar( $foo, 'some_other_param' )`.
1549+ *
15421550 * @since 2.1.0
15431551 *
15441552 * @param int $stackPtr The index of the token in the stack.
15451553 * @param array $valid_functions List of valid function names.
15461554 * Note: The keys to this array should be the function names
15471555 * in lowercase. Values are irrelevant.
15481556 * @param bool $global Optional. Whether to make sure that the function call is
1549- * to a global function. If `false`, methods and namespaced
1550- * function calls will also be allowed.
1557+ * to a global function. If `false`, calls to methods, be it static
1558+ * `Class::method()` or via an object `$obj->method()`, and
1559+ * namespaced function calls, like `MyNS\function_name()` will
1560+ * also be accepted.
15511561 * Defaults to `true`.
15521562 * @param bool $allow_nested Optional. Whether to allow for nested function calls within the
15531563 * call to this function.
0 commit comments