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

fix wrong handling of flags in context #7195

Merged
merged 3 commits into from
Dec 21, 2021
Merged

Conversation

orklah
Copy link
Collaborator

@orklah orklah commented Dec 20, 2021

This PR started when I noticed a weird handling of inside_conditional flag in switch. After looking for more I found a few.

After that, I noticed that we don't always unflag those before leaving an analyzer, mainly when the other analyzer we called returned false.

Not sure this will have any effect whatsoever, but it may fix a few edge cases here and there. It will be less confusing in any case

@orklah orklah added the release:internal The PR will be included in 'Internal changes' section of the release notes label Dec 20, 2021
@orklah
Copy link
Collaborator Author

orklah commented Dec 20, 2021

CI is failing for unrelated reason. I filed an issue here: thecodingmachine/docker-images-php#285

@orklah orklah merged commit ea22f87 into vimeo:master Dec 21, 2021
@orklah
Copy link
Collaborator Author

orklah commented Dec 21, 2021

Thanks for the review @muglug ;)

@weirdan
Copy link
Collaborator

weirdan commented Dec 21, 2021

I wonder if we could simplify this pattern with something like this:

$context->withAlteredFlags(function (Context $context) use (...) {
   $context->inside_conditional = false;
   SomeAnalizer::analyze(..., $context);
});

that would undo flag changes performed by the callback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release:internal The PR will be included in 'Internal changes' section of the release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants