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

Stop analysing statements if expression has errors

This commit is contained in:
Matthew Brown 2017-10-12 20:24:22 -04:00
parent b7f6d15a24
commit 38c8a1d9cf
2 changed files with 5 additions and 3 deletions

View File

@ -230,7 +230,9 @@ class StatementsChecker extends SourceChecker implements StatementsSource
}
}
} elseif ($stmt instanceof PhpParser\Node\Expr) {
ExpressionChecker::analyze($this, $stmt, $context);
if (ExpressionChecker::analyze($this, $stmt, $context) === false) {
return false;
}
} elseif ($stmt instanceof PhpParser\Node\Stmt\InlineHTML) {
// do nothing
} elseif ($stmt instanceof PhpParser\Node\Stmt\Global_) {

View File

@ -52,7 +52,7 @@ class CacheProvider
filemtime($cache_location) > $file_modified_time
) {
/** @var array<int, \PhpParser\Node\Stmt> */
return unserialize((string)file_get_contents($cache_location)) ?: null;
return igbinary_unserialize((string)file_get_contents($cache_location)) ?: null;
}
}
@ -103,7 +103,7 @@ class CacheProvider
mkdir($parser_cache_directory, 0777, true);
}
file_put_contents($cache_location, serialize($stmts));
file_put_contents($cache_location, igbinary_serialize($stmts));
$this->file_content_hashes[$file_cache_key] = $file_content_hash;