bmewburn / vscode-intelephense

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

Intersected types should produce intersected property type #3003

Open bmewburn opened 3 months ago

bmewburn commented 3 months 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 3 months ago

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

Phpstan properly detect array<B>