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 common mistakes before they ever reach runtime.
composer require --dev patchlevel/event-sourcing-phpstan-extensionIf you use phpstan/extension-installer, the extension is registered automatically and you are done. Otherwise register it in your phpstan.neon:
includes:
- vendor/patchlevel/event-sourcing-phpstan-extension/extension.neonThat is all the configuration the extension needs. All checks are active as soon as the extension is registered, and single rules can be deactivated through the configuration parameters.
New to the extension? The getting started guide walks you through enabling it and seeing both rules in action.