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

regex cleanup

This commit is contained in:
kkmuffme 2023-06-13 22:07:51 +02:00
parent d4732f118e
commit 16aaa3ae2b
2 changed files with 3 additions and 3 deletions

View File

@ -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];

View File

@ -2433,7 +2433,7 @@ class ConditionalTest extends TestCase
if ($remaining) {
/** @var array<string> */
return array_merge([rtrim($type)], preg_split(\'/[ \s]+/\', $remaining));
return array_merge([rtrim($type)], preg_split(\'/\s+/\', $remaining));
}
return [$type];