bmewburn / vscode-intelephense

PHP intellisense for Visual Studio Code
https://intelephense.com
Other
1.6k stars 93 forks source link

Intersected types should produce intersected property type #3003

Open bmewburn opened 1 month ago

bmewburn commented 1 month ago
class A
{
    public int $a;
    public array $other;
}
class B
{
    public int $b;
}

/** @param A&object{other: array<B>} $x */
function hello(object $x): void
{
    $other = $x->other;
}

$x->other is array<B>, but intelephense only display array. Phpstan properly detect array<B>

Originally posted by @momala454 in https://github.com/bmewburn/vscode-intelephense/issues/2973#issuecomment-2285560103

momala454 commented 1 month ago

Due to missing backtick in my message, the last sentence should be read instead :

Phpstan properly detect array<B>