Make WordPress Core


Ignore:
Timestamp:
06/24/2023 09:50:34 AM (2 years 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/plugin-editor.php

    r55412 r56014  
    163163}
    164164
    165 if ( '.php' === substr( $real_file, strrpos( $real_file, '.' ) ) ) {
     165if ( str_ends_with( $real_file, '.php' ) ) {
    166166    $functions = wp_doc_link_parse( $content );
    167167
Note: See TracChangeset for help on using the changeset viewer.