Updated Rector to commit 539cfeb35c55cec4b2b5b20045cfdc4a437728f4

539cfeb35c [BetterPhpDocParser] Move split new line with @\ to regex to support windows new line (#5615)
This commit is contained in:
Tomas Votruba 2024-02-13 10:48:33 +00:00
parent adf6cdfc87
commit d85a9f8be0
3 changed files with 11 additions and 6 deletions

View File

@ -19,12 +19,12 @@ final class VersionResolver
* @api * @api
* @var string * @var string
*/ */
public const PACKAGE_VERSION = '95f9772f17b436fce469f68b1ed09445131235ee'; public const PACKAGE_VERSION = '539cfeb35c55cec4b2b5b20045cfdc4a437728f4';
/** /**
* @api * @api
* @var string * @var string
*/ */
public const RELEASE_DATE = '2024-02-13 12:05:45'; public const RELEASE_DATE = '2024-02-13 17:46:10';
/** /**
* @var int * @var int
*/ */

View File

@ -59,6 +59,11 @@ final class DoctrineAnnotationDecorator implements PhpDocNodeDecoratorInterface
* @var string * @var string
*/ */
private const NESTED_ANNOTATION_END_REGEX = '#(\\s+)?\\}\\)(\\s+)?#'; 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) public function __construct(\Rector\BetterPhpDocParser\PhpDocParser\ClassAnnotationMatcher $classAnnotationMatcher, \Rector\BetterPhpDocParser\PhpDocParser\StaticDoctrineAnnotationParser $staticDoctrineAnnotationParser, TokenIteratorFactory $tokenIteratorFactory, AttributeMirrorer $attributeMirrorer)
{ {
$this->classAnnotationMatcher = $classAnnotationMatcher; $this->classAnnotationMatcher = $classAnnotationMatcher;
@ -145,9 +150,9 @@ final class DoctrineAnnotationDecorator implements PhpDocNodeDecoratorInterface
if ($spacelessPhpDocTagNodes === []) { if ($spacelessPhpDocTagNodes === []) {
return; return;
} }
$texts = \explode("\n@\\", $phpDocTextNode->text); $texts = Strings::split($phpDocTextNode->text, self::NEWLINE_ANNOTATION_FQCN_REGEX);
$otherText = $texts[0]; $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); $phpDocNode->children[$key] = new PhpDocTextNode($otherText);
\array_splice($phpDocNode->children, $key + 1, 0, $spacelessPhpDocTagNodes); \array_splice($phpDocNode->children, $key + 1, 0, $spacelessPhpDocTagNodes);
return; return;
@ -196,7 +201,7 @@ final class DoctrineAnnotationDecorator implements PhpDocNodeDecoratorInterface
continue; continue;
} }
Assert::isAOf($phpDocNode->children[$key], PhpDocTagNode::class); 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 = new GenericTagValueNode($texts[0]);
$phpDocNode->children[$key]->value->setAttribute(PhpDocAttributeKey::START_AND_END, $startAndEnd); $phpDocNode->children[$key]->value->setAttribute(PhpDocAttributeKey::START_AND_END, $startAndEnd);
$spacelessPhpDocTagNode = $this->createSpacelessPhpDocTagNode($phpDocNode->children[$key]->name, $phpDocNode->children[$key]->value, $fullyQualifiedAnnotationClass, $currentPhpNode); $spacelessPhpDocTagNode = $this->createSpacelessPhpDocTagNode($phpDocNode->children[$key]->name, $phpDocNode->children[$key]->value, $fullyQualifiedAnnotationClass, $currentPhpNode);

View File

@ -14,7 +14,7 @@ $loader = (static function () {
// Restore the backup and ensure the excluded files are properly marked as loaded // Restore the backup and ensure the excluded files are properly marked as loaded
$GLOBALS['__composer_autoload_files'] = \array_merge( $GLOBALS['__composer_autoload_files'] = \array_merge(
$existingComposerAutoloadFiles, $existingComposerAutoloadFiles,
\array_fill_keys(['0e6d7bf4a5811bfa5cf40c5ccd6fae6a', '5928a00fa978807cf85d90ec3f4b0147'], true) \array_fill_keys(['5928a00fa978807cf85d90ec3f4b0147', '0e6d7bf4a5811bfa5cf40c5ccd6fae6a'], true)
); );
return $loader; return $loader;