Skip to content

Commit 8bed69c

Browse files
committed
Code Modernization: Replace strpos() with str_contains().
This changeset replaces recently introduced `false !== strpos( ... )` and `false === strpos( ... )` with `str_contains()` in core files, making the code more readable and consistent, as well as better aligned with modern development practices. Introduced in [60269] and [60939]. Fixed during WCEU2026 contribution day. Follow-up to [52039], [55988], [56245], [60269] and [60939]. Props Soean, mukesh27. Fixes #65408. git-svn-id: https://develop.svn.wordpress.org/trunk@62461 602fd350-edb4-49c9-b593-d223f7449a82
1 parent c1163e7 commit 8bed69c

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

src/wp-includes/class-wp-block-processor.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1799,9 +1799,9 @@ public function get_printable_block_type(): ?string {
17991799
* @return string Fully-qualified block type including namespace.
18001800
*/
18011801
public static function normalize_block_type( string $block_type ): string {
1802-
return false === strpos( $block_type, '/' )
1803-
? "core/{$block_type}"
1804-
: $block_type;
1802+
return str_contains( $block_type, '/' )
1803+
? $block_type
1804+
: "core/{$block_type}";
18051805
}
18061806

18071807
/**

src/wp-includes/link-template.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4579,7 +4579,7 @@ function get_avatar_data( $id_or_email, $args = null ) {
45794579
}
45804580
} elseif ( $id_or_email instanceof WP_Comment ) {
45814581
$name = $id_or_email->comment_author;
4582-
} elseif ( is_string( $id_or_email ) && false !== strpos( $id_or_email, '@' ) ) {
4582+
} elseif ( is_string( $id_or_email ) && str_contains( $id_or_email, '@' ) ) {
45834583
$name = str_replace( array( '.', '_', '-' ), ' ', substr( $id_or_email, 0, strpos( $id_or_email, '@' ) ) );
45844584
}
45854585

0 commit comments

Comments
 (0)