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

[Transform] Check str_contains * before fnmatch() early on AddAllowDynamicPropertiesAttributeRector #4991

Merged
merged 2 commits into from
Sep 11, 2023

Conversation

samsonasik
Copy link
Member

@samsonasik samsonasik changed the title [Php55] Check str_contains * before fnmatch() early on AddAllowDynamicPropertiesAttributeRector [Transform] Check str_contains * before fnmatch() early on AddAllowDynamicPropertiesAttributeRector Sep 11, 2023
@samsonasik
Copy link
Member Author

All checks have passed 🎉 @TomasVotruba I am merging it ;)

@samsonasik samsonasik merged commit 27d4c55 into main Sep 11, 2023
40 checks passed
@samsonasik samsonasik deleted the use-str-c branch September 11, 2023 13:43
Comment on lines +144 to 146
if (str_contains($transformOnNamespace, '*')) {
if (! fnmatch($transformOnNamespace, $className, FNM_NOESCAPE)) {
return true;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@TomasVotruba @staabm this conditions seems need to be on last resort to check because it returns true on negation early, I will create separate PR to cover too late check.

}

if ($this->nodeNameResolver->isStringName($className, $transformOnNamespace)) {
continue;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this needs to be return true ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm actually I am not sure. is this area covered by tests?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am going to add new fixture to cover this

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's not, it need to be processed as exists

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