phpstan / phpstan-phpunit

PHPUnit extensions and rules for PHPStan
MIT License
468 stars 46 forks source link

`assertContains` always claiming it'll return true #193

Closed simon-tma closed 1 year ago

simon-tma commented 1 year ago

Reproduction case:

        $this->assertContains('not in the list', new \ArrayObject([1]));

This generates the error:

Call to method PHPUnit\Framework\Assert::assertContains() with 'not in the list' and ArrayObject<int, int> will always evaluate to true.

This is obviously incorrect and appears to happen whenever $haystack is a \Traversable rather than an array.

axlon commented 1 year ago

Seems to be caused by https://github.com/phpstan/phpstan-phpunit/pull/191

pscheit commented 1 year ago

maybe @villfa you can have a lookt at this? 😬

github-actions[bot] commented 1 year ago

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.