Updated Rector to commit 5a156bea4f702a08d45928c783daf3153c6bd2de

5a156bea4f [Php80] Handle NestedAnnotationToAttributeRector with empty new line (#5448)
This commit is contained in:
Tomas Votruba 2024-01-09 08:51:33 +00:00
parent 503f4ead06
commit cc3c45157f
2 changed files with 12 additions and 2 deletions

View File

@ -19,12 +19,12 @@ final class VersionResolver
* @api
* @var string
*/
public const PACKAGE_VERSION = '0.19.0';
public const PACKAGE_VERSION = '5a156bea4f702a08d45928c783daf3153c6bd2de';
/**
* @api
* @var string
*/
public const RELEASE_DATE = '2024-01-09 01:02:09';
public const RELEASE_DATE = '2024-01-09 15:49:28';
/**
* @var int
*/

View File

@ -3,7 +3,9 @@
declare (strict_types=1);
namespace Rector\BetterPhpDocParser\PhpDocParser;
use RectorPrefix202401\Nette\Utils\Strings;
use PhpParser\Node;
use PHPStan\PhpDocParser\Ast\PhpDoc\GenericTagValueNode;
use PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocChildNode;
use PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocNode;
use PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagNode;
@ -41,6 +43,11 @@ final class BetterPhpDocParser extends PhpDocParser
* @var \Rector\Util\Reflection\PrivatesAccessor
*/
private $privatesAccessor;
/**
* @var string
* @see https://regex101.com/r/JOKSmr/1
*/
private const MULTI_NEW_LINES_REGEX = '#(\\n\\r|\\n){2,}#';
/**
* @param PhpDocNodeDecoratorInterface[] $phpDocNodeDecorators
*/
@ -109,6 +116,9 @@ final class BetterPhpDocParser extends PhpDocParser
}
$startAndEnd = new StartAndEnd($startPosition, $endPosition);
$phpDocTagValueNode->setAttribute(PhpDocAttributeKey::START_AND_END, $startAndEnd);
if ($phpDocTagValueNode instanceof GenericTagValueNode) {
$phpDocTagValueNode->value = Strings::replace($phpDocTagValueNode->value, self::MULTI_NEW_LINES_REGEX, "\n");
}
return $phpDocTagValueNode;
}
/**