Skip to content

Instantly share code, notes, and snippets.

@orklah
orklah / Plugin.php
Created Mar 14, 2021
Psalm plugin to detect dynamic calls to static methods
View Plugin.php
<?php
use Psalm\CodeLocation;
use Psalm\Issue\CodeIssue;
use Psalm\Issue\PluginIssue;
use Psalm\IssueBuffer;
use Psalm\Plugin\EventHandler\AfterMethodCallAnalysisInterface;
use Psalm\Plugin\EventHandler\Event\AfterMethodCallAnalysisEvent;
use Psalm\Plugin\PluginEntryPointInterface;
use Psalm\Plugin\RegistrationInterface;
@orklah
orklah / Plugin.php
Last active Apr 1, 2021
Psalm plugin to add "?" to nullable params
View Plugin.php
<?php
use Psalm\Plugin\EventHandler\AfterFunctionLikeAnalysisInterface;
use Psalm\Plugin\PluginEntryPointInterface;
use Psalm\Plugin\RegistrationInterface;
use Psalm\Type\Union;
class NullableParam implements PluginEntryPointInterface, AfterFunctionLikeAnalysisInterface
{
public function __invoke(RegistrationInterface $psalm, ?SimpleXMLElement $config = null): void