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
Use PHP 8 string functions #8207
Use PHP 8 string functions #8207
Conversation
Riding the (PHP) storm? |
How did you guess? 😛 |
If you like, sure. I personally don't mind the old fashioned way for these, but I have no objection. |
I think its a micro improvement:
Somebody can check the work, but it shows that it does perform slightly better. |
Makes sense, because the new functions don't copy strings.
PHPStorm automates this. If it were me, I wouldn't do this otherwise because of the tedium, which I do not like. |
Just discovered this goodie https://cs.symfony.com/doc/rules/alias/modernize_strpos.html |
Neat. Can be added, but requires us to enable risky, but the risk is not a concern:
|
Let's go ahead and enable that option in PHP-CS-Fixer. Then you can just run PHP-CS-Fixer once to get all the remaining instances in one go, @Oldiesmann. |
I've already finished everything at this point |
Ah. Very good, then! |
This changes the code to use
str_starts_with
,str_contains
andstr_ends_with
instead ofstrpos
andsubstr
for finding strings within other strings. It looks nicer and is less confusing.