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

DX: FunctionsAnalyzer - simplifying return expression #3897

Merged
merged 1 commit into from Jul 11, 2018
Merged

DX: FunctionsAnalyzer - simplifying return expression #3897

merged 1 commit into from Jul 11, 2018

Conversation

kubawerlos
Copy link
Contributor

Just noticed after #3895 that it could be done a bit simpler.

@@ -40,8 +40,7 @@ public function isGlobalFunctionCall(Tokens $tokens, $index)

$nextIndex = $tokens->getNextMeaningfulToken($index);

return !$tokens[$prevIndex]->isGivenKind([T_DOUBLE_COLON, T_NEW, T_OBJECT_OPERATOR, T_STRING, T_FUNCTION])
&& !$tokens[$nextIndex]->isGivenKind([T_DOUBLE_COLON, T_NS_SEPARATOR])
return !$tokens[$prevIndex]->isGivenKind([T_DOUBLE_COLON, T_FUNCTION, T_NEW, T_OBJECT_OPERATOR, T_STRING])
Copy link
Contributor

Choose a reason for hiding this comment

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

What about T_NS_SEPARATOR?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's taken care of few lines above.

@keradus keradus added this to the 2.12.3 milestone Jul 10, 2018
@keradus keradus added the RTM Ready To Merge label Jul 10, 2018
@SpacePossum SpacePossum changed the title DX: simplifying return expression in FunctionsAnalyzer DX: FunctionsAnalyzer - simplifying return expression Jul 11, 2018
@SpacePossum
Copy link
Contributor

Thanks @kubawerlos.

@SpacePossum SpacePossum merged commit ffd3932 into PHP-CS-Fixer:2.12 Jul 11, 2018
SpacePossum added a commit that referenced this pull request Jul 11, 2018
…bawerlos)

This PR was merged into the 2.12 branch.

Discussion
----------

DX: FunctionsAnalyzer - simplifying return expression

Just noticed after #3895 that it could be done a bit simpler.

Commits
-------

ffd3932 DX: simplifying return expression in FunctionsAnalyzer
@SpacePossum SpacePossum removed the RTM Ready To Merge label Jul 11, 2018
@kubawerlos kubawerlos deleted the cleanup/simplifying-expression branch July 20, 2018 16:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants