From 2e24a16cbbc5a11ded5d1c8b3190cf73f27bb4a3 Mon Sep 17 00:00:00 2001 From: Bruce Weirdan Date: Mon, 3 Jan 2022 18:18:44 +0200 Subject: [PATCH 1/2] Dropped legacy plugin API --- psalm.xml.dist | 12 - src/Psalm/Internal/EventDispatcher.php | 264 ++---------------- .../Provider/FunctionExistenceProvider.php | 47 +--- .../Provider/FunctionParamsProvider.php | 64 +---- .../Provider/FunctionReturnTypeProvider.php | 57 +--- .../Provider/MethodExistenceProvider.php | 61 +--- .../Provider/MethodParamsProvider.php | 58 +--- .../Provider/MethodReturnTypeProvider.php | 68 +---- .../Provider/MethodVisibilityProvider.php | 55 +--- .../Provider/PropertyExistenceProvider.php | 58 +--- .../Provider/PropertyTypeProvider.php | 55 +--- .../Provider/PropertyVisibilityProvider.php | 68 +---- src/Psalm/IssueBuffer.php | 4 +- .../Plugin/Hook/AfterAnalysisInterface.php | 23 -- .../Hook/AfterClassLikeAnalysisInterface.php | 29 -- .../AfterClassLikeExistenceCheckInterface.php | 23 -- .../Hook/AfterClassLikeVisitInterface.php | 27 -- .../Hook/AfterCodebasePopulatedInterface.php | 17 -- ...fterEveryFunctionCallAnalysisInterface.php | 20 -- .../Hook/AfterExpressionAnalysisInterface.php | 28 -- .../Hook/AfterFileAnalysisInterface.php | 22 -- .../AfterFunctionCallAnalysisInterface.php | 28 -- .../AfterFunctionLikeAnalysisInterface.php | 28 -- .../Hook/AfterMethodCallAnalysisInterface.php | 32 --- .../Hook/AfterStatementAnalysisInterface.php | 28 -- .../Hook/BeforeFileAnalysisInterface.php | 22 -- .../FunctionExistenceProviderInterface.php | 25 -- .../Hook/FunctionParamsProviderInterface.php | 31 -- .../FunctionReturnTypeProviderInterface.php | 33 --- .../Hook/MethodExistenceProviderInterface.php | 27 -- .../Hook/MethodParamsProviderInterface.php | 32 --- .../MethodReturnTypeProviderInterface.php | 40 --- .../MethodVisibilityProviderInterface.php | 24 -- .../PropertyExistenceProviderInterface.php | 31 -- .../Hook/PropertyTypeProviderInterface.php | 24 -- .../PropertyVisibilityProviderInterface.php | 25 -- .../Hook/StringInterpreterInterface.php | 16 -- src/Psalm/PluginRegistrationSocket.php | 50 +--- tests/Config/PluginTest.php | 89 ------ 39 files changed, 56 insertions(+), 1589 deletions(-) delete mode 100644 src/Psalm/Plugin/Hook/AfterAnalysisInterface.php delete mode 100644 src/Psalm/Plugin/Hook/AfterClassLikeAnalysisInterface.php delete mode 100644 src/Psalm/Plugin/Hook/AfterClassLikeExistenceCheckInterface.php delete mode 100644 src/Psalm/Plugin/Hook/AfterClassLikeVisitInterface.php delete mode 100644 src/Psalm/Plugin/Hook/AfterCodebasePopulatedInterface.php delete mode 100644 src/Psalm/Plugin/Hook/AfterEveryFunctionCallAnalysisInterface.php delete mode 100644 src/Psalm/Plugin/Hook/AfterExpressionAnalysisInterface.php delete mode 100644 src/Psalm/Plugin/Hook/AfterFileAnalysisInterface.php delete mode 100644 src/Psalm/Plugin/Hook/AfterFunctionCallAnalysisInterface.php delete mode 100644 src/Psalm/Plugin/Hook/AfterFunctionLikeAnalysisInterface.php delete mode 100644 src/Psalm/Plugin/Hook/AfterMethodCallAnalysisInterface.php delete mode 100644 src/Psalm/Plugin/Hook/AfterStatementAnalysisInterface.php delete mode 100644 src/Psalm/Plugin/Hook/BeforeFileAnalysisInterface.php delete mode 100644 src/Psalm/Plugin/Hook/FunctionExistenceProviderInterface.php delete mode 100644 src/Psalm/Plugin/Hook/FunctionParamsProviderInterface.php delete mode 100644 src/Psalm/Plugin/Hook/FunctionReturnTypeProviderInterface.php delete mode 100644 src/Psalm/Plugin/Hook/MethodExistenceProviderInterface.php delete mode 100644 src/Psalm/Plugin/Hook/MethodParamsProviderInterface.php delete mode 100644 src/Psalm/Plugin/Hook/MethodReturnTypeProviderInterface.php delete mode 100644 src/Psalm/Plugin/Hook/MethodVisibilityProviderInterface.php delete mode 100644 src/Psalm/Plugin/Hook/PropertyExistenceProviderInterface.php delete mode 100644 src/Psalm/Plugin/Hook/PropertyTypeProviderInterface.php delete mode 100644 src/Psalm/Plugin/Hook/PropertyVisibilityProviderInterface.php delete mode 100644 src/Psalm/Plugin/Hook/StringInterpreterInterface.php diff --git a/psalm.xml.dist b/psalm.xml.dist index bdbaaab6da5..0343b7cb1fc 100644 --- a/psalm.xml.dist +++ b/psalm.xml.dist @@ -62,17 +62,6 @@ - - - - - - - - - - - @@ -92,7 +81,6 @@ - diff --git a/src/Psalm/Internal/EventDispatcher.php b/src/Psalm/Internal/EventDispatcher.php index 3d0791f6c20..29e8067490d 100644 --- a/src/Psalm/Internal/EventDispatcher.php +++ b/src/Psalm/Internal/EventDispatcher.php @@ -33,20 +33,6 @@ use Psalm\Plugin\EventHandler\Event\StringInterpreterEvent; use Psalm\Plugin\EventHandler\RemoveTaintsInterface; use Psalm\Plugin\EventHandler\StringInterpreterInterface; -use Psalm\Plugin\Hook\AfterAnalysisInterface as LegacyAfterAnalysisInterface; -use Psalm\Plugin\Hook\AfterClassLikeAnalysisInterface as LegacyAfterClassLikeAnalysisInterface; -use Psalm\Plugin\Hook\AfterClassLikeExistenceCheckInterface as LegacyAfterClassLikeExistenceCheckInterface; -use Psalm\Plugin\Hook\AfterClassLikeVisitInterface as LegacyAfterClassLikeVisitInterface; -use Psalm\Plugin\Hook\AfterCodebasePopulatedInterface as LegacyAfterCodebasePopulatedInterface; -use Psalm\Plugin\Hook\AfterEveryFunctionCallAnalysisInterface as LegacyAfterEveryFunctionCallAnalysisInterface; -use Psalm\Plugin\Hook\AfterExpressionAnalysisInterface as LegacyAfterExpressionAnalysisInterface; -use Psalm\Plugin\Hook\AfterFileAnalysisInterface as LegacyAfterFileAnalysisInterface; -use Psalm\Plugin\Hook\AfterFunctionCallAnalysisInterface as LegacyAfterFunctionCallAnalysisInterface; -use Psalm\Plugin\Hook\AfterFunctionLikeAnalysisInterface as LegacyAfterFunctionLikeAnalysisInterface; -use Psalm\Plugin\Hook\AfterMethodCallAnalysisInterface as LegacyAfterMethodCallAnalysisInterface; -use Psalm\Plugin\Hook\AfterStatementAnalysisInterface as LegacyAfterStatementAnalysisInterface; -use Psalm\Plugin\Hook\BeforeFileAnalysisInterface as LegacyBeforeFileAnalysisInterface; -use Psalm\Plugin\Hook\StringInterpreterInterface as LegacyStringInterpreterInterface; use Psalm\Type\Atomic\TLiteralString; use function array_merge; @@ -64,8 +50,6 @@ class EventDispatcher * @var list> */ private $after_method_checks = []; - /** @var list> */ - private $legacy_after_method_checks = []; /** * Static methods to be called after project function checks have completed @@ -77,8 +61,6 @@ class EventDispatcher * @var list> */ public $after_function_checks = []; - /** @var list> */ - public $legacy_after_function_checks = []; /** * Static methods to be called after every function call @@ -90,8 +72,6 @@ class EventDispatcher * @var list> */ public $after_every_function_checks = []; - /** @var list> */ - public $legacy_after_every_function_checks = []; /** * Static methods to be called after expression checks have completed @@ -99,8 +79,6 @@ class EventDispatcher * @var list> */ public $after_expression_checks = []; - /** @var list> */ - public $legacy_after_expression_checks = []; /** * Static methods to be called after statement checks have completed @@ -108,8 +86,6 @@ class EventDispatcher * @var list> */ public $after_statement_checks = []; - /** @var list> */ - public $legacy_after_statement_checks = []; /** * Static methods to be called after method checks have completed @@ -117,8 +93,6 @@ class EventDispatcher * @var list> */ public $string_interpreters = []; - /** @var list> */ - public $legacy_string_interpreters = []; /** * Static methods to be called after classlike exists checks have completed @@ -126,8 +100,6 @@ class EventDispatcher * @var list> */ public $after_classlike_exists_checks = []; - /** @var list> */ - public $legacy_after_classlike_exists_checks = []; /** * Static methods to be called after classlike checks have completed @@ -135,8 +107,6 @@ class EventDispatcher * @var list> */ public $after_classlike_checks = []; - /** @var list> */ - public $legacy_after_classlike_checks = []; /** * Static methods to be called after classlikes have been scanned @@ -144,8 +114,6 @@ class EventDispatcher * @var list> */ private $after_visit_classlikes = []; - /** @var list> */ - private $legacy_after_visit_classlikes = []; /** * Static methods to be called after codebase has been populated @@ -153,8 +121,6 @@ class EventDispatcher * @var list> */ public $after_codebase_populated = []; - /** @var list> */ - public $legacy_after_codebase_populated = []; /** * Static methods to be called after codebase has been populated @@ -162,8 +128,6 @@ class EventDispatcher * @var list> */ public $after_analysis = []; - /** @var list> */ - public $legacy_after_analysis = []; /** * Static methods to be called after a file has been analyzed @@ -171,8 +135,6 @@ class EventDispatcher * @var list> */ public $after_file_checks = []; - /** @var list> */ - public $legacy_after_file_checks = []; /** * Static methods to be called before a file is analyzed @@ -180,8 +142,6 @@ class EventDispatcher * @var list> */ public $before_file_checks = []; - /** @var list> */ - public $legacy_before_file_checks = []; /** * Static methods to be called after functionlike checks have completed @@ -189,8 +149,6 @@ class EventDispatcher * @var list> */ public $after_functionlike_checks = []; - /** @var list> */ - public $legacy_after_functionlike_checks = []; /** * Static methods to be called to see if taints should be added @@ -211,87 +169,59 @@ class EventDispatcher */ public function registerClass(string $class): void { - if (is_subclass_of($class, LegacyAfterMethodCallAnalysisInterface::class)) { - $this->legacy_after_method_checks[] = $class; - } elseif (is_subclass_of($class, AfterMethodCallAnalysisInterface::class)) { + if (is_subclass_of($class, AfterMethodCallAnalysisInterface::class)) { $this->after_method_checks[] = $class; } - if (is_subclass_of($class, LegacyAfterFunctionCallAnalysisInterface::class)) { - $this->legacy_after_function_checks[] = $class; - } elseif (is_subclass_of($class, AfterFunctionCallAnalysisInterface::class)) { + if (is_subclass_of($class, AfterFunctionCallAnalysisInterface::class)) { $this->after_function_checks[] = $class; } - if (is_subclass_of($class, LegacyAfterEveryFunctionCallAnalysisInterface::class)) { - $this->legacy_after_every_function_checks[] = $class; - } elseif (is_subclass_of($class, AfterEveryFunctionCallAnalysisInterface::class)) { + if (is_subclass_of($class, AfterEveryFunctionCallAnalysisInterface::class)) { $this->after_every_function_checks[] = $class; } - if (is_subclass_of($class, LegacyAfterExpressionAnalysisInterface::class)) { - $this->legacy_after_expression_checks[] = $class; - } elseif (is_subclass_of($class, AfterExpressionAnalysisInterface::class)) { + if (is_subclass_of($class, AfterExpressionAnalysisInterface::class)) { $this->after_expression_checks[] = $class; } - if (is_subclass_of($class, LegacyAfterStatementAnalysisInterface::class)) { - $this->legacy_after_statement_checks[] = $class; - } elseif (is_subclass_of($class, AfterStatementAnalysisInterface::class)) { + if (is_subclass_of($class, AfterStatementAnalysisInterface::class)) { $this->after_statement_checks[] = $class; } - if (is_subclass_of($class, LegacyStringInterpreterInterface::class)) { - $this->legacy_string_interpreters[] = $class; - } elseif (is_subclass_of($class, StringInterpreterInterface::class)) { + if (is_subclass_of($class, StringInterpreterInterface::class)) { $this->string_interpreters[] = $class; } - if (is_subclass_of($class, LegacyAfterClassLikeExistenceCheckInterface::class)) { - $this->legacy_after_classlike_exists_checks[] = $class; - } elseif (is_subclass_of($class, AfterClassLikeExistenceCheckInterface::class)) { + if (is_subclass_of($class, AfterClassLikeExistenceCheckInterface::class)) { $this->after_classlike_exists_checks[] = $class; } - if (is_subclass_of($class, LegacyAfterClassLikeAnalysisInterface::class)) { - $this->legacy_after_classlike_checks[] = $class; - } elseif (is_subclass_of($class, AfterClassLikeAnalysisInterface::class)) { + if (is_subclass_of($class, AfterClassLikeAnalysisInterface::class)) { $this->after_classlike_checks[] = $class; } - if (is_subclass_of($class, LegacyAfterClassLikeVisitInterface::class)) { - $this->legacy_after_visit_classlikes[] = $class; - } elseif (is_subclass_of($class, AfterClassLikeVisitInterface::class)) { + if (is_subclass_of($class, AfterClassLikeVisitInterface::class)) { $this->after_visit_classlikes[] = $class; } - if (is_subclass_of($class, LegacyAfterCodebasePopulatedInterface::class)) { - $this->legacy_after_codebase_populated[] = $class; - } elseif (is_subclass_of($class, AfterCodebasePopulatedInterface::class)) { + if (is_subclass_of($class, AfterCodebasePopulatedInterface::class)) { $this->after_codebase_populated[] = $class; } - if (is_subclass_of($class, LegacyAfterAnalysisInterface::class)) { - $this->legacy_after_analysis[] = $class; - } elseif (is_subclass_of($class, AfterAnalysisInterface::class)) { + if (is_subclass_of($class, AfterAnalysisInterface::class)) { $this->after_analysis[] = $class; } - if (is_subclass_of($class, LegacyAfterFileAnalysisInterface::class)) { - $this->legacy_after_file_checks[] = $class; - } elseif (is_subclass_of($class, AfterFileAnalysisInterface::class)) { + if (is_subclass_of($class, AfterFileAnalysisInterface::class)) { $this->after_file_checks[] = $class; } - if (is_subclass_of($class, LegacyBeforeFileAnalysisInterface::class)) { - $this->legacy_before_file_checks[] = $class; - } elseif (is_subclass_of($class, BeforeFileAnalysisInterface::class)) { + if (is_subclass_of($class, BeforeFileAnalysisInterface::class)) { $this->before_file_checks[] = $class; } - if (is_subclass_of($class, LegacyAfterFunctionLikeAnalysisInterface::class)) { - $this->legacy_after_functionlike_checks[] = $class; - } elseif (is_subclass_of($class, AfterFunctionLikeAnalysisInterface::class)) { + if (is_subclass_of($class, AfterFunctionLikeAnalysisInterface::class)) { $this->after_functionlike_checks[] = $class; } @@ -306,7 +236,7 @@ public function registerClass(string $class): void public function hasAfterMethodCallAnalysisHandlers(): bool { - return count($this->after_method_checks) || count($this->legacy_after_method_checks); + return count($this->after_method_checks) > 0; } public function dispatchAfterMethodCallAnalysis(AfterMethodCallAnalysisEvent $event): void @@ -314,24 +244,6 @@ public function dispatchAfterMethodCallAnalysis(AfterMethodCallAnalysisEvent $ev foreach ($this->after_method_checks as $handler) { $handler::afterMethodCallAnalysis($event); } - - foreach ($this->legacy_after_method_checks as $handler) { - $file_replacements = $event->getFileReplacements(); - $return_type_candidate = $event->getReturnTypeCandidate(); - $handler::afterMethodCallAnalysis( - $event->getExpr(), - $event->getMethodId(), - $event->getAppearingMethodId(), - $event->getDeclaringMethodId(), - $event->getContext(), - $event->getStatementsSource(), - $event->getCodebase(), - $file_replacements, - $return_type_candidate - ); - $event->setFileReplacements($file_replacements); - $event->setReturnTypeCandidate($return_type_candidate); - } } public function dispatchAfterFunctionCallAnalysis(AfterFunctionCallAnalysisEvent $event): void @@ -339,20 +251,6 @@ public function dispatchAfterFunctionCallAnalysis(AfterFunctionCallAnalysisEvent foreach ($this->after_function_checks as $handler) { $handler::afterFunctionCallAnalysis($event); } - - foreach ($this->legacy_after_function_checks as $handler) { - $file_replacements = $event->getFileReplacements(); - $handler::afterFunctionCallAnalysis( - $event->getExpr(), - $event->getFunctionId(), - $event->getContext(), - $event->getStatementsSource(), - $event->getCodebase(), - $event->getReturnTypeCandidate(), - $file_replacements - ); - $event->setFileReplacements($file_replacements); - } } public function dispatchAfterEveryFunctionCallAnalysis(AfterEveryFunctionCallAnalysisEvent $event): void @@ -360,16 +258,6 @@ public function dispatchAfterEveryFunctionCallAnalysis(AfterEveryFunctionCallAna foreach ($this->after_every_function_checks as $handler) { $handler::afterEveryFunctionCallAnalysis($event); } - - foreach ($this->legacy_after_every_function_checks as $handler) { - $handler::afterEveryFunctionCallAnalysis( - $event->getExpr(), - $event->getFunctionId(), - $event->getContext(), - $event->getStatementsSource(), - $event->getCodebase() - ); - } } public function dispatchAfterExpressionAnalysis(AfterExpressionAnalysisEvent $event): ?bool @@ -380,20 +268,6 @@ public function dispatchAfterExpressionAnalysis(AfterExpressionAnalysisEvent $ev } } - foreach ($this->legacy_after_expression_checks as $handler) { - $file_replacements = $event->getFileReplacements(); - if ($handler::afterExpressionAnalysis( - $event->getExpr(), - $event->getContext(), - $event->getStatementsSource(), - $event->getCodebase(), - $file_replacements - ) === false) { - return false; - } - $event->setFileReplacements($file_replacements); - } - return null; } @@ -405,20 +279,6 @@ public function dispatchAfterStatementAnalysis(AfterStatementAnalysisEvent $even } } - foreach ($this->legacy_after_statement_checks as $handler) { - $file_replacements = $event->getFileReplacements(); - if ($handler::afterStatementAnalysis( - $event->getStmt(), - $event->getContext(), - $event->getStatementsSource(), - $event->getCodebase(), - $file_replacements - ) === false) { - return false; - } - $event->setFileReplacements($file_replacements); - } - return null; } @@ -430,12 +290,6 @@ public function dispatchStringInterpreter(StringInterpreterEvent $event): ?TLite } } - foreach ($this->legacy_string_interpreters as $handler) { - if ($type = $handler::getTypeFromValue($event->getValue())) { - return $type; - } - } - return null; } @@ -444,18 +298,6 @@ public function dispatchAfterClassLikeExistenceCheck(AfterClassLikeExistenceChec foreach ($this->after_classlike_exists_checks as $handler) { $handler::afterClassLikeExistenceCheck($event); } - - foreach ($this->legacy_after_classlike_exists_checks as $handler) { - $file_replacements = $event->getFileReplacements(); - $handler::afterClassLikeExistenceCheck( - $event->getFqClassName(), - $event->getCodeLocation(), - $event->getStatementsSource(), - $event->getCodebase(), - $file_replacements - ); - $event->setFileReplacements($file_replacements); - } } public function dispatchAfterClassLikeAnalysis(AfterClassLikeAnalysisEvent $event): ?bool @@ -466,26 +308,12 @@ public function dispatchAfterClassLikeAnalysis(AfterClassLikeAnalysisEvent $even } } - foreach ($this->legacy_after_classlike_checks as $handler) { - $file_replacements = $event->getFileReplacements(); - if ($handler::afterStatementAnalysis( - $event->getStmt(), - $event->getClasslikeStorage(), - $event->getStatementsSource(), - $event->getCodebase(), - $file_replacements - ) === false) { - return false; - } - $event->setFileReplacements($file_replacements); - } - return null; } public function hasAfterClassLikeVisitHandlers(): bool { - return count($this->after_visit_classlikes) || count($this->legacy_after_visit_classlikes); + return count($this->after_visit_classlikes) > 0; } public function dispatchAfterClassLikeVisit(AfterClassLikeVisitEvent $event): void @@ -493,18 +321,6 @@ public function dispatchAfterClassLikeVisit(AfterClassLikeVisitEvent $event): vo foreach ($this->after_visit_classlikes as $handler) { $handler::afterClassLikeVisit($event); } - - foreach ($this->legacy_after_visit_classlikes as $handler) { - $file_replacements = $event->getFileReplacements(); - $handler::afterClassLikeVisit( - $event->getStmt(), - $event->getStorage(), - $event->getStatementsSource(), - $event->getCodebase(), - $file_replacements - ); - $event->setFileReplacements($file_replacements); - } } public function dispatchAfterCodebasePopulated(AfterCodebasePopulatedEvent $event): void @@ -512,12 +328,6 @@ public function dispatchAfterCodebasePopulated(AfterCodebasePopulatedEvent $even foreach ($this->after_codebase_populated as $handler) { $handler::afterCodebasePopulated($event); } - - foreach ($this->legacy_after_codebase_populated as $handler) { - $handler::afterCodebasePopulated( - $event->getCodebase() - ); - } } public function dispatchAfterAnalysis(AfterAnalysisEvent $event): void @@ -525,16 +335,6 @@ public function dispatchAfterAnalysis(AfterAnalysisEvent $event): void foreach ($this->after_analysis as $handler) { $handler::afterAnalysis($event); } - - foreach ($this->legacy_after_analysis as $handler) { - /** @psalm-suppress MixedArgumentTypeCoercion due to Psalm bug */ - $handler::afterAnalysis( - $event->getCodebase(), - $event->getIssues(), - $event->getBuildInfo(), - $event->getSourceControlInfo() - ); - } } public function dispatchAfterFileAnalysis(AfterFileAnalysisEvent $event): void @@ -542,15 +342,6 @@ public function dispatchAfterFileAnalysis(AfterFileAnalysisEvent $event): void foreach ($this->after_file_checks as $handler) { $handler::afterAnalyzeFile($event); } - - foreach ($this->legacy_after_file_checks as $handler) { - $handler::afterAnalyzeFile( - $event->getStatementsSource(), - $event->getFileContext(), - $event->getFileStorage(), - $event->getCodebase() - ); - } } public function dispatchBeforeFileAnalysis(BeforeFileAnalysisEvent $event): void @@ -558,15 +349,6 @@ public function dispatchBeforeFileAnalysis(BeforeFileAnalysisEvent $event): void foreach ($this->before_file_checks as $handler) { $handler::beforeAnalyzeFile($event); } - - foreach ($this->legacy_before_file_checks as $handler) { - $handler::beforeAnalyzeFile( - $event->getStatementsSource(), - $event->getFileContext(), - $event->getFileStorage(), - $event->getCodebase() - ); - } } public function dispatchAfterFunctionLikeAnalysis(AfterFunctionLikeAnalysisEvent $event): ?bool @@ -577,20 +359,6 @@ public function dispatchAfterFunctionLikeAnalysis(AfterFunctionLikeAnalysisEvent } } - foreach ($this->legacy_after_functionlike_checks as $handler) { - $file_replacements = $event->getFileReplacements(); - if ($handler::afterStatementAnalysis( - $event->getStmt(), - $event->getClasslikeStorage(), - $event->getStatementsSource(), - $event->getCodebase(), - $file_replacements - ) === false) { - return false; - } - $event->setFileReplacements($file_replacements); - } - return null; } diff --git a/src/Psalm/Internal/Provider/FunctionExistenceProvider.php b/src/Psalm/Internal/Provider/FunctionExistenceProvider.php index 643f56b0231..17932060080 100644 --- a/src/Psalm/Internal/Provider/FunctionExistenceProvider.php +++ b/src/Psalm/Internal/Provider/FunctionExistenceProvider.php @@ -5,7 +5,6 @@ use Closure; use Psalm\Plugin\EventHandler\Event\FunctionExistenceProviderEvent; use Psalm\Plugin\EventHandler\FunctionExistenceProviderInterface; -use Psalm\Plugin\Hook\FunctionExistenceProviderInterface as LegacyFunctionExistenceProviderInterface; use Psalm\StatementsSource; use function is_subclass_of; @@ -24,21 +23,9 @@ class FunctionExistenceProvider */ private static $handlers = []; - /** - * @var array< - * lowercase-string, - * array - * > - */ - private static $legacy_handlers = []; - public function __construct() { self::$handlers = []; - self::$legacy_handlers = []; } /** @@ -46,13 +33,7 @@ public function __construct() */ public function registerClass(string $class): void { - if (is_subclass_of($class, LegacyFunctionExistenceProviderInterface::class, true)) { - $callable = Closure::fromCallable([$class, 'doesFunctionExist']); - - foreach ($class::getFunctionIds() as $function_id) { - $this->registerLegacyClosure($function_id, $callable); - } - } elseif (is_subclass_of($class, FunctionExistenceProviderInterface::class, true)) { + if (is_subclass_of($class, FunctionExistenceProviderInterface::class, true)) { $callable = Closure::fromCallable([$class, 'doesFunctionExist']); foreach ($class::getFunctionIds() as $function_id) { @@ -70,39 +51,15 @@ public function registerClosure(string $function_id, Closure $c): void self::$handlers[$function_id][] = $c; } - /** - * @param lowercase-string $function_id - * @param Closure( - * StatementsSource, - * string - * ): ?bool $c - */ - public function registerLegacyClosure(string $function_id, Closure $c): void - { - self::$legacy_handlers[$function_id][] = $c; - } - public function has(string $function_id): bool { - return isset(self::$handlers[strtolower($function_id)]) || - isset(self::$legacy_handlers[strtolower($function_id)]); + return isset(self::$handlers[strtolower($function_id)]); } public function doesFunctionExist( StatementsSource $statements_source, string $function_id ): ?bool { - foreach (self::$legacy_handlers[strtolower($function_id)] ?? [] as $function_handler) { - $function_exists = $function_handler( - $statements_source, - $function_id - ); - - if ($function_exists !== null) { - return $function_exists; - } - } - foreach (self::$handlers[strtolower($function_id)] ?? [] as $function_handler) { $event = new FunctionExistenceProviderEvent( $statements_source, diff --git a/src/Psalm/Internal/Provider/FunctionParamsProvider.php b/src/Psalm/Internal/Provider/FunctionParamsProvider.php index df82e60d9fa..3cf7493ddcd 100644 --- a/src/Psalm/Internal/Provider/FunctionParamsProvider.php +++ b/src/Psalm/Internal/Provider/FunctionParamsProvider.php @@ -8,11 +8,9 @@ use Psalm\Context; use Psalm\Plugin\EventHandler\Event\FunctionParamsProviderEvent; use Psalm\Plugin\EventHandler\FunctionParamsProviderInterface; -use Psalm\Plugin\Hook\FunctionParamsProviderInterface as LegacyFunctionParamsProviderInterface; use Psalm\StatementsSource; use Psalm\Storage\FunctionLikeParameter; -use function is_subclass_of; use function strtolower; /** @@ -28,43 +26,20 @@ class FunctionParamsProvider */ private static $handlers = []; - /** - * @var array< - * lowercase-string, - * array, - * ?Context=, - * ?CodeLocation= - * ): ?array> - * > - */ - private static $legacy_handlers = []; - public function __construct() { self::$handlers = []; - self::$legacy_handlers = []; } /** - * @param class-string|class-string $class + * @param class-string $class */ public function registerClass(string $class): void { - if (is_subclass_of($class, LegacyFunctionParamsProviderInterface::class, true)) { - $callable = Closure::fromCallable([$class, 'getFunctionParams']); + $callable = Closure::fromCallable([$class, 'getFunctionParams']); - foreach ($class::getFunctionIds() as $function_id) { - $this->registerLegacyClosure($function_id, $callable); - } - } elseif (is_subclass_of($class, FunctionParamsProviderInterface::class, true)) { - $callable = Closure::fromCallable([$class, 'getFunctionParams']); - - foreach ($class::getFunctionIds() as $function_id) { - $this->registerClosure($function_id, $callable); - } + foreach ($class::getFunctionIds() as $function_id) { + $this->registerClosure($function_id, $callable); } } @@ -76,24 +51,9 @@ public function registerClosure(string $fq_classlike_name, Closure $c): void self::$handlers[strtolower($fq_classlike_name)][] = $c; } - /** - * @param Closure( - * StatementsSource, - * string, - * list, - * ?Context=, - * ?CodeLocation= - * ): ?array $c - */ - public function registerLegacyClosure(string $fq_classlike_name, Closure $c): void - { - self::$legacy_handlers[strtolower($fq_classlike_name)][] = $c; - } - public function has(string $fq_classlike_name): bool { - return isset(self::$handlers[strtolower($fq_classlike_name)]) || - isset(self::$legacy_handlers[strtolower($fq_classlike_name)]); + return isset(self::$handlers[strtolower($fq_classlike_name)]); } /** @@ -123,20 +83,6 @@ public function getFunctionParams( } } - foreach (self::$legacy_handlers[strtolower($function_id)] ?? [] as $class_handler) { - $result = $class_handler( - $statements_source, - $function_id, - $call_args, - $context, - $code_location - ); - - if ($result) { - return $result; - } - } - return null; } } diff --git a/src/Psalm/Internal/Provider/FunctionReturnTypeProvider.php b/src/Psalm/Internal/Provider/FunctionReturnTypeProvider.php index 8e03671778a..06390ab8069 100644 --- a/src/Psalm/Internal/Provider/FunctionReturnTypeProvider.php +++ b/src/Psalm/Internal/Provider/FunctionReturnTypeProvider.php @@ -4,7 +4,6 @@ use Closure; use PhpParser; -use PhpParser\Node\Arg; use Psalm\CodeLocation; use Psalm\Context; use Psalm\Internal\Provider\ReturnTypeProvider\ArrayChunkReturnTypeProvider; @@ -41,7 +40,6 @@ use Psalm\Internal\Provider\ReturnTypeProvider\VersionCompareReturnTypeProvider; use Psalm\Plugin\EventHandler\Event\FunctionReturnTypeProviderEvent; use Psalm\Plugin\EventHandler\FunctionReturnTypeProviderInterface; -use Psalm\Plugin\Hook\FunctionReturnTypeProviderInterface as LegacyFunctionReturnTypeProviderInterface; use Psalm\StatementsSource; use Psalm\Type\Union; @@ -61,24 +59,9 @@ class FunctionReturnTypeProvider */ private static $handlers = []; - /** - * @var array< - * lowercase-string, - * array, - * Context, - * CodeLocation - * ): ?Union> - * > - */ - private static $legacy_handlers = []; - public function __construct() { self::$handlers = []; - self::$legacy_handlers = []; $this->registerClass(ArrayChunkReturnTypeProvider::class); $this->registerClass(ArrayColumnReturnTypeProvider::class); @@ -119,13 +102,7 @@ public function __construct() */ public function registerClass(string $class): void { - if (is_subclass_of($class, LegacyFunctionReturnTypeProviderInterface::class, true)) { - $callable = Closure::fromCallable([$class, 'getFunctionReturnType']); - - foreach ($class::getFunctionIds() as $function_id) { - $this->registerLegacyClosure($function_id, $callable); - } - } elseif (is_subclass_of($class, FunctionReturnTypeProviderInterface::class, true)) { + if (is_subclass_of($class, FunctionReturnTypeProviderInterface::class, true)) { $callable = Closure::fromCallable([$class, 'getFunctionReturnType']); foreach ($class::getFunctionIds() as $function_id) { @@ -143,25 +120,9 @@ public function registerClosure(string $function_id, Closure $c): void self::$handlers[$function_id][] = $c; } - /** - * @param lowercase-string $function_id - * @param Closure( - * StatementsSource, - * non-empty-string, - * list, - * Context, - * CodeLocation - * ): ?Union $c - */ - public function registerLegacyClosure(string $function_id, Closure $c): void - { - self::$legacy_handlers[$function_id][] = $c; - } - public function has(string $function_id): bool { - return isset(self::$handlers[strtolower($function_id)]) || - isset(self::$legacy_handlers[strtolower($function_id)]); + return isset(self::$handlers[strtolower($function_id)]); } /** @@ -174,20 +135,6 @@ public function getReturnType( Context $context, CodeLocation $code_location ): ?Union { - foreach (self::$legacy_handlers[strtolower($function_id)] ?? [] as $function_handler) { - $return_type = $function_handler( - $statements_source, - $function_id, - $stmt->getArgs(), - $context, - $code_location - ); - - if ($return_type) { - return $return_type; - } - } - foreach (self::$handlers[strtolower($function_id)] ?? [] as $function_handler) { $event = new FunctionReturnTypeProviderEvent( $statements_source, diff --git a/src/Psalm/Internal/Provider/MethodExistenceProvider.php b/src/Psalm/Internal/Provider/MethodExistenceProvider.php index 695f22e2dca..a2f45ae0706 100644 --- a/src/Psalm/Internal/Provider/MethodExistenceProvider.php +++ b/src/Psalm/Internal/Provider/MethodExistenceProvider.php @@ -6,10 +6,8 @@ use Psalm\CodeLocation; use Psalm\Plugin\EventHandler\Event\MethodExistenceProviderEvent; use Psalm\Plugin\EventHandler\MethodExistenceProviderInterface; -use Psalm\Plugin\Hook\MethodExistenceProviderInterface as LegacyMethodExistenceProviderInterface; use Psalm\StatementsSource; -use function is_subclass_of; use function strtolower; /** @@ -25,42 +23,20 @@ class MethodExistenceProvider */ private static $handlers = []; - /** - * @var array< - * lowercase-string, - * array - * > - */ - private static $legacy_handlers = []; - public function __construct() { self::$handlers = []; - self::$legacy_handlers = []; } /** - * @param class-string|class-string $class + * @param class-string $class */ public function registerClass(string $class): void { - if (is_subclass_of($class, LegacyMethodExistenceProviderInterface::class, true)) { - $callable = Closure::fromCallable([$class, 'doesMethodExist']); + $callable = Closure::fromCallable([$class, 'doesMethodExist']); - foreach ($class::getClassLikeNames() as $fq_classlike_name) { - $this->registerLegacyClosure($fq_classlike_name, $callable); - } - } elseif (is_subclass_of($class, MethodExistenceProviderInterface::class, true)) { - $callable = Closure::fromCallable([$class, 'doesMethodExist']); - - foreach ($class::getClassLikeNames() as $fq_classlike_name) { - $this->registerClosure($fq_classlike_name, $callable); - } + foreach ($class::getClassLikeNames() as $fq_classlike_name) { + $this->registerClosure($fq_classlike_name, $callable); } } @@ -72,23 +48,9 @@ public function registerClosure(string $fq_classlike_name, Closure $c): void self::$handlers[strtolower($fq_classlike_name)][] = $c; } - /** - * @param Closure( - * string, - * string, - * ?StatementsSource=, - * ?CodeLocation - * ): ?bool $c - */ - public function registerLegacyClosure(string $fq_classlike_name, Closure $c): void - { - self::$legacy_handlers[strtolower($fq_classlike_name)][] = $c; - } - public function has(string $fq_classlike_name): bool { - return isset(self::$handlers[strtolower($fq_classlike_name)]) || - isset(self::$legacy_handlers[strtolower($fq_classlike_name)]); + return isset(self::$handlers[strtolower($fq_classlike_name)]); } public function doesMethodExist( @@ -97,19 +59,6 @@ public function doesMethodExist( ?StatementsSource $source = null, ?CodeLocation $code_location = null ): ?bool { - foreach (self::$legacy_handlers[strtolower($fq_classlike_name)] ?? [] as $method_handler) { - $method_exists = $method_handler( - $fq_classlike_name, - $method_name_lowercase, - $source, - $code_location - ); - - if ($method_exists !== null) { - return $method_exists; - } - } - foreach (self::$handlers[strtolower($fq_classlike_name)] ?? [] as $method_handler) { $event = new MethodExistenceProviderEvent( $fq_classlike_name, diff --git a/src/Psalm/Internal/Provider/MethodParamsProvider.php b/src/Psalm/Internal/Provider/MethodParamsProvider.php index b8a44c7a906..537979ea281 100644 --- a/src/Psalm/Internal/Provider/MethodParamsProvider.php +++ b/src/Psalm/Internal/Provider/MethodParamsProvider.php @@ -9,7 +9,6 @@ use Psalm\Internal\Provider\ReturnTypeProvider\PdoStatementSetFetchMode; use Psalm\Plugin\EventHandler\Event\MethodParamsProviderEvent; use Psalm\Plugin\EventHandler\MethodParamsProviderInterface; -use Psalm\Plugin\Hook\MethodParamsProviderInterface as LegacyMethodParamsProviderInterface; use Psalm\StatementsSource; use Psalm\Storage\FunctionLikeParameter; @@ -29,25 +28,9 @@ class MethodParamsProvider */ private static $handlers = []; - /** - * @var array< - * lowercase-string, - * array=, - * ?StatementsSource=, - * ?Context=, - * ?CodeLocation= - * ): ?array> - * > - */ - private static $legacy_handlers = []; - public function __construct() { self::$handlers = []; - self::$legacy_handlers = []; $this->registerClass(PdoStatementSetFetchMode::class); } @@ -57,13 +40,7 @@ public function __construct() */ public function registerClass(string $class): void { - if (is_subclass_of($class, LegacyMethodParamsProviderInterface::class, true)) { - $callable = Closure::fromCallable([$class, 'getMethodParams']); - - foreach ($class::getClassLikeNames() as $fq_classlike_name) { - $this->registerLegacyClosure($fq_classlike_name, $callable); - } - } elseif (is_subclass_of($class, MethodParamsProviderInterface::class, true)) { + if (is_subclass_of($class, MethodParamsProviderInterface::class, true)) { $callable = Closure::fromCallable([$class, 'getMethodParams']); foreach ($class::getClassLikeNames() as $fq_classlike_name) { @@ -80,25 +57,9 @@ public function registerClosure(string $fq_classlike_name, Closure $c): void self::$handlers[strtolower($fq_classlike_name)][] = $c; } - /** - * @param Closure( - * string, - * string, - * ?list=, - * ?StatementsSource=, - * ?Context=, - * ?CodeLocation= - * ): ?array $c - */ - public function registerLegacyClosure(string $fq_classlike_name, Closure $c): void - { - self::$legacy_handlers[strtolower($fq_classlike_name)][] = $c; - } - public function has(string $fq_classlike_name): bool { - return isset(self::$handlers[strtolower($fq_classlike_name)]) || - isset(self::$legacy_handlers[strtolower($fq_classlike_name)]); + return isset(self::$handlers[strtolower($fq_classlike_name)]); } /** @@ -114,21 +75,6 @@ public function getMethodParams( ?Context $context = null, ?CodeLocation $code_location = null ): ?array { - foreach (self::$legacy_handlers[strtolower($fq_classlike_name)] ?? [] as $class_handler) { - $result = $class_handler( - $fq_classlike_name, - $method_name_lowercase, - $call_args, - $statements_source, - $context, - $code_location - ); - - if ($result !== null) { - return $result; - } - } - foreach (self::$handlers[strtolower($fq_classlike_name)] ?? [] as $class_handler) { $event = new MethodParamsProviderEvent( $fq_classlike_name, diff --git a/src/Psalm/Internal/Provider/MethodReturnTypeProvider.php b/src/Psalm/Internal/Provider/MethodReturnTypeProvider.php index 08fe1f8c0c9..197a4564f57 100644 --- a/src/Psalm/Internal/Provider/MethodReturnTypeProvider.php +++ b/src/Psalm/Internal/Provider/MethodReturnTypeProvider.php @@ -13,7 +13,6 @@ use Psalm\Internal\Provider\ReturnTypeProvider\SimpleXmlElementAsXml; use Psalm\Plugin\EventHandler\Event\MethodReturnTypeProviderEvent; use Psalm\Plugin\EventHandler\MethodReturnTypeProviderInterface; -use Psalm\Plugin\Hook\MethodReturnTypeProviderInterface as LegacyMethodReturnTypeProviderInterface; use Psalm\StatementsSource; use Psalm\Type\Union; @@ -33,28 +32,9 @@ class MethodReturnTypeProvider */ private static $handlers = []; - /** - * @var array< - * lowercase-string, - * array, - * Context, - * CodeLocation, - * ?array=, - * ?string=, - * ?lowercase-string= - * ): ?Union> - * > - */ - private static $legacy_handlers = []; - public function __construct() { self::$handlers = []; - self::$legacy_handlers = []; $this->registerClass(DomNodeAppendChild::class); $this->registerClass(ImagickPixelColorReturnTypeProvider::class); @@ -68,13 +48,7 @@ public function __construct() */ public function registerClass(string $class): void { - if (is_subclass_of($class, LegacyMethodReturnTypeProviderInterface::class, true)) { - $callable = Closure::fromCallable([$class, 'getMethodReturnType']); - - foreach ($class::getClassLikeNames() as $fq_classlike_name) { - $this->registerLegacyClosure($fq_classlike_name, $callable); - } - } elseif (is_subclass_of($class, MethodReturnTypeProviderInterface::class, true)) { + if (is_subclass_of($class, MethodReturnTypeProviderInterface::class, true)) { $callable = Closure::fromCallable([$class, 'getMethodReturnType']); foreach ($class::getClassLikeNames() as $fq_classlike_name) { @@ -91,29 +65,9 @@ public function registerClosure(string $fq_classlike_name, Closure $c): void self::$handlers[strtolower($fq_classlike_name)][] = $c; } - /** - * @param Closure( - * StatementsSource, - * string, - * lowercase-string, - * list, - * Context, - * CodeLocation, - * ?array=, - * ?string=, - * ?lowercase-string= - * ): ?Union $c - * - */ - public function registerLegacyClosure(string $fq_classlike_name, Closure $c): void - { - self::$legacy_handlers[strtolower($fq_classlike_name)][] = $c; - } - public function has(string $fq_classlike_name): bool { - return isset(self::$handlers[strtolower($fq_classlike_name)]) || - isset(self::$legacy_handlers[strtolower($fq_classlike_name)]); + return isset(self::$handlers[strtolower($fq_classlike_name)]); } /** @@ -131,24 +85,6 @@ public function getReturnType( ?string $called_fq_classlike_name = null, ?string $called_method_name = null ): ?Union { - foreach (self::$legacy_handlers[strtolower($fq_classlike_name)] ?? [] as $class_handler) { - $result = $class_handler( - $statements_source, - $fq_classlike_name, - strtolower($method_name), - $stmt->getArgs(), - $context, - $code_location, - $template_type_parameters, - $called_fq_classlike_name, - $called_method_name ? strtolower($called_method_name) : null - ); - - if ($result) { - return $result; - } - } - foreach (self::$handlers[strtolower($fq_classlike_name)] ?? [] as $class_handler) { $event = new MethodReturnTypeProviderEvent( $statements_source, diff --git a/src/Psalm/Internal/Provider/MethodVisibilityProvider.php b/src/Psalm/Internal/Provider/MethodVisibilityProvider.php index 6942c24e169..e090f38739f 100644 --- a/src/Psalm/Internal/Provider/MethodVisibilityProvider.php +++ b/src/Psalm/Internal/Provider/MethodVisibilityProvider.php @@ -7,7 +7,6 @@ use Psalm\Context; use Psalm\Plugin\EventHandler\Event\MethodVisibilityProviderEvent; use Psalm\Plugin\EventHandler\MethodVisibilityProviderInterface; -use Psalm\Plugin\Hook\MethodVisibilityProviderInterface as LegacyMethodVisibilityProviderInterface; use Psalm\StatementsSource; use function is_subclass_of; @@ -26,24 +25,9 @@ class MethodVisibilityProvider */ private static $handlers = []; - /** - * @var array< - * lowercase-string, - * array - * > - */ - private static $legacy_handlers = []; - public function __construct() { self::$handlers = []; - self::$legacy_handlers = []; } /** @@ -52,13 +36,7 @@ public function __construct() */ public function registerClass(string $class): void { - if (is_subclass_of($class, LegacyMethodVisibilityProviderInterface::class, true)) { - $callable = Closure::fromCallable([$class, 'isMethodVisible']); - - foreach ($class::getClassLikeNames() as $fq_classlike_name) { - $this->registerLegacyClosure($fq_classlike_name, $callable); - } - } elseif (is_subclass_of($class, MethodVisibilityProviderInterface::class, true)) { + if (is_subclass_of($class, MethodVisibilityProviderInterface::class, true)) { $callable = Closure::fromCallable([$class, 'isMethodVisible']); foreach ($class::getClassLikeNames() as $fq_classlike_name) { @@ -75,24 +53,9 @@ public function registerClosure(string $fq_classlike_name, Closure $c): void self::$handlers[strtolower($fq_classlike_name)][] = $c; } - /** - * @param Closure( - * StatementsSource, - * string, - * string, - * Context, - * ?CodeLocation - * ): ?bool $c - */ - public function registerLegacyClosure(string $fq_classlike_name, Closure $c): void - { - self::$legacy_handlers[strtolower($fq_classlike_name)][] = $c; - } - public function has(string $fq_classlike_name): bool { - return isset(self::$handlers[strtolower($fq_classlike_name)]) || - isset(self::$legacy_handlers[strtolower($fq_classlike_name)]); + return isset(self::$handlers[strtolower($fq_classlike_name)]); } public function isMethodVisible( @@ -102,20 +65,6 @@ public function isMethodVisible( Context $context, ?CodeLocation $code_location = null ): ?bool { - foreach (self::$legacy_handlers[strtolower($fq_classlike_name)] ?? [] as $method_handler) { - $method_visible = $method_handler( - $source, - $fq_classlike_name, - $method_name, - $context, - $code_location - ); - - if ($method_visible !== null) { - return $method_visible; - } - } - foreach (self::$handlers[strtolower($fq_classlike_name)] ?? [] as $method_handler) { $event = new MethodVisibilityProviderEvent( $source, diff --git a/src/Psalm/Internal/Provider/PropertyExistenceProvider.php b/src/Psalm/Internal/Provider/PropertyExistenceProvider.php index 93e23b2de8b..9065b3fb99e 100644 --- a/src/Psalm/Internal/Provider/PropertyExistenceProvider.php +++ b/src/Psalm/Internal/Provider/PropertyExistenceProvider.php @@ -7,7 +7,6 @@ use Psalm\Context; use Psalm\Plugin\EventHandler\Event\PropertyExistenceProviderEvent; use Psalm\Plugin\EventHandler\PropertyExistenceProviderInterface; -use Psalm\Plugin\Hook\PropertyExistenceProviderInterface as LegacyPropertyExistenceProviderInterface; use Psalm\StatementsSource; use function is_subclass_of; @@ -26,25 +25,9 @@ class PropertyExistenceProvider */ private static $handlers = []; - /** - * @var array< - * lowercase-string, - * array - * > - */ - private static $legacy_handlers = []; - public function __construct() { self::$handlers = []; - self::$legacy_handlers = []; } /** @@ -53,13 +36,7 @@ public function __construct() */ public function registerClass(string $class): void { - if (is_subclass_of($class, LegacyPropertyExistenceProviderInterface::class, true)) { - $callable = Closure::fromCallable([$class, 'doesPropertyExist']); - - foreach ($class::getClassLikeNames() as $fq_classlike_name) { - $this->registerLegacyClosure($fq_classlike_name, $callable); - } - } elseif (is_subclass_of($class, PropertyExistenceProviderInterface::class, true)) { + if (is_subclass_of($class, PropertyExistenceProviderInterface::class, true)) { $callable = Closure::fromCallable([$class, 'doesPropertyExist']); foreach ($class::getClassLikeNames() as $fq_classlike_name) { @@ -76,25 +53,9 @@ public function registerClosure(string $fq_classlike_name, Closure $c): void self::$handlers[strtolower($fq_classlike_name)][] = $c; } - /** - * @param Closure( - * string, - * string, - * bool, - * ?StatementsSource=, - * ?Context=, - * ?CodeLocation= - * ): ?bool $c - */ - public function registerLegacyClosure(string $fq_classlike_name, Closure $c): void - { - self::$legacy_handlers[strtolower($fq_classlike_name)][] = $c; - } - public function has(string $fq_classlike_name): bool { - return isset(self::$handlers[strtolower($fq_classlike_name)]) || - isset(self::$legacy_handlers[strtolower($fq_classlike_name)]); + return isset(self::$handlers[strtolower($fq_classlike_name)]); } public function doesPropertyExist( @@ -105,21 +66,6 @@ public function doesPropertyExist( ?Context $context = null, ?CodeLocation $code_location = null ): ?bool { - foreach (self::$legacy_handlers[strtolower($fq_classlike_name)] ?? [] as $property_handler) { - $property_exists = $property_handler( - $fq_classlike_name, - $property_name, - $read_mode, - $source, - $context, - $code_location - ); - - if ($property_exists !== null) { - return $property_exists; - } - } - foreach (self::$handlers[strtolower($fq_classlike_name)] ?? [] as $property_handler) { $event = new PropertyExistenceProviderEvent( $fq_classlike_name, diff --git a/src/Psalm/Internal/Provider/PropertyTypeProvider.php b/src/Psalm/Internal/Provider/PropertyTypeProvider.php index 788f839a183..e24509291e0 100644 --- a/src/Psalm/Internal/Provider/PropertyTypeProvider.php +++ b/src/Psalm/Internal/Provider/PropertyTypeProvider.php @@ -7,7 +7,6 @@ use Psalm\Internal\Provider\PropertyTypeProvider\DomDocumentPropertyTypeProvider; use Psalm\Plugin\EventHandler\Event\PropertyTypeProviderEvent; use Psalm\Plugin\EventHandler\PropertyTypeProviderInterface; -use Psalm\Plugin\Hook\PropertyTypeProviderInterface as LegacyPropertyTypeProviderInterface; use Psalm\StatementsSource; use Psalm\Type\Union; @@ -27,24 +26,9 @@ class PropertyTypeProvider */ private static $handlers = []; - /** - * @var array< - * lowercase-string, - * array - * > - */ - private static $legacy_handlers = []; - public function __construct() { self::$handlers = []; - self::$legacy_handlers = []; $this->registerClass(DomDocumentPropertyTypeProvider::class); } @@ -54,13 +38,7 @@ public function __construct() */ public function registerClass(string $class): void { - if (is_subclass_of($class, LegacyPropertyTypeProviderInterface::class, true)) { - $callable = Closure::fromCallable([$class, 'getPropertyType']); - - foreach ($class::getClassLikeNames() as $fq_classlike_name) { - $this->registerLegacyClosure($fq_classlike_name, $callable); - } - } elseif (is_subclass_of($class, PropertyTypeProviderInterface::class, true)) { + if (is_subclass_of($class, PropertyTypeProviderInterface::class, true)) { $callable = Closure::fromCallable([$class, 'getPropertyType']); foreach ($class::getClassLikeNames() as $fq_classlike_name) { @@ -77,24 +55,9 @@ public function registerClosure(string $fq_classlike_name, Closure $c): void self::$handlers[strtolower($fq_classlike_name)][] = $c; } - /** - * @param Closure( - * string, - * string, - * bool, - * ?StatementsSource=, - * ?Context= - * ): ?Union $c - */ - public function registerLegacyClosure(string $fq_classlike_name, Closure $c): void - { - self::$legacy_handlers[strtolower($fq_classlike_name)][] = $c; - } - public function has(string $fq_classlike_name): bool { - return isset(self::$handlers[strtolower($fq_classlike_name)]) || - isset(self::$legacy_handlers[strtolower($fq_classlike_name)]); + return isset(self::$handlers[strtolower($fq_classlike_name)]); } public function getPropertyType( @@ -109,20 +72,6 @@ public function getPropertyType( $source->addSuppressedIssues(['NonInvariantDocblockPropertyType']); } - foreach (self::$legacy_handlers[strtolower($fq_classlike_name)] ?? [] as $property_handler) { - $property_type = $property_handler( - $fq_classlike_name, - $property_name, - $read_mode, - $source, - $context - ); - - if ($property_type !== null) { - return $property_type; - } - } - foreach (self::$handlers[strtolower($fq_classlike_name)] ?? [] as $property_handler) { $event = new PropertyTypeProviderEvent( $fq_classlike_name, diff --git a/src/Psalm/Internal/Provider/PropertyVisibilityProvider.php b/src/Psalm/Internal/Provider/PropertyVisibilityProvider.php index 0d63450b4d3..de2ba125ad2 100644 --- a/src/Psalm/Internal/Provider/PropertyVisibilityProvider.php +++ b/src/Psalm/Internal/Provider/PropertyVisibilityProvider.php @@ -7,10 +7,8 @@ use Psalm\Context; use Psalm\Plugin\EventHandler\Event\PropertyVisibilityProviderEvent; use Psalm\Plugin\EventHandler\PropertyVisibilityProviderInterface; -use Psalm\Plugin\Hook\PropertyVisibilityProviderInterface as LegacyPropertyVisibilityProviderInterface; use Psalm\StatementsSource; -use function is_subclass_of; use function strtolower; /** @@ -26,45 +24,20 @@ class PropertyVisibilityProvider */ private static $handlers = []; - /** - * @var array< - * lowercase-string, - * array - * > - */ - private static $legacy_handlers = []; - public function __construct() { self::$handlers = []; - self::$legacy_handlers = []; } /** - * @param class-string - * |class-string $class + * @param class-string $class */ public function registerClass(string $class): void { - if (is_subclass_of($class, LegacyPropertyVisibilityProviderInterface::class, true)) { - $callable = Closure::fromCallable([$class, 'isPropertyVisible']); - - foreach ($class::getClassLikeNames() as $fq_classlike_name) { - $this->registerLegacyClosure($fq_classlike_name, $callable); - } - } elseif (is_subclass_of($class, PropertyVisibilityProviderInterface::class, true)) { - $callable = Closure::fromCallable([$class, 'isPropertyVisible']); + $callable = Closure::fromCallable([$class, 'isPropertyVisible']); - foreach ($class::getClassLikeNames() as $fq_classlike_name) { - $this->registerClosure($fq_classlike_name, $callable); - } + foreach ($class::getClassLikeNames() as $fq_classlike_name) { + $this->registerClosure($fq_classlike_name, $callable); } } @@ -76,25 +49,9 @@ public function registerClosure(string $fq_classlike_name, Closure $c): void self::$handlers[strtolower($fq_classlike_name)][] = $c; } - /** - * @param Closure( - * StatementsSource, - * string, - * string, - * bool, - * Context, - * CodeLocation - * ): ?bool $c - */ - public function registerLegacyClosure(string $fq_classlike_name, Closure $c): void - { - self::$legacy_handlers[strtolower($fq_classlike_name)][] = $c; - } - public function has(string $fq_classlike_name): bool { - return isset(self::$handlers[strtolower($fq_classlike_name)]) || - isset(self::$legacy_handlers[strtolower($fq_classlike_name)]); + return isset(self::$handlers[strtolower($fq_classlike_name)]); } public function isPropertyVisible( @@ -105,21 +62,6 @@ public function isPropertyVisible( Context $context, CodeLocation $code_location ): ?bool { - foreach (self::$legacy_handlers[strtolower($fq_classlike_name)] ?? [] as $property_handler) { - $property_visible = $property_handler( - $source, - $fq_classlike_name, - $property_name, - $read_mode, - $context, - $code_location - ); - - if ($property_visible !== null) { - return $property_visible; - } - } - foreach (self::$handlers[strtolower($fq_classlike_name)] ?? [] as $property_handler) { $event = new PropertyVisibilityProviderEvent( $source, diff --git a/src/Psalm/IssueBuffer.php b/src/Psalm/IssueBuffer.php index b9c5308d872..45632b51023 100644 --- a/src/Psalm/IssueBuffer.php +++ b/src/Psalm/IssueBuffer.php @@ -635,9 +635,7 @@ function (IssueData $d1, IssueData $d2): int { } - if ($codebase->config->eventDispatcher->after_analysis - || $codebase->config->eventDispatcher->legacy_after_analysis - ) { + if ($codebase->config->eventDispatcher->after_analysis) { $source_control_info = null; $build_info = (new BuildInfoCollector(self::$server))->collect(); diff --git a/src/Psalm/Plugin/Hook/AfterAnalysisInterface.php b/src/Psalm/Plugin/Hook/AfterAnalysisInterface.php deleted file mode 100644 index 2e399d4d32d..00000000000 --- a/src/Psalm/Plugin/Hook/AfterAnalysisInterface.php +++ /dev/null @@ -1,23 +0,0 @@ -> $issues - */ - public static function afterAnalysis( - Codebase $codebase, - array $issues, - array $build_info, - ?SourceControlInfo $source_control_info = null - ): void; -} diff --git a/src/Psalm/Plugin/Hook/AfterClassLikeAnalysisInterface.php b/src/Psalm/Plugin/Hook/AfterClassLikeAnalysisInterface.php deleted file mode 100644 index c910400e0ac..00000000000 --- a/src/Psalm/Plugin/Hook/AfterClassLikeAnalysisInterface.php +++ /dev/null @@ -1,29 +0,0 @@ - - */ - public static function getFunctionIds(): array; - - /** - * Use this hook for informing whether or not a global function exists. If you know the function does - * not exist, return false. If you aren't sure if it exists or not, return null and the default analysis - * will continue to determine if the function actually exists. - * - */ - public static function doesFunctionExist( - StatementsSource $statements_source, - string $function_id - ): ?bool; -} diff --git a/src/Psalm/Plugin/Hook/FunctionParamsProviderInterface.php b/src/Psalm/Plugin/Hook/FunctionParamsProviderInterface.php deleted file mode 100644 index 8b23d82968c..00000000000 --- a/src/Psalm/Plugin/Hook/FunctionParamsProviderInterface.php +++ /dev/null @@ -1,31 +0,0 @@ - - */ - public static function getFunctionIds(): array; - - /** - * @param list $call_args - * - * @return ?array - */ - public static function getFunctionParams( - StatementsSource $statements_source, - string $function_id, - array $call_args, - ?Context $context = null, - ?CodeLocation $code_location = null - ): ?array; -} diff --git a/src/Psalm/Plugin/Hook/FunctionReturnTypeProviderInterface.php b/src/Psalm/Plugin/Hook/FunctionReturnTypeProviderInterface.php deleted file mode 100644 index 125d779f69a..00000000000 --- a/src/Psalm/Plugin/Hook/FunctionReturnTypeProviderInterface.php +++ /dev/null @@ -1,33 +0,0 @@ - - */ - public static function getFunctionIds(): array; - - /** - * Use this hook for providing custom return type logic. If this plugin does not know what a function should - * return but another plugin may be able to determine the type, return null. Otherwise return a mixed union type - * if something should be returned, but can't be more specific. - * - * @param list $call_args - */ - public static function getFunctionReturnType( - StatementsSource $statements_source, - string $function_id, - array $call_args, - Context $context, - CodeLocation $code_location - ): ?Union; -} diff --git a/src/Psalm/Plugin/Hook/MethodExistenceProviderInterface.php b/src/Psalm/Plugin/Hook/MethodExistenceProviderInterface.php deleted file mode 100644 index 2964fe60445..00000000000 --- a/src/Psalm/Plugin/Hook/MethodExistenceProviderInterface.php +++ /dev/null @@ -1,27 +0,0 @@ - - */ - public static function getClassLikeNames(): array; - - /** - * Use this hook for informing whether or not a method exists on a given object. If you know the method does - * not exist, return false. If you aren't sure if it exists or not, return null and the default analysis will - * continue to determine if the method actually exists. - */ - public static function doesMethodExist( - string $fq_classlike_name, - string $method_name_lowercase, - ?StatementsSource $source = null, - ?CodeLocation $code_location = null - ): ?bool; -} diff --git a/src/Psalm/Plugin/Hook/MethodParamsProviderInterface.php b/src/Psalm/Plugin/Hook/MethodParamsProviderInterface.php deleted file mode 100644 index 680c60a8ff7..00000000000 --- a/src/Psalm/Plugin/Hook/MethodParamsProviderInterface.php +++ /dev/null @@ -1,32 +0,0 @@ - - */ - public static function getClassLikeNames(): array; - - /** - * @param list $call_args - * - * @return ?array - */ - public static function getMethodParams( - string $fq_classlike_name, - string $method_name_lowercase, - ?array $call_args = null, - ?StatementsSource $statements_source = null, - ?Context $context = null, - ?CodeLocation $code_location = null - ): ?array; -} diff --git a/src/Psalm/Plugin/Hook/MethodReturnTypeProviderInterface.php b/src/Psalm/Plugin/Hook/MethodReturnTypeProviderInterface.php deleted file mode 100644 index c39a61ce89f..00000000000 --- a/src/Psalm/Plugin/Hook/MethodReturnTypeProviderInterface.php +++ /dev/null @@ -1,40 +0,0 @@ - - */ - public static function getClassLikeNames(): array; - - /** - * Use this hook for providing custom return type logic. If this plugin does not know what a method should return - * but another plugin may be able to determine the type, return null. Otherwise return a mixed union type if - * something should be returned, but can't be more specific. - * - * @param list $call_args - * @param ?array $template_type_parameters - * @param lowercase-string $method_name_lowercase - * @param lowercase-string $called_method_name_lowercase - */ - public static function getMethodReturnType( - StatementsSource $source, - string $fq_classlike_name, - string $method_name_lowercase, - array $call_args, - Context $context, - CodeLocation $code_location, - ?array $template_type_parameters = null, - ?string $called_fq_classlike_name = null, - ?string $called_method_name_lowercase = null - ): ?Union; -} diff --git a/src/Psalm/Plugin/Hook/MethodVisibilityProviderInterface.php b/src/Psalm/Plugin/Hook/MethodVisibilityProviderInterface.php deleted file mode 100644 index bf6113521e0..00000000000 --- a/src/Psalm/Plugin/Hook/MethodVisibilityProviderInterface.php +++ /dev/null @@ -1,24 +0,0 @@ - - */ - public static function getClassLikeNames(): array; - - public static function isMethodVisible( - StatementsSource $source, - string $fq_classlike_name, - string $method_name_lowercase, - Context $context, - ?CodeLocation $code_location = null - ): ?bool; -} diff --git a/src/Psalm/Plugin/Hook/PropertyExistenceProviderInterface.php b/src/Psalm/Plugin/Hook/PropertyExistenceProviderInterface.php deleted file mode 100644 index 6debbb96b4a..00000000000 --- a/src/Psalm/Plugin/Hook/PropertyExistenceProviderInterface.php +++ /dev/null @@ -1,31 +0,0 @@ - - */ - public static function getClassLikeNames(): array; - - /** - * Use this hook for informing whether or not a property exists on a given object. If you know the property does - * not exist, return false. If you aren't sure if it exists or not, return null and the default analysis will - * continue to determine if the property actually exists. - * - */ - public static function doesPropertyExist( - string $fq_classlike_name, - string $property_name, - bool $read_mode, - ?StatementsSource $source = null, - ?Context $context = null, - ?CodeLocation $code_location = null - ): ?bool; -} diff --git a/src/Psalm/Plugin/Hook/PropertyTypeProviderInterface.php b/src/Psalm/Plugin/Hook/PropertyTypeProviderInterface.php deleted file mode 100644 index 0e3f18fc280..00000000000 --- a/src/Psalm/Plugin/Hook/PropertyTypeProviderInterface.php +++ /dev/null @@ -1,24 +0,0 @@ - - */ - public static function getClassLikeNames(): array; - - public static function getPropertyType( - string $fq_classlike_name, - string $property_name, - bool $read_mode, - ?StatementsSource $source = null, - ?Context $context = null - ): ?Union; -} diff --git a/src/Psalm/Plugin/Hook/PropertyVisibilityProviderInterface.php b/src/Psalm/Plugin/Hook/PropertyVisibilityProviderInterface.php deleted file mode 100644 index 650b9447e1f..00000000000 --- a/src/Psalm/Plugin/Hook/PropertyVisibilityProviderInterface.php +++ /dev/null @@ -1,25 +0,0 @@ - - */ - public static function getClassLikeNames(): array; - - public static function isPropertyVisible( - StatementsSource $source, - string $fq_classlike_name, - string $property_name, - bool $read_mode, - Context $context, - CodeLocation $code_location - ): ?bool; -} diff --git a/src/Psalm/Plugin/Hook/StringInterpreterInterface.php b/src/Psalm/Plugin/Hook/StringInterpreterInterface.php deleted file mode 100644 index 976918ee5b4..00000000000 --- a/src/Psalm/Plugin/Hook/StringInterpreterInterface.php +++ /dev/null @@ -1,16 +0,0 @@ -config->eventDispatcher->registerClass($handler); - if (is_subclass_of($handler, LegacyPropertyExistenceProviderInterface::class) || - is_subclass_of($handler, PropertyExistenceProviderInterface::class) - ) { + if (is_subclass_of($handler, PropertyExistenceProviderInterface::class)) { $this->codebase->properties->property_existence_provider->registerClass($handler); } - if (is_subclass_of($handler, LegacyPropertyVisibilityProviderInterface::class) || - is_subclass_of($handler, PropertyVisibilityProviderInterface::class) - ) { + if (is_subclass_of($handler, PropertyVisibilityProviderInterface::class)) { $this->codebase->properties->property_visibility_provider->registerClass($handler); } - if (is_subclass_of($handler, LegacyPropertyTypeProviderInterface::class) || - is_subclass_of($handler, PropertyTypeProviderInterface::class) - ) { + if (is_subclass_of($handler, PropertyTypeProviderInterface::class)) { $this->codebase->properties->property_type_provider->registerClass($handler); } - if (is_subclass_of($handler, LegacyMethodExistenceProviderInterface::class) || - is_subclass_of($handler, MethodExistenceProviderInterface::class) - ) { + if (is_subclass_of($handler, MethodExistenceProviderInterface::class)) { $this->codebase->methods->existence_provider->registerClass($handler); } - if (is_subclass_of($handler, LegacyMethodVisibilityProviderInterface::class) || - is_subclass_of($handler, MethodVisibilityProviderInterface::class) - ) { + if (is_subclass_of($handler, MethodVisibilityProviderInterface::class)) { $this->codebase->methods->visibility_provider->registerClass($handler); } - if (is_subclass_of($handler, LegacyMethodReturnTypeProviderInterface::class) || - is_subclass_of($handler, MethodReturnTypeProviderInterface::class) - ) { + if (is_subclass_of($handler, MethodReturnTypeProviderInterface::class)) { $this->codebase->methods->return_type_provider->registerClass($handler); } - if (is_subclass_of($handler, LegacyMethodParamsProviderInterface::class) || - is_subclass_of($handler, MethodParamsProviderInterface::class) - ) { + if (is_subclass_of($handler, MethodParamsProviderInterface::class)) { $this->codebase->methods->params_provider->registerClass($handler); } - if (is_subclass_of($handler, LegacyFunctionExistenceProviderInterface::class) || - is_subclass_of($handler, FunctionExistenceProviderInterface::class) - ) { + if (is_subclass_of($handler, FunctionExistenceProviderInterface::class)) { $this->codebase->functions->existence_provider->registerClass($handler); } - if (is_subclass_of($handler, LegacyFunctionParamsProviderInterface::class) || - is_subclass_of($handler, FunctionParamsProviderInterface::class) - ) { + if (is_subclass_of($handler, FunctionParamsProviderInterface::class)) { $this->codebase->functions->params_provider->registerClass($handler); } - if (is_subclass_of($handler, LegacyFunctionReturnTypeProviderInterface::class) || - is_subclass_of($handler, FunctionReturnTypeProviderInterface::class) - ) { + if (is_subclass_of($handler, FunctionReturnTypeProviderInterface::class)) { $this->codebase->functions->return_type_provider->registerClass($handler); } } diff --git a/tests/Config/PluginTest.php b/tests/Config/PluginTest.php index 0734f7e0f06..096d51bcdc8 100644 --- a/tests/Config/PluginTest.php +++ b/tests/Config/PluginTest.php @@ -4,13 +4,9 @@ use InvalidArgumentException; use PHPUnit\Framework\MockObject\MockObject; -use PhpParser\Node\Expr; -use PhpParser\Node\Stmt\ClassLike; -use Psalm\Codebase; use Psalm\Config; use Psalm\Context; use Psalm\Exception\CodeException; -use Psalm\FileSource; use Psalm\Internal\Analyzer\ProjectAnalyzer; use Psalm\Internal\IncludeCollector; use Psalm\Internal\Provider\FakeFileProvider; @@ -21,18 +17,13 @@ use Psalm\Plugin\EventHandler\AfterEveryFunctionCallAnalysisInterface; use Psalm\Plugin\EventHandler\Event\AfterCodebasePopulatedEvent; use Psalm\Plugin\EventHandler\Event\AfterEveryFunctionCallAnalysisEvent; -use Psalm\Plugin\Hook\AfterClassLikeVisitInterface as LegacyAfterClassLikeVisitInterface; -use Psalm\Plugin\Hook\AfterMethodCallAnalysisInterface as LegacyAfterMethodCallAnalysisInterface; use Psalm\PluginRegistrationSocket; use Psalm\Report; use Psalm\Report\ReportOptions; -use Psalm\StatementsSource; -use Psalm\Storage\ClassLikeStorage; use Psalm\Test\Config\Plugin\Hook\StringProvider\TSqlSelectString; use Psalm\Tests\Internal\Provider\FakeParserCacheProvider; use Psalm\Tests\TestCase; use Psalm\Tests\TestConfig; -use Psalm\Type\Union; use stdClass; use function define; @@ -572,86 +563,6 @@ public static function afterCodebasePopulated(AfterCodebasePopulatedEvent $event ); } - public function testAfterMethodCallAnalysisLegacyHookIsLoaded(): void - { - $this->project_analyzer = $this->getProjectAnalyzerWithConfig( - TestConfig::loadFromXML( - dirname(__DIR__, 2) . DIRECTORY_SEPARATOR, - ' - - - - - ' - ) - ); - - $hook = new class implements LegacyAfterMethodCallAnalysisInterface { - public static function afterMethodCallAnalysis( - Expr $expr, - string $method_id, - string $appearing_method_id, - string $declaring_method_id, - Context $context, - StatementsSource $statements_source, - Codebase $codebase, - array &$file_replacements = [], - Union &$return_type_candidate = null - ): void { - } - }; - - $codebase = $this->project_analyzer->getCodebase(); - - $config = $codebase->config; - - (new PluginRegistrationSocket($config, $codebase))->registerHooksFromClass(get_class($hook)); - - $this->assertTrue($this->project_analyzer->getCodebase()->config->eventDispatcher->hasAfterMethodCallAnalysisHandlers()); - } - - public function testAfterClassLikeAnalysisLegacyHookIsLoaded(): void - { - $this->project_analyzer = $this->getProjectAnalyzerWithConfig( - TestConfig::loadFromXML( - dirname(__DIR__, 2) . DIRECTORY_SEPARATOR, - ' - - - - - ' - ) - ); - - $hook = new class implements LegacyAfterClassLikeVisitInterface { - /** - * @return void - * @phpcsSuppress SlevomatCodingStandard.TypeHints.ReturnTypeHint - */ - public static function afterClassLikeVisit( - ClassLike $stmt, - ClassLikeStorage $storage, - FileSource $statements_source, - Codebase $codebase, - array &$file_replacements = [] - ) { - } - }; - - $codebase = $this->project_analyzer->getCodebase(); - - $config = $codebase->config; - - (new PluginRegistrationSocket($config, $codebase))->registerHooksFromClass(get_class($hook)); - - $this->assertTrue($this->project_analyzer->getCodebase()->config->eventDispatcher->hasAfterClassLikeVisitHandlers()); - } - public function testPropertyProviderHooks(): void { require_once __DIR__ . '/Plugin/PropertyPlugin.php'; From 0a991e34670c5955795a7224f9573c4a49c6a03c Mon Sep 17 00:00:00 2001 From: Bruce Weirdan Date: Mon, 3 Jan 2022 18:34:54 +0200 Subject: [PATCH 2/2] Documented removal of legacy hook interfaces --- UPGRADING.md | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/UPGRADING.md b/UPGRADING.md index 2ee7fbbc47d..8b804f27960 100644 --- a/UPGRADING.md +++ b/UPGRADING.md @@ -127,3 +127,28 @@ - [BC] Property `Psalm\Config::$allow_phpstorm_generics` was removed - [BC] Property `Psalm\Config::$exit_functions` was removed - [BC] Method `Psalm\Type::getEmpty()` was removed + - [BC] Legacy hook interfaces have been removed: + - `Psalm\Plugin\Hook\MethodReturnTypeProviderInterface` + - `Psalm\Plugin\Hook\BeforeFileAnalysisInterface` + - `Psalm\Plugin\Hook\AfterFileAnalysisInterface` + - `Psalm\Plugin\Hook\AfterMethodCallAnalysisInterface` + - `Psalm\Plugin\Hook\AfterClassLikeVisitInterface` + - `Psalm\Plugin\Hook\StringInterpreterInterface` + - `Psalm\Plugin\Hook\AfterExpressionAnalysisInterface` + - `Psalm\Plugin\Hook\AfterEveryFunctionCallAnalysisInterface` + - `Psalm\Plugin\Hook\PropertyExistenceProviderInterface` + - `Psalm\Plugin\Hook\AfterFunctionLikeAnalysisInterface` + - `Psalm\Plugin\Hook\FunctionParamsProviderInterface` + - `Psalm\Plugin\Hook\FunctionReturnTypeProviderInterface` + - `Psalm\Plugin\Hook\FunctionExistenceProviderInterface` + - `Psalm\Plugin\Hook\AfterAnalysisInterface` + - `Psalm\Plugin\Hook\MethodVisibilityProviderInterface` + - `Psalm\Plugin\Hook\MethodParamsProviderInterface` + - `Psalm\Plugin\Hook\AfterClassLikeExistenceCheckInterface` + - `Psalm\Plugin\Hook\PropertyTypeProviderInterface` + - `Psalm\Plugin\Hook\AfterFunctionCallAnalysisInterface` + - `Psalm\Plugin\Hook\MethodExistenceProviderInterface` + - `Psalm\Plugin\Hook\AfterCodebasePopulatedInterface` + - `Psalm\Plugin\Hook\AfterClassLikeAnalysisInterface` + - `Psalm\Plugin\Hook\PropertyVisibilityProviderInterface` + - `Psalm\Plugin\Hook\AfterStatementAnalysisInterface`