Make WordPress Core

Changeset 47207


Ignore:
Timestamp:
02/07/2020 07:14:29 PM (5 years ago)
Author:
SergeyBiryukov
Message:

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.

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/phpcs.xml.dist

    r47122 r47207  
    170170
    171171    <!-- Whitelist the I18n functions file from issues identified by the I18n sniff
    172         (such as calling the low-level translate() function). -->
     172         (such as calling the low-level translate() function). -->
    173173    <rule ref="WordPress.WP.I18n">
    174174        <exclude-pattern>/src/wp-includes/l10n\.php</exclude-pattern>
     
    190190
    191191    <!-- Exclude checking of line endings when reporting errors, but fix them when running phpcbf.
    192         Git and SVN manage these pretty well cross-platform as "native".
    193         Whitelist configuration files. -->
     192         Git and SVN manage these pretty well cross-platform as "native".
     193         Whitelist configuration files. -->
    194194    <rule ref="Generic.Files.LineEndings">
    195195        <exclude-pattern>/wp-config\.php</exclude-pattern>
     
    271271    </rule>
    272272
     273    <!-- Enforce no parenthesis for language constructs, and only one space immediately after.
     274         Including this rule is temporary until it is moved from the WordPress-Extra ruleset to
     275         the WordPress-Core ruleset upstream.
     276    -->
     277    <rule ref="PEAR.Files.IncludingFile.BracketsNotRequired">
     278        <type>warning</type>
     279    </rule>
     280    <rule ref="PEAR.Files.IncludingFile.UseRequire">
     281        <type>warning</type>
     282    </rule>
     283    <rule ref="PEAR.Files.IncludingFile.UseRequireOnce">
     284        <type>warning</type>
     285    </rule>
     286    <rule ref="Squiz.WhiteSpace.LanguageConstructSpacing"/>
     287
    273288    <!-- Assignments in while conditions are a valid method of looping over iterables. -->
    274289    <rule ref="WordPress.CodeAnalysis.AssignmentInCondition.FoundInWhileCondition">
  • trunk/src/wp-admin/includes/meta-boxes.php

    r47119 r47207  
    428428        } else {
    429429            $delete_ays = ! MEDIA_TRASH ? " onclick='return showNotice.warn();'" : '';
    430             echo  "<a class='submitdelete deletion'$delete_ays href='" . get_delete_post_link( $post->ID, null, true ) . "'>" . __( 'Delete Permanently' ) . '</a>';
     430            echo "<a class='submitdelete deletion'$delete_ays href='" . get_delete_post_link( $post->ID, null, true ) . "'>" . __( 'Delete Permanently' ) . '</a>';
    431431        }
    432432    }
  • trunk/src/wp-admin/includes/translation-install.php

    r47198 r47207  
    2222
    2323    if ( ! in_array( $type, array( 'plugins', 'themes', 'core' ) ) ) {
    24         return  new WP_Error( 'invalid_type', __( 'Invalid translation type.' ) );
     24        return new WP_Error( 'invalid_type', __( 'Invalid translation type.' ) );
    2525    }
    2626
  • trunk/src/wp-includes/functions.php

    r47198 r47207  
    52015201    $server_parts    = explode( '/', isset( $_SERVER['SERVER_SOFTWARE'] ) ? $_SERVER['SERVER_SOFTWARE'] : '' );
    52025202    $server_parts[1] = isset( $server_parts[1] ) ? $server_parts[1] : '';
    5203     return  'lighttpd' == $server_parts[0] && -1 == version_compare( $server_parts[1], '1.5.0' );
     5203    return 'lighttpd' == $server_parts[0] && -1 == version_compare( $server_parts[1], '1.5.0' );
    52045204}
    52055205
  • trunk/src/wp-includes/shortcodes.php

    r47122 r47207  
    259259
    260260    // phpcs:disable Squiz.Strings.ConcatenationSpacing.PaddingFound -- don't remove regex indentation
    261     return
    262         '\\['                                // Opening bracket.
     261    return '\\['                             // Opening bracket.
    263262        . '(\\[?)'                           // 1: Optional second opening bracket for escaping shortcodes: [[tag]].
    264263        . "($tagregexp)"                     // 2: Shortcode name.
Note: See TracChangeset for help on using the changeset viewer.