Hi,

When we use match statement with instanceof condition, PHPTool must use it to retrieve the right type.

$test = [ 'a' ];

match(true)
{
        $test instanceof \ArrayObject => myFunction($test),          // $test type equals \ArrayObject
        is_array($test) => myFunction(new \ArrayObject($test)),    // $test type equals array
};

This is only to reproduce the issue

Thank you for the fix.

    Jean-FrancoisHIVERT thank you for the test case.

    We're already handling match and a few related patters, we'll add this one as well.

      8 days later
      2 months later

      it is ok you are right, I retrieve one use case in my project and no error anymore.

      Thank you and sorry for the noise.

        Write a Reply...