Search code examples
phpstorm

Is there a way to disable autosuggest for PHP's superglobals?


As the title says, is there a way in PhpStorm to disable autosuggestion for the likes of $_SERVER, $_POST, $_REQUEST and all the other PHP's superglobals?

I often create variable with name $request, and more often then not I end up having $_REQUEST. I never use these variables, since I use Symfony, and access this data 'the Symfony way', so it would be really nice not to even see them in suggestions.


Solution

  • Well ... WI-34788 ticket looks very similar to what you are asking here. It was marked as duplicate of some other ticket ... which is now implemented in PhpStorm 2017.1.

    The idea is -- disable unwanted modules so entries declared there should disappear from completion results:

    • Settings/Preferences | Languages & Frameworks | PHP
    • Switch to PHP Runtime tab
    • Uncheck/disable Core | Superglobals module

    Possible issue is: that module declares not just $_REQUEST and alike but some other global variables as well which you may want to use in your project (check here what exactly is declared in that module: https://github.com/JetBrains/phpstorm-stubs/blob/master/superglobals/_superglobals.php).

    But if anything -- simply clone PhpStorm stubs repo, tell PhpStorm to use it instead of bundled one (same page in Settings/Preferences -- look at the bottom under Advanced Settings) and remove only those unwanted definitions from there (from your local copy) -- this will work for sure.