Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
minor #3877 NamespacesAnalyzer - Optimize performance (stof)
This PR was merged into the 2.12 branch. Discussion ---------- NamespacesAnalyzer - Optimize performance Instead of looping on all tokens, even inside the namespace it identified, the analyzer now continues the analysis after the end of the identified namespace, thanks to the fact that namespaces cannot be nested. When implementing #3876, I compared the NamespacesAnalyzer implementation with `\PhpCsFixer\Fixer\FunctionNotation\NativeFunctionInvocationFixer::getUserDefinedNamespaces`. The NamespacesAnalyzer also identifies the namespace name instead of skipping over it (and returns the global namespace too). But I found out that NativeFunctionInvocationFixer was more optimized, as it was not re-analyzing all tokens inside a namespace. This makes NamespacesAnalyzer implement the same optimization. Commits ------- 8321c26 Optimize the namespaces analyzer
- Loading branch information