Skip to content

Commit 01cb4ed

Browse files
committed
General: Fix nesting in compat.php.
Follow up to [57451]. git-svn-id: https://develop.svn.wordpress.org/branches/5.7@57456 602fd350-edb4-49c9-b593-d223f7449a82
1 parent c1e1f3a commit 01cb4ed

File tree

1 file changed

+39
-39
lines changed

1 file changed

+39
-39
lines changed

src/wp-includes/compat.php

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -369,50 +369,50 @@ function is_countable( $var ) {
369369
function is_iterable( $var ) {
370370
return ( is_array( $var ) || $var instanceof Traversable );
371371
}
372+
}
372373

373-
if ( ! function_exists( 'str_starts_with' ) ) {
374-
/**
375-
* Polyfill for `str_starts_with()` function added in PHP 8.0.
376-
*
377-
* Performs a case-sensitive check indicating if
378-
* the haystack begins with needle.
379-
*
380-
* @since 5.9.0
381-
*
382-
* @param string $haystack The string to search in.
383-
* @param string $needle The substring to search for in the `$haystack`.
384-
* @return bool True if `$haystack` starts with `$needle`, otherwise false.
385-
*/
386-
function str_starts_with( $haystack, $needle ) {
387-
if ( '' === $needle ) {
388-
return true;
389-
}
390-
391-
return 0 === strpos( $haystack, $needle );
374+
if ( ! function_exists( 'str_starts_with' ) ) {
375+
/**
376+
* Polyfill for `str_starts_with()` function added in PHP 8.0.
377+
*
378+
* Performs a case-sensitive check indicating if
379+
* the haystack begins with needle.
380+
*
381+
* @since 5.9.0
382+
*
383+
* @param string $haystack The string to search in.
384+
* @param string $needle The substring to search for in the `$haystack`.
385+
* @return bool True if `$haystack` starts with `$needle`, otherwise false.
386+
*/
387+
function str_starts_with( $haystack, $needle ) {
388+
if ( '' === $needle ) {
389+
return true;
392390
}
391+
392+
return 0 === strpos( $haystack, $needle );
393393
}
394+
}
394395

395-
if ( ! function_exists( 'str_ends_with' ) ) {
396-
/**
397-
* Polyfill for `str_ends_with()` function added in PHP 8.0.
398-
*
399-
* Performs a case-sensitive check indicating if
400-
* the haystack ends with needle.
401-
*
402-
* @since 5.9.0
403-
*
404-
* @param string $haystack The string to search in.
405-
* @param string $needle The substring to search for in the `$haystack`.
406-
* @return bool True if `$haystack` ends with `$needle`, otherwise false.
407-
*/
408-
function str_ends_with( $haystack, $needle ) {
409-
if ( '' === $haystack ) {
410-
return '' === $needle;
411-
}
396+
if ( ! function_exists( 'str_ends_with' ) ) {
397+
/**
398+
* Polyfill for `str_ends_with()` function added in PHP 8.0.
399+
*
400+
* Performs a case-sensitive check indicating if
401+
* the haystack ends with needle.
402+
*
403+
* @since 5.9.0
404+
*
405+
* @param string $haystack The string to search in.
406+
* @param string $needle The substring to search for in the `$haystack`.
407+
* @return bool True if `$haystack` ends with `$needle`, otherwise false.
408+
*/
409+
function str_ends_with( $haystack, $needle ) {
410+
if ( '' === $haystack ) {
411+
return '' === $needle;
412+
}
412413

413-
$len = strlen( $needle );
414+
$len = strlen( $needle );
414415

415-
return substr( $haystack, -$len, $len ) === $needle;
416-
}
416+
return substr( $haystack, -$len, $len ) === $needle;
417417
}
418418
}

0 commit comments

Comments
 (0)