You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Feature request: Validate with and willReturn types on mocks #321
Given the following example, i'd expect PHPStan to report the following issues:
The parameter types in with don't match the function signature
The return value does not match the function signature.
This would be usefull for projects with a large test suite, where you do a refactor of a method that is used in a lot of places. It would allow to fix these issues before running the entire test suite to get the errors from PHPUnit.
classT1 {
publicfunctionmyMethod(int$a, string$b): int {
return3;
}
}
class T1Test extends TestCase {
publicfunctiontestStuff(): void {
$mock = $this->createMock(T1::class);
$mock->expects($this->once())
->method('myMethod')
->with(
new \stdClass(),
new \stdClass(),
)->willReturn(true);
}
}
Activity