The Setup
I use a lot of function pointers in my PHP code and some functions are called only by function pointer. A simple and common example that may relate to others:
// Stub of my custom assert failure function.
function assertFailure($file, $line, $code, $message = '')
{
http_response_code(500);
echo '<h1>ASSERT FAILURE: </h1>';
// ...
die();
}
assert_options(ASSERT_CALLBACK, 'assertFailure');
The problem
PhpStorm is flagging these functions as "not used" as they are used only in function pointers. I like the inspection as it has helped me clean up a lot of old code. So I don't want to turn it off completely.
The question(s)
How do I get PhpStorm to recognize the function is used or at least inline disable the inspection for a specific function? I occasionally use lines that allow me to disable an inspection for specific use case such as a missing break in a switch:
/** @noinspection PhpMissingBreakStatementInspection */
. I can not find an equivalent for this.An even better solution would be for PhpStorm to recognize the string as a function pointer so I could jump to definition, check parameter lists, and it would know I was using it. Is there a setting or a comment declaration I can use similar to identifying variable types
/** @var DateTime $now */
.