Updated Rector to commit 6192fe3285c1dc5ac7f28afac485b8facd018b39

6192fe3285 Fix annotation on doctrine one (#6582)
This commit is contained in:
Tomas Votruba 2024-12-14 01:48:37 +00:00
parent d9c60856fd
commit 45946d795d
4 changed files with 25 additions and 16 deletions

View File

@ -172,6 +172,18 @@ CODE_SAMPLE
$node->attrGroups = \array_merge($node->attrGroups, $attributeGroups);
return $node;
}
/**
* @param mixed[] $configuration
*/
public function configure(array $configuration) : void
{
Assert::allIsAOf($configuration, AnnotationToAttribute::class);
$this->annotationsToAttributes = $configuration;
}
public function provideMinPhpVersion() : int
{
return PhpVersionFeature::ATTRIBUTES;
}
private function cleanLeftOverComment(Node $node) : void
{
$comments = $node->getComments();
@ -186,18 +198,6 @@ CODE_SAMPLE
}
$node->setAttribute(AttributeKey::COMMENTS, \array_values($comments));
}
/**
* @param mixed[] $configuration
*/
public function configure(array $configuration) : void
{
Assert::allIsAOf($configuration, AnnotationToAttribute::class);
$this->annotationsToAttributes = $configuration;
}
public function provideMinPhpVersion() : int
{
return PhpVersionFeature::ATTRIBUTES;
}
/**
* @return AttributeGroup[]
*/
@ -209,7 +209,7 @@ CODE_SAMPLE
if (!$docNode instanceof PhpDocTagNode) {
return null;
}
if (!$docNode->value instanceof GenericTagValueNode) {
if (!$docNode->value instanceof GenericTagValueNode && !$docNode->value instanceof DoctrineAnnotationTagValueNode) {
return null;
}
$tag = \trim($docNode->name, '@');

View File

@ -5,6 +5,7 @@ namespace Rector\Php80\Rector\Class_;
use RectorPrefix202412\Nette\Utils\Strings;
use PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagNode;
use Rector\BetterPhpDocParser\PhpDoc\DoctrineAnnotationTagValueNode;
use Rector\Php80\ValueObject\AnnotationToAttribute;
use Rector\Php80\ValueObject\AttributeValueAndDocComment;
use Rector\Util\NewLineSplitter;
@ -20,7 +21,11 @@ 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;
}
$docComment = '';
// special case for newline
if (\strpos($docValue, "\n") !== \false) {

View File

@ -19,12 +19,12 @@ final class VersionResolver
* @api
* @var string
*/
public const PACKAGE_VERSION = '2cb9a95b79554c9116e140c95e41276a7165c241';
public const PACKAGE_VERSION = '6192fe3285c1dc5ac7f28afac485b8facd018b39';
/**
* @api
* @var string
*/
public const RELEASE_DATE = '2024-12-13 12:25:46';
public const RELEASE_DATE = '2024-12-14 01:46:12';
/**
* @var int
*/

View File

@ -88,6 +88,10 @@ abstract class AbstractValuesAwareNode implements PhpDocTagValueNode
{
$this->hasChanged = \true;
}
public function getOriginalContent() : ?string
{
return $this->originalContent;
}
/**
* @param mixed[] $values
*/