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

FunctionsAnalyzer - better isGlobalFunctionCall detection #4846

Merged
merged 1 commit into from
Feb 28, 2020
Merged

FunctionsAnalyzer - better isGlobalFunctionCall detection #4846

merged 1 commit into from
Feb 28, 2020

Conversation

SpacePossum
Copy link
Contributor

Fixes #3051
Replaces #4251

@SpacePossum SpacePossum added this to the 2.15.6 milestone Feb 26, 2020
@@ -75,7 +75,7 @@ protected function applyFix(\SplFileInfo $file, Tokens $tokens)
{
$functionsAnalyzer = new FunctionsAnalyzer();

foreach ($tokens as $index => $token) {
for ($index = \count($tokens) - 1; $index > 0; --$index) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Any improvement here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Without the change the fixer fails on some PHP versions, but not on all. I didn't find the root cause for this difference. However iterating over the tokens set from start till end using foreach while manipulating it (in front of you) typically doesn't end well, but again, I didn't get to the bottom of it...

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

Successfully merging this pull request may close these issues.

None yet

2 participants