Search code examples
phpstormphpdocmagic-function

PhpStorm - How to define usages of a function or method manually


For simplicity sake, I have these functions.

/**
* @param array
*/
function master($options) {
  if (!empty($options["post_function"])) {
    form_callables($options["post_function"], $data);
  }
}

/**
 * @param callable $function
 * @param          $data
 */
function form_callables(callable $function, $data) {
    if (is_callable($function)) {
        call_user_func($function, $data);
    } else {
        fusion_stop("Custom function could not be found.");
    }
}

Now, if i use them like this.

master( array( "post_function",  "my_function"));

/**
What do I need to doc here so that PhpStorm can show usages of either master or form_callables?
*/
function my_function() {
   echo "OK";
}

My problem is my_function shows no usages. I've tried @see, @mixin, @uses, PhpStorm still outlined as grey and No Usages in All Places.

How do I solve this?


Solution

  • Unfortunately I can't see a better solution rather than

    /**
     * @uses \my_function()
     */
    master(["post_function", "my_function"]);