Alias for a define() function



Let's say I have the following code:


define('TEST', 'a');

echo TEST;


I would like to replace the define() function with a wrapper, like so:


function config($key, $value) {
    define($key, @$_ENV[$key] ?: $value);

config('TEST', 'a');

echo TEST;


The problem is that now PhpStorm tells me that the `echo` line contains an undefined constant, and I also lose the ability to Cmd + Click on the constant name to find it's usages.


Is there a way to tell PhpStorm to treat the custom function as the define() function and keep all the functionality of the IDE the same?





Hi there,

Unfortunately, it is not possible at the moment and IDE is unable to detect constants with dynamically assigned names. I have submitted a feature request, please feel free to vote & comment on:


Please sign in to leave a comment.