Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ namespace Rector\Symfony\Tests\JMS\Rector\Class_\AccessTypeAnnotationToAttribute

use JMS\Serializer\Annotation as Serializer;

#[Serializer\AccessType(values: ['public_method'])]
#[Serializer\AccessType(type: 'public_method')]
final class AnnotationTypes
{
public function run(): void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@
namespace Rector\Symfony\JMS\Rector\Class_;

use PhpParser\Node;
use PhpParser\Node\ArrayItem;
use PhpParser\Node\AttributeGroup;
use PhpParser\Node\Expr\Array_;
use PhpParser\Node\Identifier;
use PhpParser\Node\Stmt\Class_;
use PhpParser\Node\Stmt\Property;
Expand Down Expand Up @@ -81,9 +79,7 @@ public function refactor(Node $node): Class_|Property|null

if (count($attribute->args) === 1) {
$soleArg = $attribute->args[0];
// wrap to array
$soleArg->name = new Identifier('values');
$soleArg->value = new Array_([new ArrayItem($soleArg->value)]);
$soleArg->name = new Identifier('type');
}

// 2. Reprint docblock
Expand Down