Skip to content

[Php80] Keep numeric string, string "true", "false" as is on StringAnnotationToAttributeMapper#6610

Merged
TomasVotruba merged 1 commit intomainfrom
keep-string-as-is
Jan 5, 2025
Merged

[Php80] Keep numeric string, string "true", "false" as is on StringAnnotationToAttributeMapper#6610
TomasVotruba merged 1 commit intomainfrom
keep-string-as-is

Conversation

@samsonasik
Copy link
Member

@samsonasik
Copy link
Member Author

@Seldaek I will let @TomasVotruba decide on this.

For special doctrine to convert "true" to true, there is already DoctrineConverterAttributeDecorator that cover that

if (! $value instanceof String_) {
continue;
}
if (! in_array($value->value, ['true', 'false'], true)) {
continue;
}
$arg->value = $value->value === 'true' ? new ConstFetch(new Name('true')) : new ConstFetch(new Name(
'false'
));

and used only on AnnotationToAttributeRector for special doctrine purpose as AttributeGroupNamedArgumentManipulator

The TestWithAnnotationToAttributeRector rule doesn't use AttributeGroupNamedArgumentManipulator.

@samsonasik
Copy link
Member Author

All checks have passed 🎉 @TomasVotruba it is ready for review.

@Seldaek
Copy link

Seldaek commented Dec 18, 2024

Thanks, I don't have enough historical context here to say what's most sensible so I'll leave you two to figure it out :)

@TomasVotruba
Copy link
Member

TomasVotruba commented Jan 5, 2025

It seems it doesn't break any other annotation to attribute conversions, so let's give it a try :) 👍

@TomasVotruba TomasVotruba merged commit 7ad1424 into main Jan 5, 2025
41 checks passed
@TomasVotruba TomasVotruba deleted the keep-string-as-is branch January 5, 2025 08:23
@samsonasik
Copy link
Member Author

Thank you @TomasVotruba, I will check use of AttributeGroupNamedArgumentManipulator on rector-doctrine on special use cases, eg: nullable: "true" which seems need to be used on specific rule that require the transformation

@github-actions
Copy link
Contributor

github-actions bot commented Jan 4, 2026

This pull request has been automatically locked because it has been closed for 150 days. Please open a new PR if you want to continue the work.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 4, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Incorrect behavior of TestWithAnnotationToAttributeRector with integers

3 participants