Vscode-intelephense: Destructuring tuple in array makes variable type `unset`

Created on 4 Dec 2019  ·  3Comments  ·  Source: bmewburn/vscode-intelephense

Describe the bug

When using destructuring syntax of PHP, the variables gets unset type.

To Reproduce

Please consider the following code

function get_some_array() : array {
    return [
        '123',
        false,
        'stuff',
    ];
}

[ $one, $two, $three ] = get_some_array();
// type of $one is unset ❌
// type of $two is unset ❌
// type of $three is unset ❌

$all = get_some_array();

$all_one = $all[0];
// type of $all_one is mixed ✅

Expected behavior

$one, $two and $three should have mixed type, not unset type.

Platform and version

  • OS: Mojave
  • Intelephense: 1.3.1
bug

Most helpful comment

@swashata I meant by extension

All 3 comments

Seems like this is not implemented in extension https://wiki.php.net/rfc/short_list_syntax#proposal

@KapitanOczywisty This is already implemented in PHP 7.1

@swashata I meant by extension

Was this page helpful?
0 / 5 - 0 ratings

Related issues

superadmini picture superadmini  ·  4Comments

zlianon picture zlianon  ·  4Comments

Ilyes512 picture Ilyes512  ·  3Comments

pseudoanime picture pseudoanime  ·  3Comments

nn-hh picture nn-hh  ·  3Comments