diff --git a/src/Psalm/Internal/Analyzer/CommentAnalyzer.php b/src/Psalm/Internal/Analyzer/CommentAnalyzer.php index 00a3f8a20..b2d34db51 100644 --- a/src/Psalm/Internal/Analyzer/CommentAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/CommentAnalyzer.php @@ -259,7 +259,7 @@ class CommentAnalyzer public static function sanitizeDocblockType(string $docblock_type): string { $docblock_type = preg_replace('@^[ \t]*\*@m', '', $docblock_type); - $docblock_type = preg_replace('/,\n\s+\}/', '}', $docblock_type); + $docblock_type = preg_replace('/,\n\s+}/', '}', $docblock_type); return str_replace("\n", '', $docblock_type); } @@ -377,7 +377,7 @@ class CommentAnalyzer $remaining = trim(preg_replace('@^[ \t]*\* *@m', ' ', substr($return_block, $i + 1))); if ($remaining) { - return array_merge([rtrim($type)], preg_split('/[ \s]+/', $remaining) ?: []); + return array_merge([rtrim($type)], preg_split('/\s+/', $remaining) ?: []); } return [$type]; diff --git a/tests/TypeReconciliation/ConditionalTest.php b/tests/TypeReconciliation/ConditionalTest.php index cca5bee0f..48a845268 100644 --- a/tests/TypeReconciliation/ConditionalTest.php +++ b/tests/TypeReconciliation/ConditionalTest.php @@ -2433,7 +2433,7 @@ class ConditionalTest extends TestCase if ($remaining) { /** @var array */ - return array_merge([rtrim($type)], preg_split(\'/[ \s]+/\', $remaining)); + return array_merge([rtrim($type)], preg_split(\'/\s+/\', $remaining)); } return [$type];