mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-04-02 19:54:28 +00:00
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: [https://www.php.net/manual/en/function.dirname.php PHP Manual: dirname()]. Follow-up to [56141]. Props jrf. See #59161, #58831. git-svn-id: https://develop.svn.wordpress.org/trunk@56552 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -156,7 +156,7 @@ function get_page_templates( $post = null, $post_type = 'page' ) {
|
||||
* @return string
|
||||
*/
|
||||
function _get_template_edit_filename( $fullpath, $containingfolder ) {
|
||||
return str_replace( dirname( dirname( $containingfolder ) ), '', $fullpath );
|
||||
return str_replace( dirname( $containingfolder, 2 ), '', $fullpath );
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*/
|
||||
define( 'WP_REPAIRING', true );
|
||||
|
||||
require_once dirname( dirname( __DIR__ ) ) . '/wp-load.php';
|
||||
require_once dirname( __DIR__, 2 ) . '/wp-load.php';
|
||||
|
||||
header( 'Content-Type: text/html; charset=utf-8' );
|
||||
?>
|
||||
|
||||
@@ -10,7 +10,7 @@ if ( defined( 'WP_TESTS_CONFIG_FILE_PATH' ) ) {
|
||||
if ( ! file_exists( $config_file_path . '/wp-tests-config.php' ) ) {
|
||||
// Support the config file from the root of the develop repository.
|
||||
if ( basename( $config_file_path ) === 'phpunit' && basename( dirname( $config_file_path ) ) === 'tests' ) {
|
||||
$config_file_path = dirname( dirname( $config_file_path ) );
|
||||
$config_file_path = dirname( $config_file_path, 2 );
|
||||
}
|
||||
}
|
||||
$config_file_path .= '/wp-tests-config.php';
|
||||
@@ -79,7 +79,7 @@ if ( version_compare( $phpunit_version, '5.7.21', '<' ) ) {
|
||||
*/
|
||||
if ( ! class_exists( 'Yoast\PHPUnitPolyfills\Autoload' ) ) {
|
||||
// Default location of the autoloader for WP core test runs.
|
||||
$phpunit_polyfills_autoloader = dirname( dirname( dirname( __DIR__ ) ) ) . '/vendor/yoast/phpunit-polyfills/phpunitpolyfills-autoload.php';
|
||||
$phpunit_polyfills_autoloader = dirname( __DIR__, 3 ) . '/vendor/yoast/phpunit-polyfills/phpunitpolyfills-autoload.php';
|
||||
$phpunit_polyfills_error = false;
|
||||
|
||||
// Allow for a custom installation location to be provided for plugin/theme integration tests.
|
||||
|
||||
@@ -24,7 +24,7 @@ abstract class WP_Filesystem_UnitTestCase extends WP_UnitTestCase {
|
||||
return 'MockFS';
|
||||
}
|
||||
public function filter_abstraction_file( $file ) {
|
||||
return dirname( dirname( __DIR__ ) ) . '/includes/mock-fs.php';
|
||||
return dirname( __DIR__, 2 ) . '/includes/mock-fs.php';
|
||||
}
|
||||
|
||||
public function test_is_MockFS_sane() {
|
||||
|
||||
@@ -43,7 +43,7 @@ class PluralFormsTest extends WP_UnitTestCase {
|
||||
* @group external-http
|
||||
*/
|
||||
public function test_regression( $lang, $nplurals, $expression ) {
|
||||
require_once dirname( dirname( __DIR__ ) ) . '/includes/plural-form-function.php';
|
||||
require_once dirname( __DIR__, 2 ) . '/includes/plural-form-function.php';
|
||||
|
||||
$parenthesized = self::parenthesize_plural_expression( $expression );
|
||||
$old_style = tests_make_plural_form_function( $nplurals, $parenthesized );
|
||||
|
||||
Reference in New Issue
Block a user