Updated Rector to commit 832e458817d9d7bff06ba321aea44a9ce3bb7819

832e458817 [Php80] Handle value as argument with keep description as comment on AttributeValueResolver (#6589)
This commit is contained in:
Tomas Votruba 2024-12-14 20:29:53 +00:00
parent 262b29c337
commit d8645f1325
2 changed files with 16 additions and 5 deletions

View File

@ -6,6 +6,7 @@ namespace Rector\Php80\Rector\Class_;
use RectorPrefix202412\Nette\Utils\Strings;
use PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagNode;
use Rector\BetterPhpDocParser\PhpDoc\DoctrineAnnotationTagValueNode;
use Rector\NodeTypeResolver\Node\AttributeKey;
use Rector\Php80\ValueObject\AnnotationToAttribute;
use Rector\Php80\ValueObject\AttributeValueAndDocComment;
use Rector\Util\NewLineSplitter;
@ -21,10 +22,20 @@ final class AttributeValueResolver
if (!$annotationToAttribute->getUseValueAsAttributeArgument()) {
return null;
}
$docValue = (string) $phpDocTagNode->value;
if ($phpDocTagNode->value instanceof DoctrineAnnotationTagValueNode) {
$docValue = (string) $phpDocTagNode->value->getOriginalContent();
} else {
$docValue = (string) $phpDocTagNode->value;
$originalContent = (string) $phpDocTagNode->value->getOriginalContent();
if ($docValue === '') {
$attributeComment = (string) $phpDocTagNode->value->getAttribute(AttributeKey::ATTRIBUTE_COMMENT);
if ($originalContent === $attributeComment) {
$docValue = $originalContent;
}
} else {
$attributeComment = \ltrim($originalContent, $docValue);
if ($attributeComment !== '') {
$docValue .= "\n" . $attributeComment;
}
}
}
$docComment = '';
// special case for newline

View File

@ -19,12 +19,12 @@ final class VersionResolver
* @api
* @var string
*/
public const PACKAGE_VERSION = '171afe1ffc99f609981d6c7a03c4e97b319cc92a';
public const PACKAGE_VERSION = '832e458817d9d7bff06ba321aea44a9ce3bb7819';
/**
* @api
* @var string
*/
public const RELEASE_DATE = '2024-12-14 19:30:07';
public const RELEASE_DATE = '2024-12-15 03:27:26';
/**
* @var int
*/