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 numeric string, string "true", "false" as is on StringAnnotationToAttributeMapper #6610

Merged
merged 1 commit into from
Jan 5, 2025

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Incorrect behavior of TestWithAnnotationToAttributeRector with integers
3 participants