phpstan: Unresolvable type error in PHPUnit\assertSame when the same enum is passed for second time

Bug report

I’m getting following error in a phpunit test that looks like this. Using bleeding edge on 1.7.1, assuming this is a bug of https://github.com/phpstan/phpstan-src/pull/1319. Using phpstan/phpstan-phpunit version 1.1.1

Code snippet that reproduces the problem

self::assertSame(SomeEnum::SomeCase, $order->getEnum()); // no error here

$this->someMethod($order);

self::assertSame(SomeEnum::SomeCase, $order->getEnum()); // Parameter #1 $expected of static method PHPUnit\Framework\Assert::assertSame() contains unresolvable type.

Expected output

No error

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 15 (10 by maintainers)

Most upvoted comments

Hey @rvanvelzen, I just encountered this issue as well, and managed to reproduce it in an as-small-as-possible-yet-fully-functional repository! šŸŽ‰

https://github.com/gnutix/phpstan-assertsame-unresolvable-type-bug/pull/2/files