Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
55 lines (35 sloc) 3.47 KB

Autocomplete keys of associative arrays defined in other functions.

Jetbrains Repository: 9927-deep-assoc-completion

alt tag

Precompiled .jar (may be outdated): mirror1, mirror2.

Steps to compile plugin into a .jar follow:

  • Start creating a new project in Intelliji Idea.
  • Select Intelliji Platform Plugin.
  • Select a phpstorm installation directory as Project SDK (java version is 8).
  • Select phpstorm-deep-keys project folder as Project location.
  • In Project Structure -> Libraries add php.jar and php-openapi.jar from YourPhpStormDirectory/plugins/php/lib/.
  • In Project Structure -> Modules -> Dependencies set Scope of php-openapi to Provided.

To build a jar use Build -> Prepare Plugin ... For Deployment. To debug use Run -> Debug. Since phpstorm project takes about a minute to start, you must find Run -> Reload Changed Classes very useful for micro changes.

To use compiled .jar in your phpstorm go to Settings -> Plugins -> Install plugin from disk and select the .jar we compiled earlier.






Features description

(for detailed usage guide go to the docs

Completion from expression

When you are going to type an associative key of a variable, like in $user[''], put caret between quotes and press ctrl + space. The plugin will analyze your code, determine what keys does $user have and suggest completion. It should become pretty intuitive when plugin can determine keys, and when it can't. It still has some unsupported completion sources - i'm working on them.

The suggested completion may clash with phpstorm's built-in completion. In such case plugin keys will always be at the bottom and in bold - hit Page Down several times to get to them.

Go To Definition

Go To Definition

To go to the key definition, hover on it and press ctrl + click or put carret on it and press ctrl + b.

Completion from phpdoc

Completion from phpdoc

You can specify function argument type using @param {optionalType}? $varName = {expression}, like @param $anime = ['genre' => 'shounen', 'studio' => 'Shaft']. = is mandatory and expression must be a valid php expression. Class methods can be specified either with complete namespace like \Very\Long\Namespace\ClassName::funcName(), or with just ClassName::funcName().

Object type info in an associative array

Object type info in an associative array

Phpstorm does not highlight you method call when object in located in an associative array? Don't be sad, this plugin is exactly what you need!

Describe variable

Describe variable

To get variable/expression result structure as lousy json, put caret on it and press ctlr + alt + q.