phpstan-phpunit
phpstan-phpunit copied to clipboard
PHPUnit extensions and rules for PHPStan
### Feature request we should error about dataProvider annotations without a corresponding method https://phpstan.org/r/9870d218-28c5-4636-88e9-85f73ce78bc9 ### Did PHPStan help you today? Did it make you happy in any way? _No response_
### Feature request Hi ! In order to enforce and clarify the usage of test doubles for everyone, I would like to know if you think it would be beneficial...
assertStringStartsWith after assertNotEmpty fails with error "Parameter #1 $prefix of method PHPUnit\Framework\Assert::assertStringStartsWith() expects non-empty-string', while the string cannot be empty due to the `assertNotEmpty` call. ```php
Continuation of #214 What if we introduce optional path parameter to phpunit.xml in the same manner as `containerXmlPath` in `phpstan/phpstan-symfony` package? Then we can analyse `suffix` option for each directory...
* `phpstan/phpstan` v2.1.13 * `phpstan/phpstan-phpunit` v2.0.6 --- Given the following trait: ```php trait MockServerTrait { private static ?MockWebServer\MockWebServer $mockServer = null; protected static function startMockServer( string $host = '127.0.0.1', int...
- when `#[RequiresPhp]` is lower then the phpstan analysis version, reports a test requirement as beeing always false - when `#[RequiresPhp]` contains a version which is not parse-able, reports a...
closes https://github.com/phpstan/phpstan-phpunit/issues/249
Allegedly PHPUnit 12 warns about this. At the same time, PHPUnit 12.4 adds `validateArgumentCount` parameter to DataProvider attribute that opts out of this error. /cc @staabm
I think it would be helpful if we could error in tests which trigger a global side-effect like e.g. - `error_reporting(E_ALL)` when not restored to the old value within the...
### Feature request In the following scenario: ```php function test_exception_state(): void { $myService = new MyService(); try { $myService->doSomethingWrong(); // missing: $this->fail(); } catch (MyException $exception) { $this->assertSame('Custom message', $exception->getMessage());...