1
0
mirror of https://github.com/danog/psalm.git synced 2025-01-21 21:31:13 +01:00

Perform more granular scan for PossiblyInvalidPropertyAssignmentValue

This commit is contained in:
Matthew Brown 2018-03-20 23:44:26 -04:00
parent f47012823e
commit 75e76eb327

View File

@ -550,6 +550,18 @@ class PropertyAssignmentChecker
}
if (!$type_match_found && !$type_coerced) {
foreach ($class_property_type->getTypes() as $class_property_type_part) {
if (TypeChecker::isContainedBy(
$project_checker->codebase,
$assignment_value_type,
new Type\Union([$class_property_type_part]),
true,
true
)) {
$has_valid_assignment_value_type = true;
}
}
$invalid_assignment_value_types[] = (string) $class_property_type;
} else {
$has_valid_assignment_value_type = true;