phpstan / phpstan-mockery
PHPStan Mockery extension
Installs: 12 373 975
Dependents: 563
Suggesters: 2
Security: 0
Stars: 84
Watchers: 5
Forks: 19
Open Issues: 10
Type:phpstan-extension
Requires
- php: ^7.2 || ^8.0
- phpstan/phpstan: ^1.12
Requires (Dev)
- mockery/mockery: ^1.6.11
- nikic/php-parser: ^4.13.0
- php-parallel-lint/php-parallel-lint: ^1.2
- phpstan/phpstan-phpunit: ^1.4
- phpstan/phpstan-strict-rules: ^1.6
- phpunit/phpunit: ^9.5
This package is auto-updated.
Last update: 2024-10-14 03:18:25 UTC
README
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()
andMockery::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()
andexpects()
methods can be called on the mock object and they work as expected.
Installation
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:
includes:
- vendor/phpstan/phpstan-mockery/extension.neon