diff --git a/admin/load.php b/admin/load.php index 2d1ae052d1..66cb2bb1cb 100644 --- a/admin/load.php +++ b/admin/load.php @@ -83,7 +83,7 @@ function perflab_load_modules_page( $modules = null, $focus_areas = null ) { add_settings_field( $module_slug, $module_data['name'], - static function() use ( $module_slug, $module_data, $module_settings ) { + static function () use ( $module_slug, $module_data, $module_settings ) { perflab_render_modules_page_field( $module_slug, $module_data, $module_settings ); }, PERFLAB_MODULES_SCREEN, @@ -238,7 +238,7 @@ function perflab_get_modules( $modules_root = null ) { // Modules are organized as {focus}/{module-slug} in the modules folder. if ( $modules_dir ) { - // phpcs:ignore WordPress.CodeAnalysis.AssignmentInCondition.FoundInWhileCondition + // phpcs:ignore Generic.CodeAnalysis.AssignmentInCondition.FoundInWhileCondition while ( ( $focus = readdir( $modules_dir ) ) !== false ) { if ( '.' === substr( $focus, 0, 1 ) ) { continue; @@ -253,7 +253,7 @@ function perflab_get_modules( $modules_root = null ) { // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged $focus_dir = @opendir( $modules_root . '/' . $focus ); if ( $focus_dir ) { - // phpcs:ignore WordPress.CodeAnalysis.AssignmentInCondition.FoundInWhileCondition + // phpcs:ignore Generic.CodeAnalysis.AssignmentInCondition.FoundInWhileCondition while ( ( $file = readdir( $focus_dir ) ) !== false ) { // Unlike plugins, modules must be in a directory. if ( ! is_dir( $modules_root . '/' . $focus . '/' . $file ) ) { @@ -264,7 +264,7 @@ function perflab_get_modules( $modules_root = null ) { // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged $module_dir = @opendir( $modules_root . '/' . $focus . '/' . $file ); if ( $module_dir ) { - // phpcs:ignore WordPress.CodeAnalysis.AssignmentInCondition.FoundInWhileCondition + // phpcs:ignore Generic.CodeAnalysis.AssignmentInCondition.FoundInWhileCondition while ( ( $subfile = readdir( $module_dir ) ) !== false ) { if ( '.' === substr( $subfile, 0, 1 ) ) { continue; @@ -304,7 +304,7 @@ function perflab_get_modules( $modules_root = null ) { uasort( $modules, - static function( $a, $b ) { + static function ( $a, $b ) { return strnatcasecmp( $a['name'], $b['name'] ); } ); diff --git a/admin/server-timing.php b/admin/server-timing.php index 22b4a5809e..94a520ec2f 100644 --- a/admin/server-timing.php +++ b/admin/server-timing.php @@ -74,7 +74,7 @@ static function () { add_settings_section( 'benchmarking', __( 'Benchmarking', 'performance-lab' ), - static function() { + static function () { ?>
=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-07-19T19:40:11+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": "phpstan/extension-installer", "version": "1.3.1", @@ -2585,30 +2721,38 @@ }, { "name": "wp-coding-standards/wpcs", - "version": "2.3.0", + "version": "3.0.0", "source": { "type": "git", "url": "https://github.com/WordPress/WordPress-Coding-Standards.git", - "reference": "7da1894633f168fe244afc6de00d141f27517b62" + "reference": "bb792cb331472b82c5d7f28fb9b8ec2d20f68826" }, "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/bb792cb331472b82c5d7f28fb9b8ec2d20f68826", + "reference": "bb792cb331472b82c5d7f28fb9b8ec2d20f68826", "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/", @@ -2625,6 +2769,7 @@ "keywords": [ "phpcs", "standards", + "static analysis", "wordpress" ], "support": { @@ -2632,7 +2777,7 @@ "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" + "time": "2023-08-21T14:28:38+00:00" }, { "name": "wp-phpunit/wp-phpunit", @@ -2752,5 +2897,5 @@ "php": ">=5.6|^7|^8" }, "platform-dev": [], - "plugin-api-version": "2.0.0" + "plugin-api-version": "2.3.0" } diff --git a/load.php b/load.php index 617c1b3147..9b91c12d76 100644 --- a/load.php +++ b/load.php @@ -70,7 +70,7 @@ function perflab_get_modules_setting_default() { $default_enabled_modules = require PERFLAB_PLUGIN_DIR_PATH . 'default-enabled-modules.php'; $default_option = array_reduce( $default_enabled_modules, - static function( $module_settings, $module_dir ) { + static function ( $module_settings, $module_dir ) { $module_settings[ $module_dir ] = array( 'enabled' => true ); return $module_settings; }, @@ -97,7 +97,7 @@ function perflab_sanitize_modules_setting( $value ) { // Ensure that every element is an array with an 'enabled' key. return array_filter( array_map( - static function( $module_settings ) { + static function ( $module_settings ) { if ( ! is_array( $module_settings ) ) { return array(); } @@ -152,7 +152,7 @@ function perflab_get_active_modules() { $modules = array_keys( array_filter( perflab_get_module_settings(), - static function( $module_settings ) { + static function ( $module_settings ) { return isset( $module_settings['enabled'] ) && $module_settings['enabled']; } ) @@ -531,7 +531,7 @@ function perflab_deactivate_module( $module_dir_path ) { * @param string $option Name of the option to add. * @param mixed $value Value of the option. */ - static function( $option, $value ) { + static function ( $option, $value ) { perflab_run_module_activation_deactivation( perflab_get_modules_setting_default(), $value ); }, 10, diff --git a/modules/images/fetchpriority/can-load.php b/modules/images/fetchpriority/can-load.php index 35aaf0d3b5..c08b655694 100644 --- a/modules/images/fetchpriority/can-load.php +++ b/modules/images/fetchpriority/can-load.php @@ -10,6 +10,6 @@ exit; // Exit if accessed directly. } -return static function() { +return static function () { return ! function_exists( 'wp_get_loading_optimization_attributes' ); }; diff --git a/modules/images/fetchpriority/hooks.php b/modules/images/fetchpriority/hooks.php index 2eded35420..674bd9e5ad 100644 --- a/modules/images/fetchpriority/hooks.php +++ b/modules/images/fetchpriority/hooks.php @@ -76,7 +76,7 @@ function fetchpriority_render_generator() { if ( function_exists( 'wp_get_loading_optimization_attributes' ) && ! str_starts_with( FETCHPRIORITY_VERSION, 'Performance Lab ' ) ) { add_action( 'admin_notices', - static function() { + static function () { ?>
diff --git a/modules/images/webp-uploads/can-load.php b/modules/images/webp-uploads/can-load.php index 770f6af749..09d6e119ba 100644 --- a/modules/images/webp-uploads/can-load.php +++ b/modules/images/webp-uploads/can-load.php @@ -10,6 +10,6 @@ exit; // Exit if accessed directly. } -return static function() { +return static function () { return ! function_exists( 'wp_image_use_alternate_mime_types' ); }; diff --git a/modules/images/webp-uploads/load.php b/modules/images/webp-uploads/load.php index c4a9a4517d..8fc989fd52 100644 --- a/modules/images/webp-uploads/load.php +++ b/modules/images/webp-uploads/load.php @@ -24,7 +24,7 @@ if ( ! require __DIR__ . '/can-load.php' ) { add_action( 'admin_notices', - static function() { + static function () { printf( '
%s