friendsofmago / mago-mockery
Mockery support for the Mago static analyzer.
v0.1.0
2026-12-03 14:10 UTC
Requires
- php: ^8.1
- composer-runtime-api: ^2.0
- ext-tokenizer: *
- carthage-software/mago: ^1.60.2
Requires (Dev)
- mockery/mockery: ^1.6
- phpunit/phpunit: ^10.5 || ^11.5 || ^12.0 || ^13.0
Suggests
None
Provides
None
Conflicts
None
Replaces
- alfredbez/mago-mockery: v0.1.0
README
Mockery 1.6 static analysis extension for Mago. It types mocks as the mocked class intersected with Mockery\MockInterface, so mago analyze checks calls on a mock like calls on the real class.
Read the full documentation at friendsofmago.github.io/mago-mockery.
Install
You need PHP 8.1 or newer, Mago ^1.60.2, and Mockery ^1.6.
composer require --dev friendsofmago/mago-mockery
Register Mockery's library path and the bundled worker in mago.toml:
[source] includes = ["vendor/mockery/mockery/library"] [extension-hosts.mockery] command = ["php", "-d", "xdebug.mode=off", "-d", "pcov.enabled=0", "-d", "memory_limit=512M", "vendor/bin/mago-mockery-worker"] workers = 1 # Optional. Default is off. Set to "1" to report unknown mocked method names. # environment = { MAGO_MOCKERY_STRICT_METHODS = "1" }
Validate the worker and run the analyzer:
vendor/bin/mago extension validate vendor/bin/mago analyze
Documentation
- Install and Configuration
- The worker and Composition
- Mocks and spies, Expectations, and Named mocks
- Strict mode and Diagnostics
- Development and Limitations
License
MIT. See LICENSE.