PHPStan Mockery extension

Installs: 692 369

Dependents: 181

Suggesters: 1

Security: 0

Stars: 36

Watchers: 5

Forks: 11

Open Issues: 6


0.12.7 2020-07-21 14:43 UTC

This package is auto-updated.

Last update: 2020-11-21 12:04:42 UTC


Build Status Latest Stable Version License

This extension provides the following features:

  • Interprets Foo|\Mockery\MockInterface in phpDoc so that it results in an intersection type instead of a union type.
  • Mockery::mock() and 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.
  • shouldReceive(), allows() and 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!

Manual installation

If you don't want to use phpstan/extension-installer, include extension.neon in your project's PHPStan config:

    - vendor/phpstan/phpstan-mockery/extension.neon