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

PHP: Use str_contains() #43382

Merged
merged 1 commit into from
Aug 18, 2022
Merged

PHP: Use str_contains() #43382

merged 1 commit into from
Aug 18, 2022

Conversation

Soean
Copy link
Member

@Soean Soean commented Aug 18, 2022

As in #43371 forstr_starts_with , str_contains function is available in PHP 8.
A polyfill for the function exists in WP 5.9+, so we should use that function instead of previous implementations.

Polyfill: https://github.com/WordPress/WordPress/blob/6.0-branch/wp-includes/compat.php#L420-L436
Docs on php.net: https://www.php.net/manual/en/function.str-contains.php

@Soean Soean added the [Type] Code Quality Issues or PRs that relate to code quality label Aug 18, 2022
@Soean Soean requested a review from aristath August 18, 2022 12:54
Copy link
Member

@aristath aristath left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! 👍

@Soean Soean merged commit 7f0a211 into trunk Aug 18, 2022
@Soean Soean deleted the use/str_contains branch August 18, 2022 16:02
@github-actions github-actions bot added this to the Gutenberg 14.0 milestone Aug 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Type] Code Quality Issues or PRs that relate to code quality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants