Skip to content

Commit

Permalink
Shim queueClassLikeForScanning
Browse files Browse the repository at this point in the history
  • Loading branch information
weirdan committed Apr 5, 2020
1 parent a87e003 commit 5f50702
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/Hooks/TestCaseHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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;
}
}
Expand Down Expand Up @@ -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);
}
}
}

0 comments on commit 5f50702

Please sign in to comment.