Make WordPress Core


Ignore:
Timestamp:
06/24/2023 09:50:34 AM (13 months ago)
Author:
SergeyBiryukov
Message:

Code Modernization: Use str_ends_with() in a few more places.

str_ends_with() was introduced in PHP 8.0 to perform a case-sensitive check indicating if the string to search in (haystack) ends with the given substring (needle).

WordPress core includes a polyfill for str_ends_with() on PHP < 8.0 as of WordPress 5.9.

Follow-up to [55990].

See #58220.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/theme-editor.php

    r55434 r56014  
    162162    $content = fread( $f, filesize( $file ) );
    163163
    164     if ( '.php' === substr( $file, strrpos( $file, '.' ) ) ) {
     164    if ( str_ends_with( $file, '.php' ) ) {
    165165        $functions = wp_doc_link_parse( $content );
    166166
Note: See TracChangeset for help on using the changeset viewer.