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

Fixed codestyle for CommentAnalyzer and use plain instead of multibite string functions

This commit is contained in:
rhertogh 2023-07-06 23:54:50 +02:00
parent 356e6d7bbd
commit 2285c9d4bd

View File

@ -38,6 +38,8 @@ use function substr;
use function substr_count; use function substr_count;
use function trim; use function trim;
use const PREG_OFFSET_CAPTURE;
/** /**
* @internal * @internal
*/ */
@ -264,9 +266,9 @@ class CommentAnalyzer
// Strip out remainders of a line when inline comment is encountered inside curly braces. // Strip out remainders of a line when inline comment is encountered inside curly braces.
if (preg_match('/{(?>[^{}]|(?R))*}/', $docblock_type, $braceMatches, PREG_OFFSET_CAPTURE)) { if (preg_match('/{(?>[^{}]|(?R))*}/', $docblock_type, $braceMatches, PREG_OFFSET_CAPTURE)) {
$docblock_type = $docblock_type =
mb_substr($docblock_type, 0, $braceMatches[0][1]) substr($docblock_type, 0, $braceMatches[0][1])
. preg_replace('%//.*$%m', '', $braceMatches[0][0]) . preg_replace('%//.*$%m', '', $braceMatches[0][0])
. mb_substr($docblock_type, $braceMatches[0][1] + mb_strlen($braceMatches[0][0])); . substr($docblock_type, $braceMatches[0][1] + strlen($braceMatches[0][0]));
} }
return str_replace("\n", '', $docblock_type); return str_replace("\n", '', $docblock_type);