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

Use str_starts_with() and str_contains() instead of strpos() #2841

Merged

Conversation

zonuexe
Copy link
Contributor

@zonuexe zonuexe commented Dec 23, 2023

These codes have been clarified by replacing them with functions introduced in PHP 8.x, and are only slightly micro-optimized.

@zonuexe zonuexe force-pushed the refactor/str_contains-starts_with branch 4 times, most recently from aafd9c5 to 0918b73 Compare December 23, 2023 14:13
@zonuexe zonuexe force-pushed the refactor/str_contains-starts_with branch from 0918b73 to 6261d1a Compare December 23, 2023 14:27
@ondrejmirtes ondrejmirtes merged commit 05607cf into phpstan:1.10.x Dec 30, 2023
423 of 426 checks passed
@ondrejmirtes
Copy link
Member

Thank you! Yes, I prefer this, but to be clear, this is enabled only thanks to the fact that PHPStan includes Symfony polyfills :) But on newer PHP versions the native functions will be used.

@zonuexe zonuexe deleted the refactor/str_contains-starts_with branch March 25, 2024 02:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants