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

dynamic rules: @fliter capturing any pattern not only variable #1249

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

Hidanio
Copy link
Contributor

@Hidanio Hidanio commented Feb 28, 2025

No description provided.

@Hidanio Hidanio self-assigned this Feb 28, 2025
@Hidanio Hidanio added the bug Something isn't working label Feb 28, 2025
@Hidanio Hidanio marked this pull request as ready for review February 28, 2025 16:34
@Hidanio Hidanio changed the title draft: fliter capturing any pattern not only variable dynamic rules: @fliter capturing any pattern not only variable Feb 28, 2025
@Hidanio Hidanio requested a review from Danil42Russia March 1, 2025 17:31
@Hidanio Hidanio force-pushed the hidanio/filter_capturing_any_pattern branch from 37d0238 to 0e9a399 Compare March 1, 2025 17:58
@Danil42Russia Danil42Russia self-requested a review March 2, 2025 01:33
@@ -558,3 +558,37 @@ func (p *parser) checkForVariableInPattern(name string, pattern ir.Node, verifie

return found
}

func (p *parser) filterByPattern(name string, pattern ir.Node, verifiedVars map[string]struct{}) bool {
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's add the tests? It's a very fragile place

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

Copy link
Contributor

Choose a reason for hiding this comment

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

What's missing is a test that checks that the filter is type-aware.

// var
callFunc($name);
// str
callFunc("name");

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants