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
<?phpdeclare(strict_types = 1);
class C {
publicfunctionhelloClass(): string { return'hello class'; }
}
trait T {
publicfunctionhelloTrait(): string { return'hello trait'; }
}
$mock = Mockery::mock(C::class, T::class);
$mock->makePartial();
\PHPStan\dumpType($mock);
echo$mock->helloTrait();
will output hello trait. Unfortunately, it is not supported by this extension (and seems phpstan also cannot create intersections with traits?) so the dumped type will be *NEVER* -> the $mock->helloTrait() actually not validated at all... :(
Mockery::mock(C::class)->helloUnknown(); // Call to an undefined method C&Mockery\MockInterface::helloUnknown()
Mockery::mock(C::class, T::class)->helloUnknown(); // nothing
If we are on Level 10 and doing something like Mockery::mock(C::class)->getSomething()->method(); we also will get "Cannot call method method() on mixed.".
The text was updated successfully, but these errors were encountered:
Mockery::mock()
allow to add traits into mocks:will output
hello trait
. Unfortunately, it is not supported by this extension (and seems phpstan also cannot create intersections with traits?) so the dumped type will be*NEVER*
-> the$mock->helloTrait()
actually not validated at all... :(If we are on Level 10 and doing something like
Mockery::mock(C::class)->getSomething()->method();
we also will get "Cannot call method method() on mixed.".The text was updated successfully, but these errors were encountered: