Mockery or PHPUnit with Phony), this package could improve type safety in test files.composer require and PHPStan config update. No Laravel service provider or facade changes are needed.php-phony/php-phony), adding another dependency to the project.mockBuilder, partialMock).createMock())?mockery/mockery-phpstan)?mockery/mockery-phpstan instead.eloquent/phpstan-phony and php-phony/php-phony to composer.json (dev dependencies).phpstan.neon to include the extension:
includes:
- vendor/eloquent/phpstan-phony/phony.neon
| Component | Compatibility Notes |
|---|---|
| PHP Version | Requires 7.2+ (PHPStan 0.12.x/1.x). PHP 8.0+ recommended. |
| PHPStan | Works with 0.12.x or 1.x. Older versions unsupported. |
| Phony | Must be installed (php-phony/php-phony). |
| Testing Frameworks | Primarily PHPUnit. PestPHP/Laravel helpers may need manual verification. |
| Laravel | No direct impact—purely a dev-time tool. |
php-phony/php-phony → eloquent/phpstan-phony → Update PHPStan config.mock(ClassA::class)->method()).mockBuilder, partialMock).php-phony/php-phony + eloquent/phpstan-phony).| Failure Scenario | Impact | Mitigation Strategy |
|---|---|---|
| PHPStan/Phony incompatibility | False positives/negatives flood tests. | Disable rules selectively or revert to Mockery’s extension. |
| Archived package breaks | No updates for new PHPStan/Phony versions. | Fork the repo or switch to an actively maintained alternative. |
| Phony adoption resistance | Developers prefer existing mocking tools (Mockery/Pest). | Pilot with a small team or limit scope to specific test suites. |
| PHP version upgrade | Package drops support for current PHP version. | Pin to a compatible version |
How can I help you explore Laravel packages today?