Sharing is caring!

Autocomplete keys of associative arrays defined in other functions.

Jetbrains Repository: 9927-deep-assoc-completion

Features description

(a bit more relaxed usage guide can be found here)

  • 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.
  • 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

    See formats description

    Completion from phpdoc

    You can specify function argument type using @param SomeType $varName = Some::phpExpression(), 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().

You can specify @return array keys as well:

 * @return array [
 *     'success' => true,
 *     'formObject' => new Form,
 *     'errors' => [],
 * ]
public static function processForm($arr);

Completion from @return phpdoc

  • Object type info in an associative array

    Object type info in an associative array

    Phpstorm does not give you method name completion when object is located in an associative array? Don’t be sad, this plugin is exactly what you need!

  • To N-th Test

    To N-th Test

Did you ever want an ability to find out which exactly test case does phpunit mean by the with data set "17" without manually counting them?

You can find this feature in Tools -> deep-assoc-completion -> To N-th Test. It moves your caret to the test case with the order you specify in the popup. If there are multiple @dataProvider functions in the file, the function caret is currently in will be used.

This action will work correctly only on more or less straightforward @dataProvider-s.

  • String value completion

    String Value Completion

    String Value Completion

  • Transpile to JS code (not related to completion anyhow, but whatever)

    Transpile to JS code

Completion sources

  • Argument type resolution based on what was passed to the function

    Keep Track of What is Passed to the Function

    Infer type based on function usage when inside function

    Extremely useful for small private helper functions – you don’t need to document args in each of them to get completion.

  • Keys from PDOStatement::fetch() if your Database is connected to IDEA

    PDO completion

  • All built-in array functions I could find are supported


    static key built-ins

Subscribe to the Newsletter

Get our latest news,tutorials,guides,tips & deals delivered to your inbox.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.