1
0
mirror of https://github.com/danog/psalm.git synced 2024-12-02 09:37:59 +01:00

Only crash Psalm when the faulty file is in project (#4658)

This commit is contained in:
orklah 2020-11-22 15:07:00 +01:00 committed by Daniil Gentili
parent ecb201a312
commit 2b19795f29
Signed by: danog
GPG Key ID: 8C1BE3B34B230CA7

View File

@ -12,6 +12,7 @@ use function str_replace;
use function strlen; use function strlen;
use function strrpos; use function strrpos;
use function substr; use function substr;
use function in_array;
/** /**
* @internal * @internal
@ -93,9 +94,15 @@ class PropertyDocblockManipulator
$file_contents = $codebase->getFileContents($file_path); $file_contents = $codebase->getFileContents($file_path);
if (count($stmt->props) > 1) { if (count($stmt->props) > 1) {
if (in_array($file_path, $project_analyzer->getConfig()->getProjectFiles())) {
throw new \UnexpectedValueException('Cannot replace multiple inline properties in ' . $file_path); throw new \UnexpectedValueException('Cannot replace multiple inline properties in ' . $file_path);
} }
$this->indentation = '';
return;
}
$prop = $stmt->props[0]; $prop = $stmt->props[0];
if ($stmt->type) { if ($stmt->type) {