You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[2.x] PHPStan fails in extensions depending on flarum/tags: Flarum\Gdpr\Events\Erased not found #5194
It's fine at runtime, since the closure only runs when GDPR is enabled. But flarum/phpstan analyses the dependency's extend.php, and the ::class reference fails when flarum/gdpr isn't installed. extensions/messages/extend.php uses the same pattern, so extensions depending on flarum/messages are affected too.
Steps to Reproduce
Take an extension that requires flarum/tags and runs composer analyse:phpstan (e.g. fof/categories).
composer update flarum/tags to get v2.0.1.
Run PHPStan.
Expected Behavior
Optional integrations in a bundled extension's extend.php shouldn't break static analysis for extensions that depend on it.
Possible Solution
Reference the event by string in tags and messages ('Flarum\Gdpr\Events\Erased'). Extend\Event::listen() accepts a class name string, and PHPStan won't try to resolve it.
Or handle classes referenced inside whenExtensionEnabled() closures in flarum/phpstan.
Workaround for now: add flarum/gdpr to the extension's require-dev.
Activity