A PHPStan extension for the patchlevel/event-sourcing library. It teaches PHPStan how aggregates work so that static analysis stays accurate on event sourced code, and it catches a common mistake before it ever reaches runtime.
composer require --dev patchlevel/event-sourcing-phpstan-extensionRegister the extension in your phpstan.neon:
includes:
- vendor/patchlevel/event-sourcing-phpstan-extension/extension.neon
That is all the configuration the extension needs. Both rules are active as soon as the file is included.
New to the extension? The getting started guide walks you through enabling it and seeing both rules in action.