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

Document lowercase-string when possible #4904

Merged
merged 2 commits into from Dec 29, 2020
Merged

Conversation

orklah
Copy link
Collaborator

@orklah orklah commented Dec 28, 2020

I made a blackfire profiling on psalm today and I was surprised to see that the most called function and the one that takes the longer is strtolower. I wanted to see if there wasn't some redundant functions so I documented lowercase-string where I could.

Psalm didn't report any redundant strtolower :( Worse, I found two places where there was a missing strtolower(cf commit 2)

@staabm
Copy link
Contributor

staabm commented Dec 28, 2020

IIRC strtolower() is one of the functions which php can optimize when fully qualified (e.g. using a function import or noted with a backslash)

Edit: hmm seems I am wrong, see https://github.com/FriendsOfPHP/PHP-CS-Fixer/blob/98dd81994cf1710dec9fbd1218113f010c3d227c/src/Fixer/FunctionNotation/NativeFunctionInvocationFixer.php#L357

@orklah
Copy link
Collaborator Author

orklah commented Dec 28, 2020

I believe Psalm has a CS check for unqualified functions anyway so this would have been done already

@muglug muglug merged commit 09fb141 into vimeo:master Dec 29, 2020
@muglug
Copy link
Collaborator

muglug commented Dec 29, 2020

Thanks! I noticed the same a while back, which was the main reason for introducing lowercase-string in the first place (and also wanting to keep it internal).

danog pushed a commit to danog/psalm that referenced this pull request Jan 29, 2021
* document lowercase-string

* fix missing strtolower
@orklah orklah deleted the strtolower branch September 14, 2021 17:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants