diff --git a/composer.json b/composer.json index 10873fcee5..95cffb279a 100644 --- a/composer.json +++ b/composer.json @@ -16,9 +16,8 @@ "ext-dom": "*" }, "require-dev": { - "dealerdirect/phpcodesniffer-composer-installer": "^0.7.0", - "squizlabs/php_codesniffer": "3.6.0", - "wp-coding-standards/wpcs": "~2.3.0", + "squizlabs/php_codesniffer": "3.7.2", + "wp-coding-standards/wpcs": "~3.0.0", "phpcompatibility/phpcompatibility-wp": "~2.1.3", "yoast/phpunit-polyfills": "^1.1.0" }, diff --git a/phpcs.xml.dist b/phpcs.xml.dist index a617d8b669..00ac927d07 100644 --- a/phpcs.xml.dist +++ b/phpcs.xml.dist @@ -15,11 +15,11 @@ - - + @@ -113,22 +113,6 @@ --> - - - - - warning - - - warning - - - warning - - + + warning + + /tests/phpunit/* + warning @@ -153,7 +142,7 @@ - + @@ -209,7 +198,7 @@ - + @@ -239,6 +228,11 @@ ############################################################################# --> + + + * + + @@ -255,6 +249,12 @@ /wp-tests-config-sample\.php + + + /wp-tests-config-sample\.php + + /tests/phpunit/tests/* @@ -274,9 +274,10 @@ /src/wp-includes/class-wpdb\.php - - - * + + + /src/wp-includes/blocks/* diff --git a/src/wp-admin/includes/class-wp-site-health-auto-updates.php b/src/wp-admin/includes/class-wp-site-health-auto-updates.php index f8521ab2b0..85decaaad2 100644 --- a/src/wp-admin/includes/class-wp-site-health-auto-updates.php +++ b/src/wp-admin/includes/class-wp-site-health-auto-updates.php @@ -228,7 +228,7 @@ class WP_Site_Health_Auto_Updates { // Search all directories we've found for evidence of version control. foreach ( $vcs_dirs as $vcs_dir ) { foreach ( $check_dirs as $check_dir ) { - // phpcs:ignore WordPress.CodeAnalysis.AssignmentInCondition,Squiz.PHP.DisallowMultipleAssignments + // phpcs:ignore Generic.CodeAnalysis.AssignmentInCondition,Squiz.PHP.DisallowMultipleAssignments if ( $checkout = @is_dir( rtrim( $check_dir, '\\/' ) . "/$vcs_dir" ) ) { break 2; } diff --git a/src/wp-admin/includes/image.php b/src/wp-admin/includes/image.php index ad6a8f0f4b..5f9141c4d6 100644 --- a/src/wp-admin/includes/image.php +++ b/src/wp-admin/includes/image.php @@ -700,7 +700,7 @@ function wp_exif_frac2dec( $str ) { } // The denominator must not be zero. - if ( 0 == $denominator ) { // phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison -- Deliberate loose comparison. + if ( 0 == $denominator ) { // phpcs:ignore Universal.Operators.StrictComparisons.LooseEqual -- Deliberate loose comparison. return 0; } diff --git a/src/wp-admin/plugins.php b/src/wp-admin/plugins.php index 13a28e127e..93f9c454ab 100644 --- a/src/wp-admin/plugins.php +++ b/src/wp-admin/plugins.php @@ -511,7 +511,7 @@ if ( $action ) { // Return early if all selected plugins already have auto-updates enabled or disabled. // Must use non-strict comparison, so that array order is not treated as significant. - if ( $new_auto_updates == $auto_updates ) { // phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison + if ( $new_auto_updates == $auto_updates ) { // phpcs:ignore Universal.Operators.StrictComparisons.LooseEqual wp_redirect( $redirect ); exit; } diff --git a/src/wp-includes/category-template.php b/src/wp-includes/category-template.php index bfb7f6d85c..0525ae792a 100644 --- a/src/wp-includes/category-template.php +++ b/src/wp-includes/category-template.php @@ -881,7 +881,7 @@ function wp_generate_tag_cloud( $tags, $args = '' ) { } } elseif ( isset( $args['single_text'] ) && isset( $args['multiple_text'] ) ) { // If no callback exists, look for the old-style single_text and multiple_text arguments. - // phpcs:ignore WordPress.WP.I18n.NonSingularStringLiteralSingle,WordPress.WP.I18n.NonSingularStringLiteralPlural + // phpcs:ignore WordPress.WP.I18n.NonSingularStringLiteralSingular,WordPress.WP.I18n.NonSingularStringLiteralPlural $translate_nooped_plural = _n_noop( $args['single_text'], $args['multiple_text'] ); } else { // This is the default for when no callback, plural, or argument is passed in. diff --git a/src/wp-includes/formatting.php b/src/wp-includes/formatting.php index f94d3170a5..bc150c8a53 100644 --- a/src/wp-includes/formatting.php +++ b/src/wp-includes/formatting.php @@ -831,7 +831,7 @@ function shortcode_unautop( $text ) { $tagregexp = implode( '|', array_map( 'preg_quote', array_keys( $shortcode_tags ) ) ); $spaces = wp_spaces_regexp(); - // phpcs:disable Squiz.Strings.ConcatenationSpacing.PaddingFound,WordPress.WhiteSpace.PrecisionAlignment.Found -- don't remove regex indentation + // phpcs:disable Squiz.Strings.ConcatenationSpacing.PaddingFound,Universal.WhiteSpace.PrecisionAlignment.Found -- don't remove regex indentation $pattern = '/' . '

' // Opening paragraph. @@ -5683,7 +5683,7 @@ function wp_basename( $path, $suffix = '' ) { return urldecode( basename( str_replace( array( '%2F', '%5C' ), '/', urlencode( $path ) ), $suffix ) ); } -// phpcs:disable WordPress.WP.CapitalPDangit.Misspelled, WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid -- 8-) +// phpcs:disable WordPress.WP.CapitalPDangit.MisspelledInComment,WordPress.WP.CapitalPDangit.MisspelledInText,WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid -- 8-) /** * Forever eliminate "Wordpress" from the planet (or at least the little bit we can influence). * diff --git a/src/wp-includes/post.php b/src/wp-includes/post.php index 696e74ed2c..197653feda 100644 --- a/src/wp-includes/post.php +++ b/src/wp-includes/post.php @@ -1382,7 +1382,7 @@ function register_post_status( $post_status, $args = array() ) { } if ( false === $args->label_count ) { - // phpcs:ignore WordPress.WP.I18n.NonSingularStringLiteralSingle,WordPress.WP.I18n.NonSingularStringLiteralPlural + // phpcs:ignore WordPress.WP.I18n.NonSingularStringLiteralSingular,WordPress.WP.I18n.NonSingularStringLiteralPlural $args->label_count = _n_noop( $args->label, $args->label ); } diff --git a/tests/phpunit/tests/customize/manager.php b/tests/phpunit/tests/customize/manager.php index d375bff3f6..44f4c52ed9 100644 --- a/tests/phpunit/tests/customize/manager.php +++ b/tests/phpunit/tests/customize/manager.php @@ -1345,7 +1345,7 @@ class Tests_WP_Customize_Manager extends WP_UnitTestCase { // User saved as one who can bypass content_save_pre filter. $this->assertStringContainsString( '