From 1b3c5cd096b60e49abd2ebb0c73e225696c3e3c9 Mon Sep 17 00:00:00 2001 From: Tetsuaki Hamano Date: Sun, 15 Oct 2023 20:24:33 +0900 Subject: [PATCH] Update wpcs to 3.0 --- composer.json | 6 +- composer.lock | 249 +++++++++++++++++++++++++++++++++++++++--- inc/class-config.php | 4 +- inc/class-enqueue.php | 4 +- inc/class-main.php | 10 +- 5 files changed, 245 insertions(+), 28 deletions(-) diff --git a/composer.json b/composer.json index 04b32a3..466ef29 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { "name": "t-hamano/richtext-extension", - "description": "WordPress plugin to add useful decoration features to the Gutenberg RichText editor toolbar.", + "description": "WordPress plugin to add useful decoration features to the Gutenberg RichText editor toolbar.", "license": "GPL-2.0-or-later", "authors": [ { @@ -9,10 +9,10 @@ ], "require-dev": { "squizlabs/php_codesniffer": "*", - "wp-coding-standards/wpcs": "*" + "wp-coding-standards/wpcs": "^3.0" }, "scripts": { - "phpcs": "phpcs --config-set installed_paths vendor/wp-coding-standards/wpcs", + "phpcs": "phpcs --config-set installed_paths vendor/wp-coding-standards/wpcs,vendor/phpcsstandards/phpcsextra,vendor/phpcsstandards/phpcsutils", "lint": "phpcs ./ --standard=./phpcs.ruleset.xml" } } diff --git a/composer.lock b/composer.lock index 56afe7b..52baa5a 100644 --- a/composer.lock +++ b/composer.lock @@ -4,21 +4,222 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "47d68ec8bd34753f9dca8d25418288e5", + "content-hash": "e93c1983ecf1890cf03151ae84faff66", "packages": [], "packages-dev": [ + { + "name": "dealerdirect/phpcodesniffer-composer-installer", + "version": "v1.0.0", + "source": { + "type": "git", + "url": "https://github.com/PHPCSStandards/composer-installer.git", + "reference": "4be43904336affa5c2f70744a348312336afd0da" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHPCSStandards/composer-installer/zipball/4be43904336affa5c2f70744a348312336afd0da", + "reference": "4be43904336affa5c2f70744a348312336afd0da", + "shasum": "" + }, + "require": { + "composer-plugin-api": "^1.0 || ^2.0", + "php": ">=5.4", + "squizlabs/php_codesniffer": "^2.0 || ^3.1.0 || ^4.0" + }, + "require-dev": { + "composer/composer": "*", + "ext-json": "*", + "ext-zip": "*", + "php-parallel-lint/php-parallel-lint": "^1.3.1", + "phpcompatibility/php-compatibility": "^9.0", + "yoast/phpunit-polyfills": "^1.0" + }, + "type": "composer-plugin", + "extra": { + "class": "PHPCSStandards\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\Plugin" + }, + "autoload": { + "psr-4": { + "PHPCSStandards\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Franck Nijhof", + "email": "franck.nijhof@dealerdirect.com", + "homepage": "http://www.frenck.nl", + "role": "Developer / IT Manager" + }, + { + "name": "Contributors", + "homepage": "https://github.com/PHPCSStandards/composer-installer/graphs/contributors" + } + ], + "description": "PHP_CodeSniffer Standards Composer Installer Plugin", + "homepage": "http://www.dealerdirect.com", + "keywords": [ + "PHPCodeSniffer", + "PHP_CodeSniffer", + "code quality", + "codesniffer", + "composer", + "installer", + "phpcbf", + "phpcs", + "plugin", + "qa", + "quality", + "standard", + "standards", + "style guide", + "stylecheck", + "tests" + ], + "time": "2023-01-05T11:28:13+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" + ], + "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" + ], + "time": "2023-07-16T21:39:41+00:00" + }, { "name": "squizlabs/php_codesniffer", - "version": "3.5.8", + "version": "3.7.2", "source": { "type": "git", "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", - "reference": "9d583721a7157ee997f235f327de038e7ea6dac4" + "reference": "ed8e00df0a83aa96acf703f8c2979ff33341f879" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/9d583721a7157ee997f235f327de038e7ea6dac4", - "reference": "9d583721a7157ee997f235f327de038e7ea6dac4", + "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/ed8e00df0a83aa96acf703f8c2979ff33341f879", + "reference": "ed8e00df0a83aa96acf703f8c2979ff33341f879", "shasum": "" }, "require": { @@ -54,36 +255,45 @@ "homepage": "https://github.com/squizlabs/PHP_CodeSniffer", "keywords": [ "phpcs", - "standards" + "standards", + "static analysis" ], - "time": "2020-10-23T02:01:07+00:00" + "time": "2023-02-22T23:07: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/", @@ -100,9 +310,16 @@ "keywords": [ "phpcs", "standards", + "static analysis", "wordpress" ], - "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": [], diff --git a/inc/class-config.php b/inc/class-config.php index 92de3e5..a5328f8 100644 --- a/inc/class-config.php +++ b/inc/class-config.php @@ -11,7 +11,7 @@ class Config { /** * Default highlighter variation */ - static $highlighter = array( + public static $highlighter = array( array( 'color' => '#ffff66', 'thickness' => 40, @@ -41,5 +41,5 @@ class Config { /** * Default font size variation */ - static $font_size = array( 80, 90, 130, 160 ); + public static $font_size = array( 80, 90, 130, 160 ); } diff --git a/inc/class-enqueue.php b/inc/class-enqueue.php index f6fe715..e93021a 100644 --- a/inc/class-enqueue.php +++ b/inc/class-enqueue.php @@ -12,7 +12,7 @@ class Enqueue { /** * Constructor */ - function __construct() { + public function __construct() { // Enqueue front-end scripts add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) ); @@ -50,7 +50,7 @@ public function enqueue_editor_scripts() { wp_add_inline_style( RTEX_NAMESPACE, $inline_css ); - $asset = include( RTEX_PATH . '/build/index.asset.php' ); + $asset = include RTEX_PATH . '/build/index.asset.php'; wp_enqueue_script( RTEX_NAMESPACE, RTEX_URL . '/build/index.js', $asset['dependencies'] ); wp_localize_script( RTEX_NAMESPACE, 'rtexConf', $this->create_editor_config() ); diff --git a/inc/class-main.php b/inc/class-main.php index 5b1f1b1..20d3e99 100644 --- a/inc/class-main.php +++ b/inc/class-main.php @@ -26,9 +26,9 @@ public function __construct() { * Load classes */ private function load_classes() { - require_once( RTEX_PATH . '/inc/class-config.php' ); - require_once( RTEX_PATH . '/inc/class-enqueue.php' ); - require_once( RTEX_PATH . '/inc/class-options.php' ); + require_once RTEX_PATH . '/inc/class-config.php'; + require_once RTEX_PATH . '/inc/class-enqueue.php'; + require_once RTEX_PATH . '/inc/class-options.php'; } /** @@ -46,7 +46,7 @@ public function add_action_links( $links ) { public static function uninstall_richtext_extension() { $options = array(); - for ( $i = 0; $i <= 3; $i ++ ) { + for ( $i = 0; $i <= 3; $i++ ) { $options[] = 'rtex_highlighter_active_' . $i; $options[] = 'rtex_highlighter_title_' . $i; $options[] = 'rtex_highlighter_color_' . $i; @@ -54,7 +54,7 @@ public static function uninstall_richtext_extension() { $options[] = 'rtex_highlighter_opacity_' . $i; } - for ( $i = 0; $i <= 3; $i ++ ) { + for ( $i = 0; $i <= 3; $i++ ) { $options[] = 'rtex_font_size_active_' . $i; $options[] = 'rtex_font_size_title_' . $i; $options[] = 'rtex_font_size_size_' . $i;