From 2b19795f2986e4693c14d081ff0ad69ec3f2c638 Mon Sep 17 00:00:00 2001 From: orklah Date: Sun, 22 Nov 2020 15:07:00 +0100 Subject: [PATCH] Only crash Psalm when the faulty file is in project (#4658) --- .../FileManipulation/PropertyDocblockManipulator.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Psalm/Internal/FileManipulation/PropertyDocblockManipulator.php b/src/Psalm/Internal/FileManipulation/PropertyDocblockManipulator.php index 6aeac6c06..7ca756773 100644 --- a/src/Psalm/Internal/FileManipulation/PropertyDocblockManipulator.php +++ b/src/Psalm/Internal/FileManipulation/PropertyDocblockManipulator.php @@ -12,6 +12,7 @@ use function str_replace; use function strlen; use function strrpos; use function substr; +use function in_array; /** * @internal @@ -93,7 +94,13 @@ class PropertyDocblockManipulator $file_contents = $codebase->getFileContents($file_path); if (count($stmt->props) > 1) { - throw new \UnexpectedValueException('Cannot replace multiple inline properties in ' . $file_path); + if (in_array($file_path, $project_analyzer->getConfig()->getProjectFiles())) { + throw new \UnexpectedValueException('Cannot replace multiple inline properties in ' . $file_path); + } + + $this->indentation = ''; + + return; } $prop = $stmt->props[0];