如何让 PhpStorm 建议/自动完成数组键

How to make PhpStorm suggest / autocomplete array keys

<?php


function test(){
    return array(
        'one' => 1,
        'two' => 2
    );
}

$test = test();

echo $test[''];

我想将光标放在单引号之间的最后一行,并让它显示 onetwo。我该怎么做?

下面的工作正常,那么为什么它不能在函数内部工作:

    $test = array(
        'one' => 1,
        'two' => 2
    );



    echo $test[''];
// Suggests 'one' and 'two'

The below works fine, so why doesn't it work inside of a function:

因为它仅针对 variables/class 个属性实施。

How can I do this?

只需安装 deep-assoc-completion 插件。它甚至可以做更多(例如帮助完成数组参数——可以使用哪些键(当然,如果您费心描述这些键)等)。