Skip to content

PHP: Use str_contains()#43382

Merged
Soean merged 1 commit intotrunkfrom
use/str_contains
Aug 18, 2022
Merged

PHP: Use str_contains()#43382
Soean merged 1 commit intotrunkfrom
use/str_contains

Conversation

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