mirror of
https://github.com/rectorphp/rector.git
synced 2025-04-21 07:52:01 +02:00
Updated Rector to commit 832e458817d9d7bff06ba321aea44a9ce3bb7819
832e458817
[Php80] Handle value as argument with keep description as comment on AttributeValueResolver (#6589)
This commit is contained in:
parent
262b29c337
commit
d8645f1325
@ -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
|
||||
|
@ -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
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user