mirror of
https://github.com/danog/psalm.git
synced 2024-11-26 20:34:47 +01:00
Fix references
This commit is contained in:
parent
07c9cfb848
commit
4f597a4068
@ -1067,11 +1067,13 @@ abstract class ClassLikeChecker extends SourceChecker implements StatementsSourc
|
||||
*
|
||||
* @param string $fq_class_name
|
||||
* @param FileChecker $file_checker
|
||||
* @param CodeLocation $code_location
|
||||
* @return bool
|
||||
*/
|
||||
public static function classOrInterfaceExists(
|
||||
$fq_class_name,
|
||||
FileChecker $file_checker
|
||||
FileChecker $file_checker,
|
||||
CodeLocation $code_location = null
|
||||
) {
|
||||
if (!ClassChecker::classExists($fq_class_name, $file_checker) &&
|
||||
!InterfaceChecker::interfaceExists($fq_class_name, $file_checker)
|
||||
@ -1079,7 +1081,7 @@ abstract class ClassLikeChecker extends SourceChecker implements StatementsSourc
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($file_checker->project_checker->collect_references) {
|
||||
if ($file_checker->project_checker->collect_references && $code_location) {
|
||||
$class_storage = ClassLikeChecker::$storage[strtolower($fq_class_name)];
|
||||
$class_storage->referencing_locations[] = $code_location;
|
||||
}
|
||||
|
@ -1434,14 +1434,18 @@ class CallChecker
|
||||
$offset_value_type = Type::parseString($arg->value->value);
|
||||
}
|
||||
|
||||
// register class if the class exists
|
||||
if ($offset_value_type instanceof TNamedObject) {
|
||||
ClassLikeChecker::checkFullyQualifiedClassLikeName(
|
||||
$offset_value_type->value,
|
||||
$statements_checker->getFileChecker(),
|
||||
new CodeLocation($statements_checker->getSource(), $arg->value),
|
||||
$statements_checker->getSuppressedIssues()
|
||||
);
|
||||
if ($offset_value_type) {
|
||||
foreach ($offset_value_type->types as $offset_value_type_part) {
|
||||
// register class if the class exists
|
||||
if ($offset_value_type_part instanceof TNamedObject) {
|
||||
ClassLikeChecker::checkFullyQualifiedClassLikeName(
|
||||
$offset_value_type_part->value,
|
||||
$statements_checker->getFileChecker(),
|
||||
new CodeLocation($statements_checker->getSource(), $arg->value),
|
||||
$statements_checker->getSuppressedIssues()
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($generic_params === null) {
|
||||
|
Loading…
Reference in New Issue
Block a user