-
Notifications
You must be signed in to change notification settings - Fork 50
Open
Description
Feature request
In the following scenario:
function test_exception_state(): void {
$myService = new MyService();
try {
$myService->doSomethingWrong();
// missing: $this->fail();
} catch (MyException $exception) {
$this->assertSame('Custom message', $exception->getMessage());
$this->assertSame('Another property', $exception->smthNotTypicalOfException);
}
}Essentially, a case where we want to do an explicit try/catch because expectExceptionObject() doesn't cut it (want to catch a Throwable instead of test some state of the exception besides message/code), it is easy to forget a fail() statement and leading to a risky test.
Maybe it leading as a risky is fine... But maybe it's a kinda of issue that PHPStan could detect & report. Just an idea.
Did PHPStan help you today? Did it make you happy in any way?
Today it did not help, but I didn't run it either so cannot blame it :) I like PHPStan otherwise!
Metadata
Metadata
Assignees
Labels
No labels