refactor: add FullyQualifiedNameAnalyzer#8048
refactor: add FullyQualifiedNameAnalyzer#8048kubawerlos merged 3 commits intoPHP-CS-Fixer:masterfrom
FullyQualifiedNameAnalyzer#8048Conversation
There was a problem hiding this comment.
Did you take a look at FullyQualifiedStrictTypesFixer? I believe some logic from there could be a part of this analyzer, or the other way around - could take advantage of what was introduced here (like resolveSymbol()).
PS. in terms of import types - I know the refactored logic supported only classy imports, but I really believe that introducing new analyzer dedicated for FQCN resolving really should provide full support for all types of imports, as we already know that current implementation (prior to this PR) is buggy / not complete. This PR is great anyway, as this reduces redundancy, but can be even better 🙂.
| /** | ||
| * @param NamespaceUseAnalysis::TYPE_* $importType | ||
| */ | ||
| public function getFullyQualifiedName(string $name, int $indexInNamespace, int $importType): string |
There was a problem hiding this comment.
All such logic must be implemented by this PR/FullyQualifiedNameAnalyzer class otherwise the result will not be always correct.
Then the resolving logic should be used in FullyQualifiedStrictTypesFixer and all existing tests must pass.
Also, the resolving should be fast and some cached-based uses lookup should be supported probably (verify the performance on some large large codebase with a lot of imports by running the fixed with FullyQualifiedStrictTypesFixer only).
There was a problem hiding this comment.
This PR is not touching FullyQualifiedStrictTypesFixer and I'd like to keep it, and handle it separately, after #7705 is merged.
There was a problem hiding this comment.
Personally I think that caching and optimising can be done is separate PR as currently we don't have it too. Let's don't add features during refactor. When it comes to FullyQualifiedStrictTypesFixer I also would like to see it here, but I am open for doing it later too.
@kubawerlos when it comes to 7704/7705 it's been 4 months without any response from the core team, so we don't even know which approach is welcome 🤷. I would happily rebase my PR if it's the chosen way, but I am not going to work on it unless the decision is made.
c32dfc0 to
1ebaff1
Compare
1ebaff1 to
65ea959
Compare
65ea959 to
af61139
Compare
0a1783d to
bf6989b
Compare
5027427 to
23d7dc8
Compare
cd7199f to
086fdb1
Compare
No description provided.