phpstormphpstorm-2017.2

Disable import of classes for PHPDoc


One thing I love about PhpStorm is the easy import of classes (adding the use statement for you). However, the annoyance with this is when you don't actually want it to import the class. For example, when I'm documenting a method's return value as another class.

Is there any way to disable PhpStorm's import of classes only when annotating in PHPDoc blocks?


Solution

  • If I understand your request correctly...

    1. Settings/Preferences
    2. Editor | Code Style | PHP
    3. PHPDoc tab
    4. There is Use fully-qualified class names under Generated Doc Blocks

    That option does the job when completing not-yet-imported class in @return (should do the same for @param and others -- have not tested other tags myself -- only checked on @return).

    enter image description here


    On related note: this ticket is asking to have an ability to always use FQN in PHPDoc blocks (implemented as Inspection .. so can be turned on or off). Might be useful for you -- consider voting.

    https://youtrack.jetbrains.com/issue/WI-28591