Skip to content

Instantly share code, notes, and snippets.

@orklah
orklah / Plugin.php
Created March 14, 2021 22:52
Psalm plugin to detect dynamic calls to static methods
<?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 April 1, 2021 18:41
Psalm plugin to add "?" to nullable params
<?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