Skip to content

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

Merged
ondrejmirtes merged 1 commit intophpstan:1.10.xfrom
zonuexe:refactor/str_contains-starts_with
Dec 30, 2023
Merged

Use str_starts_with() and str_contains() instead of strpos()#2841
ondrejmirtes merged 1 commit intophpstan:1.10.xfrom
zonuexe:refactor/str_contains-starts_with

Conversation

@zonuexe
Copy link
Copy Markdown
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
@ondrejmirtes
Copy link
Copy Markdown
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

Development

Successfully merging this pull request may close these issues.

2 participants