From ffc386bfbd2f7646304f5cf8675ee18f7091a2b4 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Sat, 24 Jun 2023 13:52:11 +0000 Subject: [PATCH] Coding Standards: Use Yoda condition in `str_ends_with()`. This resolves a WPCS error: {{{ Use Yoda Condition checks, you must. }}} Follow-up to [56015], [56016]. See #58220. git-svn-id: https://develop.svn.wordpress.org/trunk@56017 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/compat.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wp-includes/compat.php b/src/wp-includes/compat.php index d51b37cfbf..696642f8d2 100644 --- a/src/wp-includes/compat.php +++ b/src/wp-includes/compat.php @@ -488,7 +488,7 @@ if ( ! function_exists( 'str_ends_with' ) ) { $len = strlen( $needle ); - return $needle === substr( $haystack, -$len, $len ); + return substr( $haystack, -$len, $len ) === $needle; } }