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

Fix null checks

This commit is contained in:
Matthew Brown 2020-02-23 18:20:59 -05:00
parent 41e076e0ee
commit ed4f4e35b8

View File

@ -926,7 +926,10 @@ class BinaryOpAnalyzer
$statements_analyzer->node_data->setType($stmt, Type::getBool());
}
if ($stmt instanceof PhpParser\Node\Expr\BinaryOp\Equal) {
if ($stmt instanceof PhpParser\Node\Expr\BinaryOp\Equal
&& $stmt_left_type
&& $stmt_right_type
) {
if ($stmt_left_type->hasString() && $stmt_right_type->hasObjectType()) {
foreach ($stmt_right_type->getAtomicTypes() as $atomic_type) {
if ($atomic_type instanceof TNamedObject) {