From 5f5070276d8af51fcb0895775efea8b61242916a Mon Sep 17 00:00:00 2001 From: Bruce Weirdan Date: Mon, 6 Apr 2020 01:31:38 +0300 Subject: [PATCH] Shim queueClassLikeForScanning --- src/Hooks/TestCaseHandler.php | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/Hooks/TestCaseHandler.php b/src/Hooks/TestCaseHandler.php index 63f1838..c182fe0 100644 --- a/src/Hooks/TestCaseHandler.php +++ b/src/Hooks/TestCaseHandler.php @@ -20,6 +20,8 @@ use Psalm\StatementsSource; use Psalm\Storage\ClassLikeStorage; use Psalm\Type; +use Psalm\Type\Atomic\TIterable; +use Psalm\Type\Union; class TestCaseHandler implements AfterClassLikeVisitInterface, @@ -89,7 +91,7 @@ public static function afterClassLikeVisit( if (false !== strpos($provider, '::')) { [$class_name] = explode('::', $provider); $fq_class_name = Type::getFQCLNFromString($class_name, $statements_source->getAliases()); - $codebase->scanner->queueClassLikeForScanning($fq_class_name, $file_path); + self::queueClassLikeForScanning($codebase, $fq_class_name, $file_path); $file_storage->referenced_classlikes[strtolower($fq_class_name)] = $fq_class_name; } } @@ -515,4 +517,17 @@ function (array $lines): array { } return []; } + + private static function queueClassLikeForScanning( + Codebase $codebase, + string $fq_class_name, + string $file_path + ): void { + if (method_exists($codebase, 'queueClassLikeForScanning')) { + $codebase->queueClassLikeForScanning($fq_class_name); + } else { + /** @psalm-suppress InvalidScalarArgument */ + $codebase->scanner->queueClassLikeForScanning($fq_class_name, $file_path); + } + } }