From d85a9f8be08769dc2d3fcc7bf4793a2556ef7c89 Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Tue, 13 Feb 2024 10:48:33 +0000 Subject: [PATCH] Updated Rector to commit 539cfeb35c55cec4b2b5b20045cfdc4a437728f4 https://github.com/rectorphp/rector-src/commit/539cfeb35c55cec4b2b5b20045cfdc4a437728f4 [BetterPhpDocParser] Move split new line with @\ to regex to support windows new line (#5615) --- src/Application/VersionResolver.php | 4 ++-- .../PhpDocParser/DoctrineAnnotationDecorator.php | 11 ++++++++--- vendor/scoper-autoload.php | 2 +- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/Application/VersionResolver.php b/src/Application/VersionResolver.php index 4b740de0444..352427e6ac6 100644 --- a/src/Application/VersionResolver.php +++ b/src/Application/VersionResolver.php @@ -19,12 +19,12 @@ final class VersionResolver * @api * @var string */ - public const PACKAGE_VERSION = '95f9772f17b436fce469f68b1ed09445131235ee'; + public const PACKAGE_VERSION = '539cfeb35c55cec4b2b5b20045cfdc4a437728f4'; /** * @api * @var string */ - public const RELEASE_DATE = '2024-02-13 12:05:45'; + public const RELEASE_DATE = '2024-02-13 17:46:10'; /** * @var int */ diff --git a/src/BetterPhpDocParser/PhpDocParser/DoctrineAnnotationDecorator.php b/src/BetterPhpDocParser/PhpDocParser/DoctrineAnnotationDecorator.php index 78576dd9c54..7edaefb75d8 100644 --- a/src/BetterPhpDocParser/PhpDocParser/DoctrineAnnotationDecorator.php +++ b/src/BetterPhpDocParser/PhpDocParser/DoctrineAnnotationDecorator.php @@ -59,6 +59,11 @@ final class DoctrineAnnotationDecorator implements PhpDocNodeDecoratorInterface * @var string */ private const NESTED_ANNOTATION_END_REGEX = '#(\\s+)?\\}\\)(\\s+)?#'; + /** + * @see https://regex101.com/r/8rWY4r/1 + * @var string + */ + private const NEWLINE_ANNOTATION_FQCN_REGEX = '#\\r?\\n@\\\\#'; public function __construct(\Rector\BetterPhpDocParser\PhpDocParser\ClassAnnotationMatcher $classAnnotationMatcher, \Rector\BetterPhpDocParser\PhpDocParser\StaticDoctrineAnnotationParser $staticDoctrineAnnotationParser, TokenIteratorFactory $tokenIteratorFactory, AttributeMirrorer $attributeMirrorer) { $this->classAnnotationMatcher = $classAnnotationMatcher; @@ -145,9 +150,9 @@ final class DoctrineAnnotationDecorator implements PhpDocNodeDecoratorInterface if ($spacelessPhpDocTagNodes === []) { return; } - $texts = \explode("\n@\\", $phpDocTextNode->text); + $texts = Strings::split($phpDocTextNode->text, self::NEWLINE_ANNOTATION_FQCN_REGEX); $otherText = $texts[0]; - if (\strncmp($otherText, '@\\', \strlen('@\\')) !== 0 && \trim($otherText) !== '') { + if (\strncmp((string) $otherText, '@\\', \strlen('@\\')) !== 0 && \trim((string) $otherText) !== '') { $phpDocNode->children[$key] = new PhpDocTextNode($otherText); \array_splice($phpDocNode->children, $key + 1, 0, $spacelessPhpDocTagNodes); return; @@ -196,7 +201,7 @@ final class DoctrineAnnotationDecorator implements PhpDocNodeDecoratorInterface continue; } Assert::isAOf($phpDocNode->children[$key], PhpDocTagNode::class); - $texts = \explode("\n@\\", $phpDocChildNode->value->value); + $texts = Strings::split($phpDocChildNode->value->value, self::NEWLINE_ANNOTATION_FQCN_REGEX); $phpDocNode->children[$key]->value = new GenericTagValueNode($texts[0]); $phpDocNode->children[$key]->value->setAttribute(PhpDocAttributeKey::START_AND_END, $startAndEnd); $spacelessPhpDocTagNode = $this->createSpacelessPhpDocTagNode($phpDocNode->children[$key]->name, $phpDocNode->children[$key]->value, $fullyQualifiedAnnotationClass, $currentPhpNode); diff --git a/vendor/scoper-autoload.php b/vendor/scoper-autoload.php index 24142a71a40..9c0b012435c 100644 --- a/vendor/scoper-autoload.php +++ b/vendor/scoper-autoload.php @@ -14,7 +14,7 @@ $loader = (static function () { // Restore the backup and ensure the excluded files are properly marked as loaded $GLOBALS['__composer_autoload_files'] = \array_merge( $existingComposerAutoloadFiles, - \array_fill_keys(['0e6d7bf4a5811bfa5cf40c5ccd6fae6a', '5928a00fa978807cf85d90ec3f4b0147'], true) + \array_fill_keys(['5928a00fa978807cf85d90ec3f4b0147', '0e6d7bf4a5811bfa5cf40c5ccd6fae6a'], true) ); return $loader;