Phpstan
favorisiert
PHP-Paket
PHPStan - PHP Static Analysis Tool
PHPStan Mockery extension
This extension provides the following features:
Mockery::mock(), Mockery::spy(), and Mockery::namedMock() return an intersection type (e.g. Foo&MockInterface) so that the mock can be used as both the mocked class and a mock object. See the detailed explanation of intersection types.Foo|\Mockery\MockInterface in phpDoc so that it results in an intersection type instead of a union type. This can be disabled by setting the mockery.convertUnionToIntersectionType parameter to false.shouldReceive(), shouldNotReceive(), shouldHaveReceived(), shouldNotHaveReceived(), allows(), and expects() methods are understood on mock objects.makePartial() and shouldAllowMockingProtectedMethods() return static, preserving the intersection type for chained calls.alias:) and overload (overload:) mock prefixes are handled.ClassName[methodName]) is supported.mock() are handled correctly.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
PHPStan - PHP Static Analysis Tool
A PHP parser written in PHP
Modern, Crazy Fast, Ridiculously Easy and Amazingly Powerful Flat-File CMS
Mockery is a simple yet flexible PHP mock object framework
Neue Version verfügbar.