From 986018b3de05f2ec5c0c04e2440bbb1c43fb54f8 Mon Sep 17 00:00:00 2001 From: jrfnl Date: Tue, 29 Oct 2019 14:51:30 +0100 Subject: [PATCH 1/5] PHPCS: Update to YoastCS 2.0.0 This updates the dependency in `composer.json`, as well as the PHPCS ruleset for YoastCS 2.0.0. Includes: * A selective update of the `composer.lock` for just YoastCS and its dependencies. * Removing the tweaks to the Composer `check-cs` script to allow for PHP >= 5.6. PHP 5.6 is now the minimum PHP version everywhere. Ref: https://github.com/Yoast/yoastcs/releases/tag/2.0.0 --- .phpcs.xml.dist | 43 ++++++++++++++++++++++++++++--------------- composer.json | 4 ++-- composer.lock | 20 +++++++++++--------- 3 files changed, 41 insertions(+), 26 deletions(-) diff --git a/.phpcs.xml.dist b/.phpcs.xml.dist index 66b2727..63c3d27 100644 --- a/.phpcs.xml.dist +++ b/.phpcs.xml.dist @@ -33,7 +33,15 @@ ############################################################################# --> - + + + + + + + + + - + - + @@ -67,21 +75,17 @@ */deprecated/deprecated-classes\.php$ - - - - - - - - - - - - + + + */deprecated/*\.php$ @@ -93,6 +97,15 @@ ############################################################################# --> + + + + + + + + + diff --git a/composer.json b/composer.json index 0fbeb2e..f87a94e 100644 --- a/composer.json +++ b/composer.json @@ -28,7 +28,7 @@ "yoast/i18n-module": "^3.1.1" }, "require-dev": { - "yoast/yoastcs": "^1.3.0" + "yoast/yoastcs": "^2.0.0" }, "minimum-stability": "dev", "prefer-stable": true, @@ -45,7 +45,7 @@ "@php ./vendor/squizlabs/php_codesniffer/bin/phpcs --config-set default_standard Yoast" ], "check-cs": [ - "@php ./vendor/squizlabs/php_codesniffer/bin/phpcs --runtime-set testVersion 5.6-" + "@php ./vendor/squizlabs/php_codesniffer/bin/phpcs" ], "fix-cs": [ "@php ./vendor/squizlabs/php_codesniffer/bin/phpcbf" diff --git a/composer.lock b/composer.lock index c2ae54b..81c46b2 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "982d98a89c5ff3b3da1473a21a0b92a3", + "content-hash": "41394b87eb8771398bfb0a6ac639da49", "packages": [ { "name": "composer/installers", @@ -484,26 +484,28 @@ }, { "name": "yoast/yoastcs", - "version": "1.3.0", + "version": "2.0.0", "source": { "type": "git", "url": "https://github.com/Yoast/yoastcs.git", - "reference": "f2e02a9d743fb1f7d9a40dbe38c64333790ffcca" + "reference": "2f445bea2b94cfe352e3d5c11c1fc7071ca5545a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Yoast/yoastcs/zipball/f2e02a9d743fb1f7d9a40dbe38c64333790ffcca", - "reference": "f2e02a9d743fb1f7d9a40dbe38c64333790ffcca", + "url": "https://api.github.com/repos/Yoast/yoastcs/zipball/2f445bea2b94cfe352e3d5c11c1fc7071ca5545a", + "reference": "2f445bea2b94cfe352e3d5c11c1fc7071ca5545a", "shasum": "" }, "require": { "dealerdirect/phpcodesniffer-composer-installer": "^0.5.0", "php": ">=5.4", - "phpcompatibility/phpcompatibility-wp": "^2.0.0", - "squizlabs/php_codesniffer": "^3.4.2", - "wp-coding-standards/wpcs": "^2.1.1" + "phpcompatibility/phpcompatibility-wp": "^2.1.0", + "squizlabs/php_codesniffer": "^3.5.0", + "wp-coding-standards/wpcs": "^2.2.0" }, "require-dev": { + "jakub-onderka/php-console-highlighter": "^0.4", + "jakub-onderka/php-parallel-lint": "^1.0", "phpcompatibility/php-compatibility": "^9.2.0", "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0", "roave/security-advisories": "dev-master" @@ -528,7 +530,7 @@ "wordpress", "yoast" ], - "time": "2019-07-31T12:06:40+00:00" + "time": "2019-12-17T07:40:59+00:00" } ], "aliases": [], From 9d218b5ff15ccf75764db382a7fa46c18dd140db Mon Sep 17 00:00:00 2001 From: jrfnl Date: Tue, 29 Oct 2019 14:51:51 +0100 Subject: [PATCH 2/5] CS: deprecate old-style hook and add new-style hook [1] This deprecates the `yoast_comment_hacks_notification_roles` filter hook in favour of the `Yoast\WP\Comment\notification_roles` hook. [This needs a changelog entry] --- admin/admin.php | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/admin/admin.php b/admin/admin.php index 7c033df..4b6c318 100644 --- a/admin/admin.php +++ b/admin/admin.php @@ -136,18 +136,34 @@ public function reroute_comment_emails_option() { * This filter allows filtering which roles should be shown in the dropdown for notifications. * Defaults to contributor and up. * + * @deprecated 1.6.0. Use the {@see 'Yoast\WP\Comment\notification_roles'} filter instead. + * * @param array $roles Array with user roles. */ - $roles = \apply_filters( + $roles = \apply_filters_deprecated( 'yoast_comment_hacks_notification_roles', array( - 'author', - 'contributor', - 'editor', - 'administrator', - ) + array( + 'author', + 'contributor', + 'editor', + 'administrator', + ), + ), + 'Yoast Comment 1.6.0', + 'Yoast\WP\Comment\notification_roles' ); + /** + * This filter allows filtering which roles should be shown in the dropdown for notifications. + * Defaults to contributor and up. + * + * @since 1.6.0 + * + * @param array $roles Array with user roles. + */ + $roles = \apply_filters( 'Yoast\WP\Comment\notification_roles', $roles ); + \wp_dropdown_users( array( 'selected' => \get_post_meta( $post_id, self::NOTIFICATION_RECIPIENT_KEY, true ), From 829b0739e1ed0efe1e7c4de5470896da8082607b Mon Sep 17 00:00:00 2001 From: jrfnl Date: Tue, 29 Oct 2019 06:58:56 +0100 Subject: [PATCH 3/5] CS: deprecate old-style hook and add new-style hook [2] This deprecates the `yoast_ch_admin_footer` action hook in favour of the `Yoast\WP\Comment\admin_footer` hook. [This needs a changelog entry] --- .phpcs.xml.dist | 1 - admin/admin.php | 2 +- admin/views/config-page.php | 12 +++++++++++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/.phpcs.xml.dist b/.phpcs.xml.dist index 63c3d27..a163e80 100644 --- a/.phpcs.xml.dist +++ b/.phpcs.xml.dist @@ -75,7 +75,6 @@ */deprecated/deprecated-classes\.php$ -