[Bug]: PHPStan throws error when calling `expect` on higher order test
What Happened
When I write a test in the form of:
it('...')
->expect(fn () => ...))
->toBeTrue();
PHPStan fails with the following message:
Call to an undefined method Pest\PendingCalls\TestCall::expect().
How to Reproduce
see above
Sample Repository
No response
Pest Version
2.24.1
PHP Version
8.2.10
Operation System
Linux
Notes
No response
Still a problem in PestPHP 3 unfortunately :(
As a bandaid, I would suggest putting a // @phpstan-ignore-next-line above the offending code.
Read more: https://phpstan.org/user-guide/ignoring-errors#ignoring-in-configuration-file
If it's a lot of code, you can ignore a regex of the issue in the configuration file (see: https://phpstan.org/user-guide/ignoring-errors#ignoring-in-configuration-file).
Thanks, but I'm aware that I can ignore the errors. Actually, I've just stopped analyzing test code with PHPStan, it's not really needed given that it's tested anyway
@calebdw would love if you could come up with better phpstan experience for pest.