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

Fix invariance checks

This commit is contained in:
Matt Brown 2021-02-07 01:58:03 -05:00
parent 4d76f7545c
commit 5e2d252edb

View File

@ -670,16 +670,25 @@ class ClassAnalyzer extends ClassLikeAnalyzer
&& $guide_property_storage->signature_type)
|| ($property_storage->signature_type
&& $guide_property_storage->signature_type
&& !$property_storage->type->equals($guide_property_storage->type)))
&& !$property_storage->signature_type->equals(
$guide_property_storage->signature_type
)))
&& $property_storage->location
) {
if (IssueBuffer::accepts(
new NonInvariantPropertyType(
'Property ' . $fq_class_name . '::$' . $property_name
. ' has type ' . $property_storage->type->getId()
. ' has type '
. ($property_storage->signature_type
? $property_storage->signature_type->getId()
: '<empty>'
)
. ", not invariant with " . $guide_class_name . '::$'
. $property_name . ' of type '
. $guide_property_storage->type->getId(),
. ($guide_property_storage->signature_type
? $guide_property_storage->signature_type->getId()
: '<empty>'
),
$property_storage->location
),
$property_storage->suppressed_issues