phpstan-phpunit
phpstan-phpunit copied to clipboard
PHPUnit extensions and rules for PHPStan
This pull request fixes that PHPStan failed to recognize the mock methods when calling getMockForTrait() on the mock builder. I also repaired the two failing tests of the current master....
`TestCase::getMockBuilder()` can be used with undefined classes as well. In this case, the mock system creates dummy empty class of the given name. This is used in Doctrine on some...
This rule is even more opinionated than the previous ones. If you don't think it should be included in PHPStan, I can change it and keep only the first part...
The following TestCase will cause PHPStan to report a false positive. ```php
Given this class: ```php
it would be great when phpstan could typecheck a dataprovider function against the type-signature of the methods which is using it. see this code taken from composer/semver the dataprovider will...
I'm using [Codeception's wrapper](https://github.com/Codeception/Codeception/blob/2.5/src/Codeception/Util/Shared/Asserts.php#L448-L451) of [PHPUnit's `assertInternalType`](https://github.com/sebastianbergmann/phpunit/blob/master/src/Framework/Assert.php#L1677), and thought phpstan would understand the type. Example code: ```php $feedHandle = fopen('php://temp', 'rw+'); $this->assertInternalType('resource', $feedHandle); fwrite($feedHandle, $feed); ``` Actual result: ``` Parameter...
``` $ composer show | grep phpstan phpstan/phpdoc-parser 0.4.4 PHPDoc parser with support for nul... phpstan/phpstan 0.12.50 PHPStan - PHP Static Analysis Tool phpstan/phpstan-strict-rules ``` Consider the following test: ```php
Passing a value to `assertNotEmpty`/`assertEmpty` doesn't tell phpstan that the value isn't/is empty
I have a `Collection` container class that uses generics: ```php /** * This class represents a list of models. * * @template M of AbstractModel * @extends \SplObjectStorage */ class...