PHPStan Mockery extension
This extension provides the following features:
Foo|\Mockery\MockInterfacein phpDoc so that it results in an intersection type instead of a union type.
Mockery::spy()return an intersection type (see the detailed explanation of intersection types) so that the returned object can be used as both the mock object and the mocked class object.
expects()methods can be called on the mock object and they work as expected.
To use this extension, require it in Composer:
composer require --dev phpstan/phpstan-mockery
If you also install phpstan/extension-installer then you're all set!
If you don't want to use
phpstan/extension-installer, include extension.neon in your project's PHPStan config:
includes: - vendor/phpstan/phpstan-mockery/extension.neon