mirror of
https://github.com/danog/psalm.git
synced 2024-12-02 09:37:59 +01:00
782 B
782 B
Plugins
Psalm can be extended through plugins to find domain-specific issues.
All plugins must extend Psalm\Plugin
and return an instance of themselves e.g.
<?php
class SomePlugin extends \Psalm\Plugin
{
}
return new SomePlugin;
Psalm\Plugin
offers two methods that you can override:
afterStatementsCheck
- called after Psalm evaluates each statementafterExpressionCheck
- called after Psalm evaluates each expression
An example plugin that checks class references in strings is provided here.
To ensure your plugin runs when Psalm does, add it to your config:
<plugins>
<plugin filename="src/plugins/SomePlugin.php" />
</plugins>