Make WordPress Core


Ignore:
Timestamp:
09/11/2023 04:51:09 AM (3 years ago)
Author:
SergeyBiryukov
Message:

Code Modernization: Use dirname() with the $levels parameter.

PHP 7.0 introduced the $levels parameter to the dirname() function, which means nested calls to dirname() are no longer needed.

Note: This is enforced by WPCS 3.0.0.

Reference: ​PHP Manual: dirname().

Follow-up to [56141].

Props jrf.
See #59161, #58831.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/includes/bootstrap.php

    r56547 r56552  
    1111                // Support the config file from the root of the develop repository.
    1212                if ( basename( $config_file_path ) === 'phpunit' && basename( dirname( $config_file_path ) ) === 'tests' ) {
    13                         $config_file_path = dirname( dirname( $config_file_path ) );
     13                        $config_file_path = dirname( $config_file_path, 2 );
    1414                }
    1515        }
    … …  
    8080if ( ! class_exists( 'Yoast\PHPUnitPolyfills\Autoload' ) ) {
    8181        // Default location of the autoloader for WP core test runs.
    82         $phpunit_polyfills_autoloader = dirname( dirname( dirname( __DIR__ ) ) ) . '/vendor/yoast/phpunit-polyfills/phpunitpolyfills-autoload.php';
     82        $phpunit_polyfills_autoloader = dirname( __DIR__, 3 ) . '/vendor/yoast/phpunit-polyfills/phpunitpolyfills-autoload.php';
    8383        $phpunit_polyfills_error      = false;
    8484
Note: See TracChangeset for help on using the changeset viewer.