You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
<?phpclassTest
{
/** * @return array{0:int,1:string,2:array,3:bool} */publicfunctiongetData(): array
{
return [100, '100', [], true];
}
publicfunctiontest(): void
{
[,,$array, $bool] = $this->getData();
// ^^^^^^ hinted as an integerlist(,,$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
The text was updated successfully, but these errors were encountered:
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:
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
The text was updated successfully, but these errors were encountered: