Describe the bug
When you have a tuple that returns an array of different types and it is hinted using the array-shape syntax. When you skip destructing values the next variable is typed incorrectly.
It seems to ignore the skipped values and starts matching the shape hints to the first destructured variable.
To Reproduce
<?php
class Test
{
/**
* @return array{0:int,1:string,2:array,3:bool}
*/
public function getData(): array
{
return [100, '100', [], true];
}
public function test(): void
{
[,,$array, $bool] = $this->getData();
// ^^^^^^ hinted as an integer
list(,,$array, $bool) = $this->getData();
// ^^^^^^ hinted as an integer
}
}
In the example above, Intelephense says that $array is an int and $bool is a string.
Expected behavior
Destructured variables are hinted properly, even when some are skipped.
Screenshots
Below should be hinted as an array:
Below should be hinted as a boolean:
Below shows hinting working properly when all values are destructured into variables:
Platform and version
MacOS: 14.3 (23D56)
Intelephense: v1.10.4
Describe the bug When you have a tuple that returns an array of different types and it is hinted using the array-shape syntax. When you skip destructing values the next variable is typed incorrectly.
It seems to ignore the skipped values and starts matching the shape hints to the first destructured variable.
To Reproduce
In the example above, Intelephense says that
$array
is anint
and$bool
is a string.Expected behavior Destructured variables are hinted properly, even when some are skipped.
Screenshots Below should be hinted as an array:
![image](https://github.com/bmewburn/vscode-intelephense/assets/1470257/3246a311-b7a2-400b-9ee9-1753f8828ab3)
Below should be hinted as a boolean:![image](https://github.com/bmewburn/vscode-intelephense/assets/1470257/1f00bbd0-9eb5-4484-a33c-2f5fc6e24fda)
Below shows hinting working properly when all values are destructured into variables:![image](https://github.com/bmewburn/vscode-intelephense/assets/1470257/e550d508-885a-4122-a3ea-27deebab2ba0)
Platform and version MacOS: 14.3 (23D56) Intelephense: v1.10.4