DEVSENSE / phptools-docs

PHP Tools public content
Apache License 2.0
83 stars 10 forks source link

type inference bug when merging type from two branches #698

Open jakubmisek opened 1 month ago

jakubmisek commented 1 month ago
<?php

class A {
    /** @var array<string> */
    public array $methods;
}

$a = null;
if ($r) {
    if ($r instanceof A) {
        $a = $r;
    }
}

$b = $a->methods; // $b can't resolve type to string[], even through $a is A|null
image

Maybe just the tooltip is incorrect?

@trace is correct but tooltip and autocomplete not working:

image

Originally posted by @ging-dev in https://github.com/DEVSENSE/phptools-docs/issues/694#issuecomment-2415605765