From f8b2ff1b538072fbbe708a5a1c046a8ff839ab4c Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Fri, 7 Feb 2020 19:14:29 +0000 Subject: [PATCH] Coding Standards: Adjust coding standards to always omit parentheses for `include`/`require` statements. These are language constructs, not function calls, so the parentheses are unnecessary. This updates the PHPCS configuration file the enforce the sniff until it is moved from the `WordPress-Extra` ruleset to the `WordPress-Core` ruleset upstream. Follow-up to [47198]. Props desrosj, jrf, GaryJ. Fixes #49376. git-svn-id: https://develop.svn.wordpress.org/trunk@47207 602fd350-edb4-49c9-b593-d223f7449a82 --- phpcs.xml.dist | 21 ++++++++++++++++--- src/wp-admin/includes/meta-boxes.php | 2 +- src/wp-admin/includes/translation-install.php | 2 +- src/wp-includes/functions.php | 2 +- src/wp-includes/shortcodes.php | 3 +-- 5 files changed, 22 insertions(+), 8 deletions(-) diff --git a/phpcs.xml.dist b/phpcs.xml.dist index 2d9f152285..af60e89e57 100644 --- a/phpcs.xml.dist +++ b/phpcs.xml.dist @@ -169,7 +169,7 @@ + (such as calling the low-level translate() function). --> /src/wp-includes/l10n\.php /tests/phpunit/tests/l10n\.php @@ -189,8 +189,8 @@ + Git and SVN manage these pretty well cross-platform as "native". + Whitelist configuration files. --> /wp-config\.php /wp-config-sample\.php @@ -270,6 +270,21 @@ + + + warning + + + warning + + + warning + + + * diff --git a/src/wp-admin/includes/meta-boxes.php b/src/wp-admin/includes/meta-boxes.php index 6307035f3a..7316a1a65b 100644 --- a/src/wp-admin/includes/meta-boxes.php +++ b/src/wp-admin/includes/meta-boxes.php @@ -427,7 +427,7 @@ function attachment_submit_meta_box( $post ) { echo "" . __( 'Move to Trash' ) . ''; } else { $delete_ays = ! MEDIA_TRASH ? " onclick='return showNotice.warn();'" : ''; - echo "" . __( 'Delete Permanently' ) . ''; + echo "" . __( 'Delete Permanently' ) . ''; } } ?> diff --git a/src/wp-admin/includes/translation-install.php b/src/wp-admin/includes/translation-install.php index 76ad22bd81..5d15b22f66 100644 --- a/src/wp-admin/includes/translation-install.php +++ b/src/wp-admin/includes/translation-install.php @@ -21,7 +21,7 @@ function translations_api( $type, $args = null ) { require ABSPATH . WPINC . '/version.php'; if ( ! in_array( $type, array( 'plugins', 'themes', 'core' ) ) ) { - return new WP_Error( 'invalid_type', __( 'Invalid translation type.' ) ); + return new WP_Error( 'invalid_type', __( 'Invalid translation type.' ) ); } /** diff --git a/src/wp-includes/functions.php b/src/wp-includes/functions.php index a48a09a03b..ef4d23debb 100644 --- a/src/wp-includes/functions.php +++ b/src/wp-includes/functions.php @@ -5200,7 +5200,7 @@ function _doing_it_wrong( $function, $message, $version ) { function is_lighttpd_before_150() { $server_parts = explode( '/', isset( $_SERVER['SERVER_SOFTWARE'] ) ? $_SERVER['SERVER_SOFTWARE'] : '' ); $server_parts[1] = isset( $server_parts[1] ) ? $server_parts[1] : ''; - return 'lighttpd' == $server_parts[0] && -1 == version_compare( $server_parts[1], '1.5.0' ); + return 'lighttpd' == $server_parts[0] && -1 == version_compare( $server_parts[1], '1.5.0' ); } /** diff --git a/src/wp-includes/shortcodes.php b/src/wp-includes/shortcodes.php index 5c425bc64a..3b3ef23615 100644 --- a/src/wp-includes/shortcodes.php +++ b/src/wp-includes/shortcodes.php @@ -258,8 +258,7 @@ function get_shortcode_regex( $tagnames = null ) { // Also, see shortcode_unautop() and shortcode.js. // phpcs:disable Squiz.Strings.ConcatenationSpacing.PaddingFound -- don't remove regex indentation - return - '\\[' // Opening bracket. + return '\\[' // Opening bracket. . '(\\[?)' // 1: Optional second opening bracket for escaping shortcodes: [[tag]]. . "($tagregexp)" // 2: Shortcode name. . '(?![\\w-])' // Not followed by word character or hyphen.