1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-30 04:39:00 +01:00

Add references to property-defining classes

This commit is contained in:
Brown 2020-02-26 16:49:14 -05:00
parent f1dbd0863a
commit 548d9fca2c
2 changed files with 17 additions and 2 deletions

View File

@ -126,6 +126,13 @@ class Methods
return false;
}
if ($source && $fq_class_name !== $source->getFQCLN()) {
$this->file_reference_provider->addFileReferenceToClass(
$source->getFilePath(),
$fq_class_name
);
}
if (isset($class_storage->declaring_method_ids[$method_name])) {
$declaring_method_id = $class_storage->declaring_method_ids[$method_name];

View File

@ -78,6 +78,7 @@ class Properties
$property_id = preg_replace('/^\\\\/', '', $property_id);
list($fq_class_name, $property_name) = explode('::$', $property_id);
$fq_class_name_lc = strtolower($fq_class_name);
if ($this->property_existence_provider->has($fq_class_name)) {
$property_exists = $this->property_existence_provider->doesPropertyExist(
@ -96,6 +97,13 @@ class Properties
$class_storage = $this->classlike_storage_provider->get($fq_class_name);
if ($source && $context && $context->self !== $fq_class_name) {
$this->file_reference_provider->addFileReferenceToClass(
$source->getFilePath(),
$fq_class_name_lc
);
}
if (isset($class_storage->declaring_property_ids[$property_name])) {
$declaring_property_class = $class_storage->declaring_property_ids[$property_name];
@ -124,12 +132,12 @@ class Properties
if ($context && $context->calling_function_id) {
$this->file_reference_provider->addMethodReferenceToMissingClassMember(
$context->calling_function_id,
strtolower($fq_class_name) . '::$' . $property_name
$fq_class_name_lc . '::$' . $property_name
);
} elseif ($source) {
$this->file_reference_provider->addFileReferenceToMissingClassMember(
$source->getFilePath(),
strtolower($fq_class_name) . '::$' . $property_name
$fq_class_name_lc . '::$' . $property_name
);
}