DX: remove empty calls#7138
DX: remove empty calls#7138kubawerlos merged 2 commits intoPHP-CS-Fixer:masterfrom 6b7562617765726c6f73:remove_empty
empty calls#7138Conversation
Wirone
left a comment
There was a problem hiding this comment.
IMHO it would be better if we had strict types extensions installed and errors dumped to baseline, so PRs like this would remove errors from there, while it wouldn't be possible to add new violations. Since you work on it in multiple PRs and at the same time there are other PRs ongoing, it's possible to introduce new violation for topic that was already covered. What do you think?
| { | ||
| foreach ($tokenKinds as $tokenKind) { | ||
| if (!empty($this->foundTokenKinds[$tokenKind])) { | ||
| if ($this->isTokenKindFound($tokenKind)) { |
There was a problem hiding this comment.
this is very frequent call, we done some microoptimizations earlier for Tokens class to reduce hotpaths. maybe we do not need to call the method here
There was a problem hiding this comment.
If we really don't want additional method call, then it should be changed to isset($this->foundTokenKinds[$tokenKind]), just like isTokenKindFound()'s implementation was changed in #7139 (which is weird, since it's a removal of empty() call and should be here 😝). But I believe this is negligible difference and we could call the method here.
There was a problem hiding this comment.
I've extracted removing empty in isTokenKindFound to separate PR as it was not that straightforward and I've expected some discussion.
What I did not expect is changes in isAnyTokenKindsFound and the other one -> I've reverted them here, so we can safely merge it and focus on Tokens in the other PR.
There was a problem hiding this comment.
thanks - that way this part can go fast.
i won't be heavily available in July, if we won't conclude on Tokens part fast, feel free to put it to baseline first
There was a problem hiding this comment.
We already did 😉 - isset as microoptimization
@Wirone I hope to finish it withing a week (thus separating into small chunks) and if new issues will be introduced I will fix them in final PR that would add |
Part of going to strict code.