Skip to content

[Regression] Inferred types #1126

@camilledejoye

Description

@camilledejoye

I forgot that I had found a regression, I reproduced it today so I put an example here in order to not forget to fix it:

<?php

namespace Test;

interface Foo
{
}

class FooBar implements Foo
{
}

class Bar
{
    private Foo $foo;

    public function __construct(Foo $foo)
    {
        $this->foo = $foo;
    }

    public function foo(): void
    {
        if (!$this->foo instanceof FooBar) {
            return;
        }

        // $this is now inferred as FooBar
    }
}

It's all in the comment, kind of really annoying 😄

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions