diff --git a/composer.json b/composer.json index 6e73891..8d179d7 100644 --- a/composer.json +++ b/composer.json @@ -22,7 +22,7 @@ }, "require-dev": { "orchestra/testbench": "^8.0 || ^9.0 || ^10.0 || ^11.0", - "pestphp/pest": "^2.0 || ^3.0", + "pestphp/pest": "^2.0 || ^3.0 || ^4.0 || ^5.3.4", "phpstan/phpstan": "^1.11 || ^2.0" }, "config": { diff --git a/phpstan.neon b/phpstan.neon index 3c5177a..bc123c6 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -9,3 +9,10 @@ parameters: - tests/fixtures/* ignoreErrors: - '#Dummy not found#' + # Pest <= 3 leaves $this untyped inside test closures, so PHPStan flags + # $this->artisan() there; Pest 4+ types it. Ignore it without reporting + # the ignore as unmatched, so analysis passes on every Pest we allow. + - + message: '#(artisan\(\)|\$this)#' + path: tests/Feature/Commands/ErrorsCommandTest.php + reportUnmatched: false diff --git a/tests/Feature/Commands/ErrorsCommandTest.php b/tests/Feature/Commands/ErrorsCommandTest.php index 1b8782b..0fe020b 100644 --- a/tests/Feature/Commands/ErrorsCommandTest.php +++ b/tests/Feature/Commands/ErrorsCommandTest.php @@ -3,7 +3,7 @@ use Archetype\Facades\PHPFile; it('outputs no errors on a default laravel installation', function() { - $this->artisan('archetype:errors') // @phpstan-ignore-line + $this->artisan('archetype:errors') ->assertSuccessful() ->expectsOutput("No errors found!"); }); @@ -12,7 +12,7 @@ $path = PHPFile::load('app/Models/User.php')->input->absolutePath(); file_put_contents($path, 'artisan('archetype:errors') // @phpstan-ignore-line + $this->artisan('archetype:errors') ->assertSuccessful() ->expectsTable([ 'path',