1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-26 20:34:47 +01:00

Limit constructor check invalidation

This commit is contained in:
Brown 2020-03-02 11:20:52 -05:00
parent d5186308d0
commit 61ecd2a5fe
2 changed files with 17 additions and 2 deletions

View File

@ -642,7 +642,22 @@ class Analyzer
if (isset($all_referencing_methods[$unchanged_signature_member_id])) {
foreach ($all_referencing_methods[$unchanged_signature_member_id] as $referencing_method_id => $_) {
if (substr($referencing_method_id, -13) === '::__construct') {
$newly_invalidated_methods[$referencing_method_id] = true;
$referencing_base_classlike = explode('::', $referencing_method_id)[0];
$unchanged_signature_classlike = explode('::', $unchanged_signature_member_id)[0];
if ($referencing_base_classlike === $unchanged_signature_classlike) {
$newly_invalidated_methods[$referencing_method_id] = true;
} else {
$referencing_storage = $codebase->classlike_storage_provider->get(
$referencing_base_classlike
);
if (isset($referencing_storage->used_traits[$unchanged_signature_classlike])
|| isset($referencing_storage->parent_classes[$unchanged_signature_classlike])
) {
$newly_invalidated_methods[$referencing_method_id] = true;
}
}
}
}
}

View File

@ -182,7 +182,7 @@ class ClassLikeStorage
/**
* Parent classes
*
* @var array<string, string>
* @var array<lowercase-string, string>
*/
public $parent_classes = [];