Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Php80] Keep single quoted Argument Attribute on AnnotationToAttributeRector #5214

Merged
merged 2 commits into from
Oct 29, 2023
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 @@ -200,6 +200,10 @@ private function createArrayItemFromKeyAndValue(mixed $rawKey, mixed $rawValue):
return new ArrayItemNode($value, $key);
}

if (is_string($value) && $valueQuoteKind === String_::KIND_SINGLE_QUOTED) {
$value = trim($value, "'");
}

return new ArrayItemNode($value);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

namespace Rector\Tests\Php80\Rector\Class_\AnnotationToAttributeRector\Fixture;

use Rector\Tests\Php80\Rector\Class_\AnnotationToAttributeRector\Source\GenericSingleImplicitAnnotation;

/**
* @GenericSingleImplicitAnnotation('/')
*/
final class KeepSingleQuoted
{
}

?>
-----
<?php

namespace Rector\Tests\Php80\Rector\Class_\AnnotationToAttributeRector\Fixture;

use Rector\Tests\Php80\Rector\Class_\AnnotationToAttributeRector\Source\GenericSingleImplicitAnnotation;

#[GenericSingleImplicitAnnotation('/')]
final class KeepSingleQuoted
{
}

?>