Skip to content

Prophecy with interfaces leads to an error on PHPStan 2.1.3 #365

@AlexejLeinweber

Description

@AlexejLeinweber

Hello!

When i prophesyze a class with interfaces it leads to an error. Executing this without the extension yields the expected result.

Using the current versions:

"jangregor/phpstan-prophecy": "^2.0",
"phpstan/phpstan": "^2.1.3",
<?php

namespace MyBundle\Tests;

use PHPUnit\Framework\TestCase;
use Prophecy\PhpUnit\ProphecyTrait;


interface A
{

}

class InterfaceTest extends TestCase
{
    use ProphecyTrait;

    protected function setUp(): void
    {
        $this->prophecy = $this->prophesize();
        $this->prophecy->willImplement(A::class);
    }
}
 Error
 -- --------------------------------------------------------------------------------------------------------------------------------------------------------------------
     Internal error: assert($calledOnType instanceof Type\Generic\GenericObjectType) while analysing file
     /Users/aleinweber/Projekt/src/Bundle/MyBundle/Tests/InterfaceTest.php

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions