From 3969b80629c84a290df522fc9dc4ddf49a4fb6c7 Mon Sep 17 00:00:00 2001 From: Fernando Morgenstern Date: Tue, 24 Oct 2023 07:39:19 -0300 Subject: [PATCH] Update PHP code sniffer version --- composer.json | 9 +- composer.lock | 207 ++++++++++++++++++++++++++++---- inc/block-widgets.php | 2 +- inc/class-mailrelay-wpforms.php | 6 +- inc/class-mailrelaypages.php | 2 +- inc/common.php | 28 ++--- mailrelay.php | 2 - phpcs.xml | 5 + 8 files changed, 211 insertions(+), 50 deletions(-) diff --git a/composer.json b/composer.json index 682eca2..1cc15f1 100644 --- a/composer.json +++ b/composer.json @@ -2,10 +2,15 @@ "license": "GPL-2.0-or-later", "require": { "php": ">=5.4", - "squizlabs/php_codesniffer": "^3.3.1" + "squizlabs/php_codesniffer": "^3.7.2" }, "require-dev": { - "wp-coding-standards/wpcs": "^2.3", + "wp-coding-standards/wpcs": "^3.0.1", "dealerdirect/phpcodesniffer-composer-installer": "^0.7.1" + }, + "config": { + "allow-plugins": { + "dealerdirect/phpcodesniffer-composer-installer": true + } } } diff --git a/composer.lock b/composer.lock index 4d40026..997b7e2 100644 --- a/composer.lock +++ b/composer.lock @@ -4,20 +4,20 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "99da8f7a812d0b5f8d1b908d9eb3855a", + "content-hash": "f4b2551e30875d2b4d34467ded40afca", "packages": [ { "name": "squizlabs/php_codesniffer", - "version": "3.6.2", + "version": "3.7.2", "source": { "type": "git", "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", - "reference": "5e4e71592f69da17871dba6e80dd51bce74a351a" + "reference": "ed8e00df0a83aa96acf703f8c2979ff33341f879" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/5e4e71592f69da17871dba6e80dd51bce74a351a", - "reference": "5e4e71592f69da17871dba6e80dd51bce74a351a", + "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/ed8e00df0a83aa96acf703f8c2979ff33341f879", + "reference": "ed8e00df0a83aa96acf703f8c2979ff33341f879", "shasum": "" }, "require": { @@ -53,40 +53,41 @@ "homepage": "https://github.com/squizlabs/PHP_CodeSniffer", "keywords": [ "phpcs", - "standards" + "standards", + "static analysis" ], "support": { "issues": "https://github.com/squizlabs/PHP_CodeSniffer/issues", "source": "https://github.com/squizlabs/PHP_CodeSniffer", "wiki": "https://github.com/squizlabs/PHP_CodeSniffer/wiki" }, - "time": "2021-12-12T21:44:58+00:00" + "time": "2023-02-22T23:07:41+00:00" } ], "packages-dev": [ { "name": "dealerdirect/phpcodesniffer-composer-installer", - "version": "v0.7.1", + "version": "v0.7.2", "source": { "type": "git", "url": "https://github.com/Dealerdirect/phpcodesniffer-composer-installer.git", - "reference": "fe390591e0241955f22eb9ba327d137e501c771c" + "reference": "1c968e542d8843d7cd71de3c5c9c3ff3ad71a1db" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Dealerdirect/phpcodesniffer-composer-installer/zipball/fe390591e0241955f22eb9ba327d137e501c771c", - "reference": "fe390591e0241955f22eb9ba327d137e501c771c", + "url": "https://api.github.com/repos/Dealerdirect/phpcodesniffer-composer-installer/zipball/1c968e542d8843d7cd71de3c5c9c3ff3ad71a1db", + "reference": "1c968e542d8843d7cd71de3c5c9c3ff3ad71a1db", "shasum": "" }, "require": { "composer-plugin-api": "^1.0 || ^2.0", "php": ">=5.3", - "squizlabs/php_codesniffer": "^2.0 || ^3.0 || ^4.0" + "squizlabs/php_codesniffer": "^2.0 || ^3.1.0 || ^4.0" }, "require-dev": { "composer/composer": "*", - "phpcompatibility/php-compatibility": "^9.0", - "sensiolabs/security-checker": "^4.1.0" + "php-parallel-lint/php-parallel-lint": "^1.3.1", + "phpcompatibility/php-compatibility": "^9.0" }, "type": "composer-plugin", "extra": { @@ -107,6 +108,10 @@ "email": "franck.nijhof@dealerdirect.com", "homepage": "http://www.frenck.nl", "role": "Developer / IT Manager" + }, + { + "name": "Contributors", + "homepage": "https://github.com/Dealerdirect/phpcodesniffer-composer-installer/graphs/contributors" } ], "description": "PHP_CodeSniffer Standards Composer Installer Plugin", @@ -118,6 +123,7 @@ "codesniffer", "composer", "installer", + "phpcbf", "phpcs", "plugin", "qa", @@ -132,34 +138,178 @@ "issues": "https://github.com/dealerdirect/phpcodesniffer-composer-installer/issues", "source": "https://github.com/dealerdirect/phpcodesniffer-composer-installer" }, - "time": "2020-12-07T18:04:37+00:00" + "time": "2022-02-04T12:51:07+00:00" + }, + { + "name": "phpcsstandards/phpcsextra", + "version": "1.1.2", + "source": { + "type": "git", + "url": "https://github.com/PHPCSStandards/PHPCSExtra.git", + "reference": "746c3190ba8eb2f212087c947ba75f4f5b9a58d5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHPCSStandards/PHPCSExtra/zipball/746c3190ba8eb2f212087c947ba75f4f5b9a58d5", + "reference": "746c3190ba8eb2f212087c947ba75f4f5b9a58d5", + "shasum": "" + }, + "require": { + "php": ">=5.4", + "phpcsstandards/phpcsutils": "^1.0.8", + "squizlabs/php_codesniffer": "^3.7.1" + }, + "require-dev": { + "php-parallel-lint/php-console-highlighter": "^1.0", + "php-parallel-lint/php-parallel-lint": "^1.3.2", + "phpcsstandards/phpcsdevcs": "^1.1.6", + "phpcsstandards/phpcsdevtools": "^1.2.1", + "phpunit/phpunit": "^4.5 || ^5.0 || ^6.0 || ^7.0" + }, + "type": "phpcodesniffer-standard", + "extra": { + "branch-alias": { + "dev-stable": "1.x-dev", + "dev-develop": "1.x-dev" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPL-3.0-or-later" + ], + "authors": [ + { + "name": "Juliette Reinders Folmer", + "homepage": "https://github.com/jrfnl", + "role": "lead" + }, + { + "name": "Contributors", + "homepage": "https://github.com/PHPCSStandards/PHPCSExtra/graphs/contributors" + } + ], + "description": "A collection of sniffs and standards for use with PHP_CodeSniffer.", + "keywords": [ + "PHP_CodeSniffer", + "phpcbf", + "phpcodesniffer-standard", + "phpcs", + "standards", + "static analysis" + ], + "support": { + "issues": "https://github.com/PHPCSStandards/PHPCSExtra/issues", + "source": "https://github.com/PHPCSStandards/PHPCSExtra" + }, + "time": "2023-09-20T22:06:18+00:00" + }, + { + "name": "phpcsstandards/phpcsutils", + "version": "1.0.8", + "source": { + "type": "git", + "url": "https://github.com/PHPCSStandards/PHPCSUtils.git", + "reference": "69465cab9d12454e5e7767b9041af0cd8cd13be7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHPCSStandards/PHPCSUtils/zipball/69465cab9d12454e5e7767b9041af0cd8cd13be7", + "reference": "69465cab9d12454e5e7767b9041af0cd8cd13be7", + "shasum": "" + }, + "require": { + "dealerdirect/phpcodesniffer-composer-installer": "^0.4.1 || ^0.5 || ^0.6.2 || ^0.7 || ^1.0", + "php": ">=5.4", + "squizlabs/php_codesniffer": "^3.7.1 || 4.0.x-dev@dev" + }, + "require-dev": { + "ext-filter": "*", + "php-parallel-lint/php-console-highlighter": "^1.0", + "php-parallel-lint/php-parallel-lint": "^1.3.2", + "phpcsstandards/phpcsdevcs": "^1.1.6", + "yoast/phpunit-polyfills": "^1.0.5 || ^2.0.0" + }, + "type": "phpcodesniffer-standard", + "extra": { + "branch-alias": { + "dev-stable": "1.x-dev", + "dev-develop": "1.x-dev" + } + }, + "autoload": { + "classmap": [ + "PHPCSUtils/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPL-3.0-or-later" + ], + "authors": [ + { + "name": "Juliette Reinders Folmer", + "homepage": "https://github.com/jrfnl", + "role": "lead" + }, + { + "name": "Contributors", + "homepage": "https://github.com/PHPCSStandards/PHPCSUtils/graphs/contributors" + } + ], + "description": "A suite of utility functions for use with PHP_CodeSniffer", + "homepage": "https://phpcsutils.com/", + "keywords": [ + "PHP_CodeSniffer", + "phpcbf", + "phpcodesniffer-standard", + "phpcs", + "phpcs3", + "standards", + "static analysis", + "tokens", + "utility" + ], + "support": { + "docs": "https://phpcsutils.com/", + "issues": "https://github.com/PHPCSStandards/PHPCSUtils/issues", + "source": "https://github.com/PHPCSStandards/PHPCSUtils" + }, + "time": "2023-07-16T21:39:41+00:00" }, { "name": "wp-coding-standards/wpcs", - "version": "2.3.0", + "version": "3.0.1", "source": { "type": "git", "url": "https://github.com/WordPress/WordPress-Coding-Standards.git", - "reference": "7da1894633f168fe244afc6de00d141f27517b62" + "reference": "b4caf9689f1a0e4a4c632679a44e638c1c67aff1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/WordPress/WordPress-Coding-Standards/zipball/7da1894633f168fe244afc6de00d141f27517b62", - "reference": "7da1894633f168fe244afc6de00d141f27517b62", + "url": "https://api.github.com/repos/WordPress/WordPress-Coding-Standards/zipball/b4caf9689f1a0e4a4c632679a44e638c1c67aff1", + "reference": "b4caf9689f1a0e4a4c632679a44e638c1c67aff1", "shasum": "" }, "require": { + "ext-filter": "*", + "ext-libxml": "*", + "ext-tokenizer": "*", + "ext-xmlreader": "*", "php": ">=5.4", - "squizlabs/php_codesniffer": "^3.3.1" + "phpcsstandards/phpcsextra": "^1.1.0", + "phpcsstandards/phpcsutils": "^1.0.8", + "squizlabs/php_codesniffer": "^3.7.2" }, "require-dev": { - "dealerdirect/phpcodesniffer-composer-installer": "^0.5 || ^0.6", + "php-parallel-lint/php-console-highlighter": "^1.0.0", + "php-parallel-lint/php-parallel-lint": "^1.3.2", "phpcompatibility/php-compatibility": "^9.0", - "phpcsstandards/phpcsdevtools": "^1.0", + "phpcsstandards/phpcsdevtools": "^1.2.0", "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0" }, "suggest": { - "dealerdirect/phpcodesniffer-composer-installer": "^0.6 || This Composer plugin will sort out the PHPCS 'installed_paths' automatically." + "ext-iconv": "For improved results", + "ext-mbstring": "For improved results" }, "type": "phpcodesniffer-standard", "notification-url": "https://packagist.org/downloads/", @@ -176,6 +326,7 @@ "keywords": [ "phpcs", "standards", + "static analysis", "wordpress" ], "support": { @@ -183,7 +334,13 @@ "source": "https://github.com/WordPress/WordPress-Coding-Standards", "wiki": "https://github.com/WordPress/WordPress-Coding-Standards/wiki" }, - "time": "2020-05-13T23:57:56+00:00" + "funding": [ + { + "url": "https://opencollective.com/thewpcc/contribute/wp-php-63406", + "type": "custom" + } + ], + "time": "2023-09-14T07:06:09+00:00" } ], "aliases": [], @@ -195,5 +352,5 @@ "php": ">=5.4" }, "platform-dev": [], - "plugin-api-version": "2.0.0" + "plugin-api-version": "2.3.0" } diff --git a/inc/block-widgets.php b/inc/block-widgets.php index 9388f09..0de57c7 100644 --- a/inc/block-widgets.php +++ b/inc/block-widgets.php @@ -20,7 +20,7 @@ function mailrelay_wpforms_init() { 'mailrelay/mailrelay-wpforms', array( 'editor_script' => 'mailrelay-wpforms-block', - 'editor_style' => 'mailrelay-wpforms-block-editor-style' + 'editor_style' => 'mailrelay-wpforms-block-editor-style', ) ); } diff --git a/inc/class-mailrelay-wpforms.php b/inc/class-mailrelay-wpforms.php index 27bc0b7..92b2b14 100644 --- a/inc/class-mailrelay-wpforms.php +++ b/inc/class-mailrelay-wpforms.php @@ -3,14 +3,12 @@ class Mailrelay_WPForms { public function __construct() { - add_filter( 'wpforms_builder_settings_sections', array( $this, 'settings_section' ), 20, 2 ); add_filter( 'wpforms_form_settings_panel_content', array( $this, 'settings_section_content' ), 20 ); add_action( 'wpforms_process_complete', array( $this, 'send_data_to_mailrelay' ), 10, 4 ); - } - public function settings_section( $sections, $form_data ) { + public function settings_section( $sections ) { $sections['mailrelay'] = __( 'Mailrelay', 'mailrelay' ); return $sections; } @@ -134,9 +132,7 @@ public function send_data_to_mailrelay( $fields, $entry, $form_data, $entry_id ) ) ); } - } - } new Mailrelay_WPForms(); diff --git a/inc/class-mailrelaypages.php b/inc/class-mailrelaypages.php index 8e1d98a..f1378da 100644 --- a/inc/class-mailrelaypages.php +++ b/inc/class-mailrelaypages.php @@ -149,7 +149,7 @@ public function render_admin_page() {

%1$s.ipzmarketing.com (Change Account)', 'mailrelay' ), esc_html( $this->mailrelay_data()['host'] ), esc_url( $link ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped + printf( __( 'You are currently logged in as %1$s.ipzmarketing.com (Change Account)', 'mailrelay' ), esc_html( $this->mailrelay_data()['host'] ), esc_url( $link ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>

array( - 's' => 'name' + 'q' => array( + 's' => 'name', ), - 'page' => $page, - 'per_page' => $per_page + 'page' => $page, + 'per_page' => $per_page, ); - $response = mailrelay_api_request( 'GET', 'groups?'. http_build_query($query_parameters) ); + $response = mailrelay_api_request( 'GET', 'groups?' . http_build_query($query_parameters) ); if ( $response['wp_error'] ) { /* translators: %s error message */ @@ -82,8 +82,8 @@ function mailrelay_get_groups() { $groups = array_merge($groups, $response['body']); - $page += 1; - } while(count($response['body']) >= $per_page); + ++$page; + } while ( count($response['body']) >= $per_page ); // phpcs:ignore Squiz.PHP.DisallowSizeFunctionsInLoops.Found return $groups; } @@ -168,18 +168,18 @@ function mailrelay_get_signup_forms( $form_id = 0 ) { do { $query_parameters = array( - 'q' => array( - 's' => 'name' + 'q' => array( + 's' => 'name', ), - 'page' => $page, - 'per_page' => $per_page + 'page' => $page, + 'per_page' => $per_page, ); if ( (int) $form_id > 0 ) { $query_parameters['q']['id_eq'] = (int) $form_id; } - $response = mailrelay_api_request( 'GET', 'signup_forms?'. http_build_query($query_parameters) ); + $response = mailrelay_api_request( 'GET', 'signup_forms?' . http_build_query($query_parameters) ); if ( $response['wp_error'] ) { /* translators: %s error message */ @@ -193,8 +193,8 @@ function mailrelay_get_signup_forms( $form_id = 0 ) { $signup_forms = array_merge($signup_forms, $response['body']); - $page += 1; - } while(count($response['body']) >= $per_page); + ++$page; + } while ( count($response['body']) >= $per_page ); // phpcs:ignore Squiz.PHP.DisallowSizeFunctionsInLoops.Found return $signup_forms; } diff --git a/mailrelay.php b/mailrelay.php index b7ec884..b444554 100644 --- a/mailrelay.php +++ b/mailrelay.php @@ -29,8 +29,6 @@ } function mailrelay_wpforms() { - require_once __DIR__ . '/inc/class-mailrelay-wpforms.php'; - } add_action( 'wpforms_loaded', 'mailrelay_wpforms' ); diff --git a/phpcs.xml b/phpcs.xml index d445fd5..132fa82 100644 --- a/phpcs.xml +++ b/phpcs.xml @@ -12,6 +12,11 @@ + + + + + .