phpstan-phpunit icon indicating copy to clipboard operation
phpstan-phpunit copied to clipboard

PHPUnit extensions and rules for PHPStan

Results 57 phpstan-phpunit issues
Sort by recently updated
recently updated
newest added

```diff -$this->assertTrue(isset($anything["foo"]), "message"); +$this->assertArrayHasKey("foo", $anything, "message"); ``` similar to `AssertSameNullExpectedRule` and others could be auto-fixable. --- [inspired by rector](https://getrector.com/blog/make-phpunit-tests-perfect-in-15-diffs)

I've got a weird issue that I can't seem to figure out. I think it is a bug in PHPStan, but I'm not certain. I appreciate if you can point...

Starting with PHPUnit 10 a dataprovider is not allowed to provide a empty array. ```php

[`AssertEqualsIsDiscouragedRule` got autofixable recently](https://github.com/phpstan/phpstan-phpunit/commit/9a9b161baee88a5f5c58d816943cff354ff233dc). we should do the same with the remaining `AssertSame*` rules

PHPUnit 12.x removed support for annotations, ~~therefore we can prevent unneccessary phpdoc parsing, when PHPUnit 12+ is detected~~ see https://phpunit.de/announcements/phpunit-11.html > Metadata > >PHPUnit 10 introduced support for PHP 8...

We have the `AssertSameWithCountRule` rule: https://github.com/phpstan/phpstan-phpunit/blob/2.0.x/src/Rules/PHPUnit/AssertSameWithCountRule.php is there a reason for not having `AssertEqualsWithCountRule` so that `$this->assertEquals(45, count($actual));` would become `$this->assertCount(45, $actual);` I can make a pull request I just...

The advice referencing `PHPUnit_Framework_MockObject_MockObject` doesn't seem to be correct as of PHPUnit 11, but `\PHPUnit\Framework\MockObject\MockObject` seems to work just as well as an intersection. Maybe its time to update the...