Search code examples
intellij-ideaphpstorm

Shortcut/feature for prepending $this automatically in Intellij/Phpstorm


Is it possible/does such feature exist that when I write an instance variable name (without $this->) it would search for a declared variable? I think it would save a bit of time not writing $this-> anytime I need to access an instance variable.


Solution

  • Currently such functionality is not available in PhpStorm.

    https://youtrack.jetbrains.com/issue/WI-19345 -- watch this ticket (star/vote/comment) to get notified on progress.


    Right now I may only suggest to write custom Live Template that would convert t[TAB] (or whatever abbreviation you desire) to $this-> with code completion popup already shown.

    Related: https://youtrack.jetbrains.com/issue/WI-551