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

Add code to handle SimpleXMLElement

This commit is contained in:
Matthew Brown 2016-08-07 13:58:46 -04:00
parent 620d4afd68
commit c58458ed20

View File

@ -1088,7 +1088,10 @@ class StatementsChecker
continue;
}
if ($lhs_type_part->isObject() || (string) $lhs_type_part === 'stdClass') {
// stdClass and SimpleXMLElement are special cases where we cannot infer the return types
// but we don't want to throw an error
// Hack has a similar issue: https://github.com/facebook/hhvm/issues/5164
if ($lhs_type_part->isObject() || $lhs_type_part->value === 'stdClass' || $lhs_type_part->value === 'SimpleXMLElement') {
$stmt->inferredType = Type::getMixed();
continue;
}