Skip to content

Commit 43c44ee

Browse files
committed
Properly restore error handler for collecting errors
1 parent 6e87a98 commit 43c44ee

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Analyser/FileAnalyser.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -266,15 +266,15 @@ public function analyseFile(
266266
InternalError::STACK_TRACE_METADATA_KEY => InternalError::prepareTrace($e),
267267
InternalError::STACK_TRACE_AS_STRING_METADATA_KEY => $e->getTraceAsString(),
268268
]);
269+
} finally {
270+
$this->restoreCollectErrorsHandler();
269271
}
270272
} elseif (is_dir($file)) {
271273
$fileErrors[] = (new Error(sprintf('File %s is a directory.', $file), $file, null, false))->withIdentifier('phpstan.path');
272274
} else {
273275
$fileErrors[] = (new Error(sprintf('File %s does not exist.', $file), $file, null, false))->withIdentifier('phpstan.path');
274276
}
275277

276-
$this->restoreCollectErrorsHandler();
277-
278278
foreach ($linesToIgnore as $fileKey => $lines) {
279279
if (count($lines) > 0) {
280280
continue;

0 commit comments

Comments
 (0)