From 7456d9dbf07d085ecd01485ac3e66dcff7f6356e Mon Sep 17 00:00:00 2001 From: Weston Ruter Date: Mon, 15 May 2023 18:12:34 -0700 Subject: [PATCH 01/16] Require phpstan packages --- composer.json | 3 + composer.lock | 297 +++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 298 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 38942a8173..2315e65e1e 100644 --- a/composer.json +++ b/composer.json @@ -14,8 +14,11 @@ "require-dev": { "dealerdirect/phpcodesniffer-composer-installer": "^0.7", "phpcompatibility/php-compatibility": "^9.3", + "phpstan/extension-installer": "^1.3.0", + "phpstan/phpstan": "^1.10", "phpunit/phpunit": "^4|^5|^6|^7|^8|^9", "squizlabs/php_codesniffer": "^3.5", + "szepeviktor/phpstan-wordpress": "^1.3.0", "wp-coding-standards/wpcs": "^2.2", "wp-phpunit/wp-phpunit": "^5.8", "yoast/phpunit-polyfills": "^1.0" diff --git a/composer.lock b/composer.lock index bca313df3f..e9ecfd31c7 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": "800fb1ee62ef74aa3e6c6cd409939cff", + "content-hash": "f11a3661fdc88ae05a344d5e20725279", "packages": [ { "name": "composer/installers", @@ -530,6 +530,50 @@ }, "time": "2022-02-21T01:04:05+00:00" }, + { + "name": "php-stubs/wordpress-stubs", + "version": "v6.2.0", + "source": { + "type": "git", + "url": "https://github.com/php-stubs/wordpress-stubs.git", + "reference": "b73fe99eadf9fb56363619dac0343b6d19907dce" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-stubs/wordpress-stubs/zipball/b73fe99eadf9fb56363619dac0343b6d19907dce", + "reference": "b73fe99eadf9fb56363619dac0343b6d19907dce", + "shasum": "" + }, + "require-dev": { + "nikic/php-parser": "< 4.12.0", + "php": "~7.3 || ~8.0", + "php-stubs/generator": "^0.8.3", + "phpdocumentor/reflection-docblock": "^5.3", + "phpstan/phpstan": "^1.9" + }, + "suggest": { + "paragonie/sodium_compat": "Pure PHP implementation of libsodium", + "symfony/polyfill-php73": "Symfony polyfill backporting some PHP 7.3+ features to lower PHP versions", + "szepeviktor/phpstan-wordpress": "WordPress extensions for PHPStan" + }, + "type": "library", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "WordPress function and class declaration stubs for static analysis.", + "homepage": "https://github.com/php-stubs/wordpress-stubs", + "keywords": [ + "PHPStan", + "static analysis", + "wordpress" + ], + "support": { + "issues": "https://github.com/php-stubs/wordpress-stubs/issues", + "source": "https://github.com/php-stubs/wordpress-stubs/tree/v6.2.0" + }, + "time": "2023-03-31T09:48:52+00:00" + }, { "name": "phpcompatibility/php-compatibility", "version": "9.3.5", @@ -592,6 +636,117 @@ }, "time": "2019-12-27T09:44:58+00:00" }, + { + "name": "phpstan/extension-installer", + "version": "1.3.0", + "source": { + "type": "git", + "url": "https://github.com/phpstan/extension-installer.git", + "reference": "f5e02d40f277d28513001976f444d9ff1dc15e9a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpstan/extension-installer/zipball/f5e02d40f277d28513001976f444d9ff1dc15e9a", + "reference": "f5e02d40f277d28513001976f444d9ff1dc15e9a", + "shasum": "" + }, + "require": { + "composer-plugin-api": "^2.0", + "php": "^7.2 || ^8.0", + "phpstan/phpstan": "^1.8.0" + }, + "require-dev": { + "composer/composer": "^2.0", + "php-parallel-lint/php-parallel-lint": "^1.2.0", + "phpstan/phpstan-strict-rules": "^0.11 || ^0.12 || ^1.0" + }, + "type": "composer-plugin", + "extra": { + "class": "PHPStan\\ExtensionInstaller\\Plugin", + "phpstan/extension-installer": { + "ignore": [ + "phpstan/phpstan-phpunit" + ] + } + }, + "autoload": { + "psr-4": { + "PHPStan\\ExtensionInstaller\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Composer plugin for automatic installation of PHPStan extensions", + "support": { + "issues": "https://github.com/phpstan/extension-installer/issues", + "source": "https://github.com/phpstan/extension-installer/tree/1.3.0" + }, + "time": "2023-04-18T13:08:02+00:00" + }, + { + "name": "phpstan/phpstan", + "version": "1.10.15", + "source": { + "type": "git", + "url": "https://github.com/phpstan/phpstan.git", + "reference": "762c4dac4da6f8756eebb80e528c3a47855da9bd" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/762c4dac4da6f8756eebb80e528c3a47855da9bd", + "reference": "762c4dac4da6f8756eebb80e528c3a47855da9bd", + "shasum": "" + }, + "require": { + "php": "^7.2|^8.0" + }, + "conflict": { + "phpstan/phpstan-shim": "*" + }, + "bin": [ + "phpstan", + "phpstan.phar" + ], + "type": "library", + "autoload": { + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "PHPStan - PHP Static Analysis Tool", + "keywords": [ + "dev", + "static analysis" + ], + "support": { + "docs": "https://phpstan.org/user-guide/getting-started", + "forum": "https://github.com/phpstan/phpstan/discussions", + "issues": "https://github.com/phpstan/phpstan/issues", + "security": "https://github.com/phpstan/phpstan/security/policy", + "source": "https://github.com/phpstan/phpstan-src" + }, + "funding": [ + { + "url": "https://github.com/ondrejmirtes", + "type": "github" + }, + { + "url": "https://github.com/phpstan", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/phpstan/phpstan", + "type": "tidelift" + } + ], + "time": "2023-05-09T15:28:01+00:00" + }, { "name": "phpunit/php-code-coverage", "version": "9.2.19", @@ -2032,6 +2187,144 @@ }, "time": "2022-06-18T07:21:10+00:00" }, + { + "name": "symfony/polyfill-php73", + "version": "v1.27.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php73.git", + "reference": "9e8ecb5f92152187c4799efd3c96b78ccab18ff9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/9e8ecb5f92152187c4799efd3c96b78ccab18ff9", + "reference": "9e8ecb5f92152187c4799efd3c96b78ccab18ff9", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.27-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Php73\\": "" + }, + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 7.3+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-php73/tree/v1.27.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2022-11-03T14:55:06+00:00" + }, + { + "name": "szepeviktor/phpstan-wordpress", + "version": "v1.3.0", + "source": { + "type": "git", + "url": "https://github.com/szepeviktor/phpstan-wordpress.git", + "reference": "5b5cc77ed51fdaf64efe3f00b5aae4b709d2cfa9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/szepeviktor/phpstan-wordpress/zipball/5b5cc77ed51fdaf64efe3f00b5aae4b709d2cfa9", + "reference": "5b5cc77ed51fdaf64efe3f00b5aae4b709d2cfa9", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0", + "php-stubs/wordpress-stubs": "^4.7 || ^5.0 || ^6.0", + "phpstan/phpstan": "^1.10.0", + "symfony/polyfill-php73": "^1.12.0" + }, + "require-dev": { + "composer/composer": "^2.1.14", + "dealerdirect/phpcodesniffer-composer-installer": "^1.0", + "php-parallel-lint/php-parallel-lint": "^1.1", + "phpstan/phpstan-strict-rules": "^1.2", + "phpunit/phpunit": "^8.0 || ^9.0", + "szepeviktor/phpcs-psr-12-neutron-hybrid-ruleset": "^0.8" + }, + "type": "phpstan-extension", + "extra": { + "phpstan": { + "includes": [ + "extension.neon" + ] + } + }, + "autoload": { + "psr-4": { + "SzepeViktor\\PHPStan\\WordPress\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "WordPress extensions for PHPStan", + "keywords": [ + "PHPStan", + "code analyse", + "code analysis", + "static analysis", + "wordpress" + ], + "support": { + "issues": "https://github.com/szepeviktor/phpstan-wordpress/issues", + "source": "https://github.com/szepeviktor/phpstan-wordpress/tree/v1.3.0" + }, + "time": "2023-04-23T06:15:06+00:00" + }, { "name": "theseer/tokenizer", "version": "1.2.1", @@ -2252,5 +2545,5 @@ "php": ">=5.6|^7|^8" }, "platform-dev": [], - "plugin-api-version": "2.3.0" + "plugin-api-version": "2.0.0" } From 1e298c35f2c5152520e39dc1dffa800f9b66ae3b Mon Sep 17 00:00:00 2001 From: Weston Ruter Date: Mon, 15 May 2023 18:13:39 -0700 Subject: [PATCH 02/16] Add package scripts and lint-staged for phpstan --- composer.json | 1 + package.json | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 2315e65e1e..6f312475db 100644 --- a/composer.json +++ b/composer.json @@ -28,6 +28,7 @@ "php": ">=5.6|^7|^8" }, "scripts": { + "phpstan": "phpstan analyze --ansi", "format": "phpcbf --standard=phpcs.xml.dist --report-summary --report-source", "lint": "phpcs --standard=phpcs.xml.dist", "test": "phpunit -c phpunit.xml.dist --verbose", diff --git a/package.json b/package.json index e0e97cd625..6b86776dd0 100644 --- a/package.json +++ b/package.json @@ -26,6 +26,7 @@ "format-js": "wp-scripts format ./bin", "lint-js": "wp-scripts lint-js ./bin", "format-php": "wp-env run composer run-script format", + "phpstan": "wp-env run composer run-script phpstan", "prelint-php": "wp-env run composer 'install --no-interaction'", "lint-php": "wp-env run composer run-script lint", "pretest-php": "wp-env run composer 'install --no-interaction'", @@ -37,7 +38,8 @@ }, "lint-staged": { "*.php": [ - "composer run-script lint" + "composer run-script lint", + "composer run-script analyze" ] } } From 0e5afc1e973848ef97babeefb4fa0b16f2f2629f Mon Sep 17 00:00:00 2001 From: Weston Ruter Date: Mon, 15 May 2023 18:16:22 -0700 Subject: [PATCH 03/16] Add PHPStan to php-lint workflow --- .github/workflows/php-lint.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/php-lint.yml b/.github/workflows/php-lint.yml index d44dfb2e23..f022837ba7 100644 --- a/.github/workflows/php-lint.yml +++ b/.github/workflows/php-lint.yml @@ -56,3 +56,5 @@ jobs: run: composer install --no-interaction --no-progress - name: PHP Lint run: composer lint + - name: PHPStan + run: composer phpstan From 4be88c6a24caf1b3fc25cd0a9e263d78ce38d6d1 Mon Sep 17 00:00:00 2001 From: Weston Ruter Date: Mon, 15 May 2023 18:17:40 -0700 Subject: [PATCH 04/16] Add phpstan config --- .github/workflows/php-lint.yml | 1 + phpstan.neon.dist | 15 +++++++++++++++ 2 files changed, 16 insertions(+) create mode 100644 phpstan.neon.dist diff --git a/.github/workflows/php-lint.yml b/.github/workflows/php-lint.yml index f022837ba7..0bde377018 100644 --- a/.github/workflows/php-lint.yml +++ b/.github/workflows/php-lint.yml @@ -22,6 +22,7 @@ on: - '.github/workflows/php-lint.yml' - '**.php' - 'phpcs.xml.dist' + - 'phpstan.neon.dist' - 'composer.json' - 'composer.lock' types: diff --git a/phpstan.neon.dist b/phpstan.neon.dist new file mode 100644 index 0000000000..a25d2d4cf4 --- /dev/null +++ b/phpstan.neon.dist @@ -0,0 +1,15 @@ +includes: + - phar://phpstan.phar/conf/bleedingEdge.neon +parameters: + level: 0 + paths: + - admin/ + - default-enabled-modules.php + - load.php + - module-i18n.php + - modules/ + - server-timing/ + - tests/ + - uninstall.php + scanDirectories: + - vendor/wp-phpunit/wp-phpunit/ From 45b45731a6edb2061cc59af5736cfdd42e15515f Mon Sep 17 00:00:00 2001 From: Weston Ruter Date: Mon, 15 May 2023 18:18:32 -0700 Subject: [PATCH 05/16] Run composer update --- composer.lock | 159 +++++++++++++++++++++++++------------------------- 1 file changed, 80 insertions(+), 79 deletions(-) diff --git a/composer.lock b/composer.lock index e9ecfd31c7..b2c1a648f1 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": "f11a3661fdc88ae05a344d5e20725279", + "content-hash": "df9edcf2ad717e2fac05da825973a96d", "packages": [ { "name": "composer/installers", @@ -236,30 +236,30 @@ }, { "name": "doctrine/instantiator", - "version": "1.4.1", + "version": "1.5.0", "source": { "type": "git", "url": "https://github.com/doctrine/instantiator.git", - "reference": "10dcfce151b967d20fde1b34ae6640712c3891bc" + "reference": "0a0fa9780f5d4e507415a065172d26a98d02047b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/10dcfce151b967d20fde1b34ae6640712c3891bc", - "reference": "10dcfce151b967d20fde1b34ae6640712c3891bc", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/0a0fa9780f5d4e507415a065172d26a98d02047b", + "reference": "0a0fa9780f5d4e507415a065172d26a98d02047b", "shasum": "" }, "require": { "php": "^7.1 || ^8.0" }, "require-dev": { - "doctrine/coding-standard": "^9", + "doctrine/coding-standard": "^9 || ^11", "ext-pdo": "*", "ext-phar": "*", "phpbench/phpbench": "^0.16 || ^1", "phpstan/phpstan": "^1.4", "phpstan/phpstan-phpunit": "^1", "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", - "vimeo/psalm": "^4.22" + "vimeo/psalm": "^4.30 || ^5.4" }, "type": "library", "autoload": { @@ -286,7 +286,7 @@ ], "support": { "issues": "https://github.com/doctrine/instantiator/issues", - "source": "https://github.com/doctrine/instantiator/tree/1.4.1" + "source": "https://github.com/doctrine/instantiator/tree/1.5.0" }, "funding": [ { @@ -302,20 +302,20 @@ "type": "tidelift" } ], - "time": "2022-03-03T08:28:38+00:00" + "time": "2022-12-30T00:15:36+00:00" }, { "name": "myclabs/deep-copy", - "version": "1.11.0", + "version": "1.11.1", "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "14daed4296fae74d9e3201d2c4925d1acb7aa614" + "reference": "7284c22080590fb39f2ffa3e9057f10a4ddd0e0c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/14daed4296fae74d9e3201d2c4925d1acb7aa614", - "reference": "14daed4296fae74d9e3201d2c4925d1acb7aa614", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/7284c22080590fb39f2ffa3e9057f10a4ddd0e0c", + "reference": "7284c22080590fb39f2ffa3e9057f10a4ddd0e0c", "shasum": "" }, "require": { @@ -353,7 +353,7 @@ ], "support": { "issues": "https://github.com/myclabs/DeepCopy/issues", - "source": "https://github.com/myclabs/DeepCopy/tree/1.11.0" + "source": "https://github.com/myclabs/DeepCopy/tree/1.11.1" }, "funding": [ { @@ -361,20 +361,20 @@ "type": "tidelift" } ], - "time": "2022-03-03T13:19:32+00:00" + "time": "2023-03-08T13:26:56+00:00" }, { "name": "nikic/php-parser", - "version": "v4.15.2", + "version": "v4.15.4", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "f59bbe44bf7d96f24f3e2b4ddc21cd52c1d2adbc" + "reference": "6bb5176bc4af8bcb7d926f88718db9b96a2d4290" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/f59bbe44bf7d96f24f3e2b4ddc21cd52c1d2adbc", - "reference": "f59bbe44bf7d96f24f3e2b4ddc21cd52c1d2adbc", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/6bb5176bc4af8bcb7d926f88718db9b96a2d4290", + "reference": "6bb5176bc4af8bcb7d926f88718db9b96a2d4290", "shasum": "" }, "require": { @@ -415,9 +415,9 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v4.15.2" + "source": "https://github.com/nikic/PHP-Parser/tree/v4.15.4" }, - "time": "2022-11-12T15:38:23+00:00" + "time": "2023-03-05T19:49:14+00:00" }, { "name": "phar-io/manifest", @@ -749,23 +749,23 @@ }, { "name": "phpunit/php-code-coverage", - "version": "9.2.19", + "version": "9.2.26", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "c77b56b63e3d2031bd8997fcec43c1925ae46559" + "reference": "443bc6912c9bd5b409254a40f4b0f4ced7c80ea1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/c77b56b63e3d2031bd8997fcec43c1925ae46559", - "reference": "c77b56b63e3d2031bd8997fcec43c1925ae46559", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/443bc6912c9bd5b409254a40f4b0f4ced7c80ea1", + "reference": "443bc6912c9bd5b409254a40f4b0f4ced7c80ea1", "shasum": "" }, "require": { "ext-dom": "*", "ext-libxml": "*", "ext-xmlwriter": "*", - "nikic/php-parser": "^4.14", + "nikic/php-parser": "^4.15", "php": ">=7.3", "phpunit/php-file-iterator": "^3.0.3", "phpunit/php-text-template": "^2.0.2", @@ -780,8 +780,8 @@ "phpunit/phpunit": "^9.3" }, "suggest": { - "ext-pcov": "*", - "ext-xdebug": "*" + "ext-pcov": "PHP extension that provides line coverage", + "ext-xdebug": "PHP extension that provides line coverage as well as branch and path coverage" }, "type": "library", "extra": { @@ -814,7 +814,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.19" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.26" }, "funding": [ { @@ -822,7 +822,7 @@ "type": "github" } ], - "time": "2022-11-18T07:47:47+00:00" + "time": "2023-03-06T12:58:08+00:00" }, { "name": "phpunit/php-file-iterator", @@ -1067,20 +1067,20 @@ }, { "name": "phpunit/phpunit", - "version": "9.5.27", + "version": "9.6.8", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "a2bc7ffdca99f92d959b3f2270529334030bba38" + "reference": "17d621b3aff84d0c8b62539e269e87d8d5baa76e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/a2bc7ffdca99f92d959b3f2270529334030bba38", - "reference": "a2bc7ffdca99f92d959b3f2270529334030bba38", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/17d621b3aff84d0c8b62539e269e87d8d5baa76e", + "reference": "17d621b3aff84d0c8b62539e269e87d8d5baa76e", "shasum": "" }, "require": { - "doctrine/instantiator": "^1.3.1", + "doctrine/instantiator": "^1.3.1 || ^2", "ext-dom": "*", "ext-json": "*", "ext-libxml": "*", @@ -1109,8 +1109,8 @@ "sebastian/version": "^3.0.2" }, "suggest": { - "ext-soap": "*", - "ext-xdebug": "*" + "ext-soap": "To be able to generate mocks based on WSDL files", + "ext-xdebug": "PHP extension that provides line coverage as well as branch and path coverage" }, "bin": [ "phpunit" @@ -1118,7 +1118,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "9.5-dev" + "dev-master": "9.6-dev" } }, "autoload": { @@ -1149,7 +1149,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.27" + "security": "https://github.com/sebastianbergmann/phpunit/security/policy", + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.8" }, "funding": [ { @@ -1165,7 +1166,7 @@ "type": "tidelift" } ], - "time": "2022-12-09T07:31:23+00:00" + "time": "2023-05-11T05:14:45+00:00" }, { "name": "sebastian/cli-parser", @@ -1467,16 +1468,16 @@ }, { "name": "sebastian/diff", - "version": "4.0.4", + "version": "4.0.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "3461e3fccc7cfdfc2720be910d3bd73c69be590d" + "reference": "74be17022044ebaaecfdf0c5cd504fc9cd5a7131" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/3461e3fccc7cfdfc2720be910d3bd73c69be590d", - "reference": "3461e3fccc7cfdfc2720be910d3bd73c69be590d", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/74be17022044ebaaecfdf0c5cd504fc9cd5a7131", + "reference": "74be17022044ebaaecfdf0c5cd504fc9cd5a7131", "shasum": "" }, "require": { @@ -1521,7 +1522,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/diff/issues", - "source": "https://github.com/sebastianbergmann/diff/tree/4.0.4" + "source": "https://github.com/sebastianbergmann/diff/tree/4.0.5" }, "funding": [ { @@ -1529,20 +1530,20 @@ "type": "github" } ], - "time": "2020-10-26T13:10:38+00:00" + "time": "2023-05-07T05:35:17+00:00" }, { "name": "sebastian/environment", - "version": "5.1.4", + "version": "5.1.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "1b5dff7bb151a4db11d49d90e5408e4e938270f7" + "reference": "830c43a844f1f8d5b7a1f6d6076b784454d8b7ed" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/1b5dff7bb151a4db11d49d90e5408e4e938270f7", - "reference": "1b5dff7bb151a4db11d49d90e5408e4e938270f7", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/830c43a844f1f8d5b7a1f6d6076b784454d8b7ed", + "reference": "830c43a844f1f8d5b7a1f6d6076b784454d8b7ed", "shasum": "" }, "require": { @@ -1584,7 +1585,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/environment/issues", - "source": "https://github.com/sebastianbergmann/environment/tree/5.1.4" + "source": "https://github.com/sebastianbergmann/environment/tree/5.1.5" }, "funding": [ { @@ -1592,7 +1593,7 @@ "type": "github" } ], - "time": "2022-04-03T09:37:03+00:00" + "time": "2023-02-03T06:03:51+00:00" }, { "name": "sebastian/exporter", @@ -1906,16 +1907,16 @@ }, { "name": "sebastian/recursion-context", - "version": "4.0.4", + "version": "4.0.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "cd9d8cf3c5804de4341c283ed787f099f5506172" + "reference": "e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/cd9d8cf3c5804de4341c283ed787f099f5506172", - "reference": "cd9d8cf3c5804de4341c283ed787f099f5506172", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1", + "reference": "e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1", "shasum": "" }, "require": { @@ -1954,10 +1955,10 @@ } ], "description": "Provides functionality to recursively process PHP variables", - "homepage": "http://www.github.com/sebastianbergmann/recursion-context", + "homepage": "https://github.com/sebastianbergmann/recursion-context", "support": { "issues": "https://github.com/sebastianbergmann/recursion-context/issues", - "source": "https://github.com/sebastianbergmann/recursion-context/tree/4.0.4" + "source": "https://github.com/sebastianbergmann/recursion-context/tree/4.0.5" }, "funding": [ { @@ -1965,7 +1966,7 @@ "type": "github" } ], - "time": "2020-10-26T13:17:30+00:00" + "time": "2023-02-03T06:07:39+00:00" }, { "name": "sebastian/resource-operations", @@ -2024,16 +2025,16 @@ }, { "name": "sebastian/type", - "version": "3.2.0", + "version": "3.2.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/type.git", - "reference": "fb3fe09c5f0bae6bc27ef3ce933a1e0ed9464b6e" + "reference": "75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/fb3fe09c5f0bae6bc27ef3ce933a1e0ed9464b6e", - "reference": "fb3fe09c5f0bae6bc27ef3ce933a1e0ed9464b6e", + "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7", + "reference": "75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7", "shasum": "" }, "require": { @@ -2068,7 +2069,7 @@ "homepage": "https://github.com/sebastianbergmann/type", "support": { "issues": "https://github.com/sebastianbergmann/type/issues", - "source": "https://github.com/sebastianbergmann/type/tree/3.2.0" + "source": "https://github.com/sebastianbergmann/type/tree/3.2.1" }, "funding": [ { @@ -2076,7 +2077,7 @@ "type": "github" } ], - "time": "2022-09-12T14:47:03+00:00" + "time": "2023-02-03T06:13:03+00:00" }, { "name": "sebastian/version", @@ -2133,16 +2134,16 @@ }, { "name": "squizlabs/php_codesniffer", - "version": "3.7.1", + "version": "3.7.2", "source": { "type": "git", "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", - "reference": "1359e176e9307e906dc3d890bcc9603ff6d90619" + "reference": "ed8e00df0a83aa96acf703f8c2979ff33341f879" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/1359e176e9307e906dc3d890bcc9603ff6d90619", - "reference": "1359e176e9307e906dc3d890bcc9603ff6d90619", + "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/ed8e00df0a83aa96acf703f8c2979ff33341f879", + "reference": "ed8e00df0a83aa96acf703f8c2979ff33341f879", "shasum": "" }, "require": { @@ -2178,14 +2179,15 @@ "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": "2022-06-18T07:21:10+00:00" + "time": "2023-02-22T23:07:41+00:00" }, { "name": "symfony/polyfill-php73", @@ -2476,16 +2478,16 @@ }, { "name": "yoast/phpunit-polyfills", - "version": "1.0.4", + "version": "1.0.5", "source": { "type": "git", "url": "https://github.com/Yoast/PHPUnit-Polyfills.git", - "reference": "3c621ff5429d2b1ff96dc5808ad6cde99d31ea4c" + "reference": "3b59adeef77fb1c03ff5381dbb9d68b0aaff3171" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Yoast/PHPUnit-Polyfills/zipball/3c621ff5429d2b1ff96dc5808ad6cde99d31ea4c", - "reference": "3c621ff5429d2b1ff96dc5808ad6cde99d31ea4c", + "url": "https://api.github.com/repos/Yoast/PHPUnit-Polyfills/zipball/3b59adeef77fb1c03ff5381dbb9d68b0aaff3171", + "reference": "3b59adeef77fb1c03ff5381dbb9d68b0aaff3171", "shasum": "" }, "require": { @@ -2493,13 +2495,12 @@ "phpunit/phpunit": "^4.8.36 || ^5.7.21 || ^6.0 || ^7.0 || ^8.0 || ^9.0" }, "require-dev": { - "yoast/yoastcs": "^2.2.1" + "yoast/yoastcs": "^2.3.0" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "1.x-dev", - "dev-develop": "1.x-dev" + "dev-main": "2.x-dev" } }, "autoload": { @@ -2533,7 +2534,7 @@ "issues": "https://github.com/Yoast/PHPUnit-Polyfills/issues", "source": "https://github.com/Yoast/PHPUnit-Polyfills" }, - "time": "2022-11-16T09:07:52+00:00" + "time": "2023-03-30T23:39:05+00:00" } ], "aliases": [], From 216985b518a0bf77f08d1ee29eeb01ec267809d5 Mon Sep 17 00:00:00 2001 From: Weston Ruter Date: Mon, 15 May 2023 18:19:55 -0700 Subject: [PATCH 06/16] Add phpstan config to branches.paths in php-lint workflow --- .github/workflows/php-lint.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/php-lint.yml b/.github/workflows/php-lint.yml index 0bde377018..cd9ede11fe 100644 --- a/.github/workflows/php-lint.yml +++ b/.github/workflows/php-lint.yml @@ -10,6 +10,7 @@ on: - '.github/workflows/php-lint.yml' - '**.php' - 'phpcs.xml.dist' + - 'phpstan.neon.dist' - 'composer.json' - 'composer.lock' pull_request: From bcb496302f9ad614562ee7ce261b926785012397 Mon Sep 17 00:00:00 2001 From: Weston Ruter Date: Mon, 15 May 2023 19:32:46 -0700 Subject: [PATCH 07/16] Add phpstan/extension-installer to allow-plugins --- composer.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 6f312475db..c47fce67e9 100644 --- a/composer.json +++ b/composer.json @@ -37,7 +37,8 @@ "config": { "allow-plugins": { "dealerdirect/phpcodesniffer-composer-installer": true, - "composer/installers": true + "composer/installers": true, + "phpstan/extension-installer": true } }, "autoload-dev": { From 69630a0125a24609e8fb0f08c86f7bd9194300bb Mon Sep 17 00:00:00 2001 From: Weston Ruter Date: Mon, 15 May 2023 19:39:29 -0700 Subject: [PATCH 08/16] Add missing parameter in phpdocc for perflab_disable_object_cache_dropin filter --- load.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/load.php b/load.php index 4ce78d544a..17780fd231 100644 --- a/load.php +++ b/load.php @@ -338,7 +338,7 @@ function perflab_maybe_set_object_cache_dropin() { * * @since 2.0.0 * - * @param bool Whether the server timing drop-in should be set. + * @param bool $disabled Whether to disable the server timing drop-in. Default false. */ if ( apply_filters( 'perflab_disable_object_cache_dropin', false ) ) { return; From dd72fff1a8cbd946cbd510f8db497dd71b80df64 Mon Sep 17 00:00:00 2001 From: Weston Ruter Date: Mon, 15 May 2023 19:39:49 -0700 Subject: [PATCH 09/16] Fix composer script name in lint-staged --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 6b86776dd0..1dfeb13235 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,7 @@ "lint-staged": { "*.php": [ "composer run-script lint", - "composer run-script analyze" + "composer run-script phpstan" ] } } From 07c43e7cf1e1b8ebd94c0a465237afcd5b2687e6 Mon Sep 17 00:00:00 2001 From: Weston Ruter Date: Mon, 15 May 2023 19:41:05 -0700 Subject: [PATCH 10/16] Add missing return value null for void --- tests/admin/load-tests.php | 2 +- tests/modules/images/webp-uploads/helper-tests.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/admin/load-tests.php b/tests/admin/load-tests.php index 92ea3d3680..4330e0b91b 100644 --- a/tests/admin/load-tests.php +++ b/tests/admin/load-tests.php @@ -81,7 +81,7 @@ public function test_perflab_add_modules_page() { remove_all_filters( 'plugin_action_links_' . plugin_basename( PERFLAB_MAIN_FILE ) ); // Does not register the page if the perflab_active_modules filter is used. - add_filter( 'perflab_active_modules', function() {} ); + add_filter( 'perflab_active_modules', '__return_null' ); $hook_suffix = perflab_add_modules_page(); $this->assertFalse( $hook_suffix ); $this->assertFalse( isset( $_wp_submenu_nopriv['options-general.php'][ PERFLAB_MODULES_SCREEN ] ) ); diff --git a/tests/modules/images/webp-uploads/helper-tests.php b/tests/modules/images/webp-uploads/helper-tests.php index 08d50d6dd2..dc0f6ebc66 100644 --- a/tests/modules/images/webp-uploads/helper-tests.php +++ b/tests/modules/images/webp-uploads/helper-tests.php @@ -367,7 +367,7 @@ public function it_should_return_default_transforms_when_filter_returns_non_arra add_filter( 'webp_uploads_upload_image_mime_transforms', function () { - return; + return null; } ); From c0db0556862bbbe5ce03880f46aea0b9e3080b33 Mon Sep 17 00:00:00 2001 From: Weston Ruter Date: Mon, 15 May 2023 19:41:40 -0700 Subject: [PATCH 11/16] Add missing default value for message param in assertImageNotHasSource phpdoc --- tests/utils/TestCase/ImagesTestCase.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/utils/TestCase/ImagesTestCase.php b/tests/utils/TestCase/ImagesTestCase.php index 694d5d946e..3a84aa1551 100644 --- a/tests/utils/TestCase/ImagesTestCase.php +++ b/tests/utils/TestCase/ImagesTestCase.php @@ -11,7 +11,7 @@ * * @method void assertImageHasSource( int $attachment_id, string $mime_type, string $message = '' ) Asserts that the image has the appropriate source. * @method void assertImageHasSizeSource( int $attachment_id, string $size_name, string $mime_type, string $message = '' ) Asserts that the image has the appropriate source for the subsize. - * @method void assertImageNotHasSource( int $attachment_id, string $mime_type, string $message ) Asserts that the image doesn't have the appropriate source. + * @method void assertImageNotHasSource( int $attachment_id, string $mime_type, string $message = '' ) Asserts that the image doesn't have the appropriate source. * @method void assertImageNotHasSizeSource( int $attachment_id, string $size_name, string $mime_type, string $message = '' ) Asserts that the image doesn't have the appropriate source for the subsize. * @method void assertFileNameIsEdited( string $filename, string $message = '' ) Asserts that the provided file name was edited by WordPress contains an e{WITH_13_DIGITS} on the filename. * @method void assertFileNameIsNotEdited( string $filename, string $message = '' ) Asserts that the provided file name was edited by WordPress contains an e{WITH_13_DIGITS} on the filename. From 916dd25484ea42fe16356e80816e018fa1fad8ac Mon Sep 17 00:00:00 2001 From: Weston Ruter Date: Tue, 16 May 2023 09:37:41 -0700 Subject: [PATCH 12/16] Require phpstan/phpstan-phpunit --- composer.json | 3 ++- composer.lock | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 55 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index c47fce67e9..8308865f99 100644 --- a/composer.json +++ b/composer.json @@ -21,7 +21,8 @@ "szepeviktor/phpstan-wordpress": "^1.3.0", "wp-coding-standards/wpcs": "^2.2", "wp-phpunit/wp-phpunit": "^5.8", - "yoast/phpunit-polyfills": "^1.0" + "yoast/phpunit-polyfills": "^1.0", + "phpstan/phpstan-phpunit": "^1.3" }, "require": { "composer/installers": "~1.0", diff --git a/composer.lock b/composer.lock index b2c1a648f1..4a08935446 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": "df9edcf2ad717e2fac05da825973a96d", + "content-hash": "86d84869e4a387f8c1946ee268e9247b", "packages": [ { "name": "composer/installers", @@ -747,6 +747,58 @@ ], "time": "2023-05-09T15:28:01+00:00" }, + { + "name": "phpstan/phpstan-phpunit", + "version": "1.3.11", + "source": { + "type": "git", + "url": "https://github.com/phpstan/phpstan-phpunit.git", + "reference": "9e1b9de6d260461f6e99b6a8f2dbb0bbb98b579c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpstan/phpstan-phpunit/zipball/9e1b9de6d260461f6e99b6a8f2dbb0bbb98b579c", + "reference": "9e1b9de6d260461f6e99b6a8f2dbb0bbb98b579c", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0", + "phpstan/phpstan": "^1.10" + }, + "conflict": { + "phpunit/phpunit": "<7.0" + }, + "require-dev": { + "nikic/php-parser": "^4.13.0", + "php-parallel-lint/php-parallel-lint": "^1.2", + "phpstan/phpstan-strict-rules": "^1.0", + "phpunit/phpunit": "^9.5" + }, + "type": "phpstan-extension", + "extra": { + "phpstan": { + "includes": [ + "extension.neon", + "rules.neon" + ] + } + }, + "autoload": { + "psr-4": { + "PHPStan\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "PHPUnit extensions and rules for PHPStan", + "support": { + "issues": "https://github.com/phpstan/phpstan-phpunit/issues", + "source": "https://github.com/phpstan/phpstan-phpunit/tree/1.3.11" + }, + "time": "2023-03-25T19:42:13+00:00" + }, { "name": "phpunit/php-code-coverage", "version": "9.2.26", From 5e498d1b28b9f74ab25e9b8037032c67b85f64c5 Mon Sep 17 00:00:00 2001 From: Weston Ruter Date: Tue, 16 May 2023 09:43:00 -0700 Subject: [PATCH 13/16] Fix covers tags and a couple typos --- .../images/dominant-color-images/dominant-color-test.php | 6 +++--- tests/modules/images/webp-uploads/load-tests.php | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/modules/images/dominant-color-images/dominant-color-test.php b/tests/modules/images/dominant-color-images/dominant-color-test.php index d844aad542..1bf6c77cb4 100644 --- a/tests/modules/images/dominant-color-images/dominant-color-test.php +++ b/tests/modules/images/dominant-color-images/dominant-color-test.php @@ -48,10 +48,10 @@ public function test_dominant_color_get_dominant_color( $image_path, $expected_c * * @dataProvider provider_get_dominant_color * - * @covers ::has_transparency_metadata + * @covers ::dominant_color_metadata */ public function test_has_transparency_metadata( $image_path, $expected_color, $expected_transparency ) { - // Non existing attachment. + // Non-existing attachment. $transparency_metadata = dominant_color_metadata( array(), 1 ); $this->assertEmpty( $transparency_metadata ); @@ -209,7 +209,7 @@ public function data_provider_dominant_color_check_inline_style() { */ public function test_dominant_color_update_attachment_image_attributes( $style_attr, $expected ) { $attachment_id = self::factory()->attachment->create_upload_object( TESTS_PLUGIN_DIR . '/tests/testdata/modules/images/dominant-color-images/red.jpg' ); - + $attachment_image = wp_get_attachment_image( $attachment_id, 'full', '', array( "style" => $style_attr ) ); $this->assertStringContainsString( $expected, $attachment_image ); } diff --git a/tests/modules/images/webp-uploads/load-tests.php b/tests/modules/images/webp-uploads/load-tests.php index 4d021bcb4c..721671e94d 100644 --- a/tests/modules/images/webp-uploads/load-tests.php +++ b/tests/modules/images/webp-uploads/load-tests.php @@ -969,7 +969,7 @@ public function it_should_set_quality_with_image_conversion() { /** * Test webp_uploads_modify_webp_quality function for image quality. * - * @covers ::webp_uploads_modify_webp_quality() + * @covers ::webp_uploads_modify_webp_quality * * @test */ From 4554f6af2b7aa9343d57eb16b8e33fc214833a14 Mon Sep 17 00:00:00 2001 From: Weston Ruter Date: Tue, 16 May 2023 09:48:46 -0700 Subject: [PATCH 14/16] Require phpstan/phpstan-deprecation-rules --- composer.json | 3 ++- composer.lock | 50 +++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 51 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 8308865f99..60316dbc55 100644 --- a/composer.json +++ b/composer.json @@ -22,7 +22,8 @@ "wp-coding-standards/wpcs": "^2.2", "wp-phpunit/wp-phpunit": "^5.8", "yoast/phpunit-polyfills": "^1.0", - "phpstan/phpstan-phpunit": "^1.3" + "phpstan/phpstan-phpunit": "^1.3", + "phpstan/phpstan-deprecation-rules": "^1.1" }, "require": { "composer/installers": "~1.0", diff --git a/composer.lock b/composer.lock index 4a08935446..453e2d4e12 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": "86d84869e4a387f8c1946ee268e9247b", + "content-hash": "b6362dca3a69134531fc47af87788c39", "packages": [ { "name": "composer/installers", @@ -747,6 +747,54 @@ ], "time": "2023-05-09T15:28:01+00:00" }, + { + "name": "phpstan/phpstan-deprecation-rules", + "version": "1.1.3", + "source": { + "type": "git", + "url": "https://github.com/phpstan/phpstan-deprecation-rules.git", + "reference": "a22b36b955a2e9a3d39fe533b6c1bb5359f9c319" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpstan/phpstan-deprecation-rules/zipball/a22b36b955a2e9a3d39fe533b6c1bb5359f9c319", + "reference": "a22b36b955a2e9a3d39fe533b6c1bb5359f9c319", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0", + "phpstan/phpstan": "^1.10" + }, + "require-dev": { + "php-parallel-lint/php-parallel-lint": "^1.2", + "phpstan/phpstan-php-parser": "^1.1", + "phpstan/phpstan-phpunit": "^1.0", + "phpunit/phpunit": "^9.5" + }, + "type": "phpstan-extension", + "extra": { + "phpstan": { + "includes": [ + "rules.neon" + ] + } + }, + "autoload": { + "psr-4": { + "PHPStan\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "PHPStan rules for detecting usage of deprecated classes, methods, properties, constants and traits.", + "support": { + "issues": "https://github.com/phpstan/phpstan-deprecation-rules/issues", + "source": "https://github.com/phpstan/phpstan-deprecation-rules/tree/1.1.3" + }, + "time": "2023-03-17T07:50:08+00:00" + }, { "name": "phpstan/phpstan-phpunit", "version": "1.3.11", From bd1c3783570b23fd3213d25b189415bd7ac3936c Mon Sep 17 00:00:00 2001 From: Weston Ruter Date: Tue, 16 May 2023 10:10:03 -0700 Subject: [PATCH 15/16] Replace deprecated RegExp assertions --- tests/utils/TestCase/ImagesTestCase.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/utils/TestCase/ImagesTestCase.php b/tests/utils/TestCase/ImagesTestCase.php index 3a84aa1551..a9004e34f1 100644 --- a/tests/utils/TestCase/ImagesTestCase.php +++ b/tests/utils/TestCase/ImagesTestCase.php @@ -86,7 +86,7 @@ public static function assertImageNotHasSizeSource( $attachment_id, $size_name, * @param string $message The Error message used to display when the assertion fails. */ public static function assertFileNameIsEdited( $filename, $message = '' ) { - self::assertRegExp( '/e\d{13}/', $filename, $message ); + self::assertMatchesRegularExpression( '/e\d{13}/', $filename, $message ); } /** @@ -96,7 +96,7 @@ public static function assertFileNameIsEdited( $filename, $message = '' ) { * @param string $message The Error message used to display when the assertion fails. */ public static function assertFileNameIsNotEdited( $filename, $message = '' ) { - self::assertNotRegExp( '/e\d{13}/', $filename, $message ); + self::assertDoesNotMatchRegularExpression( '/e\d{13}/', $filename, $message ); } /** @@ -107,7 +107,7 @@ public static function assertFileNameIsNotEdited( $filename, $message = '' ) { * @param string $message The Error message used to display when the assertion fails. */ public static function assertSizeNameIsHashed( $size_name, $hashed_size_name, $message = '' ) { - self::assertRegExp( "/{$size_name}-\d{13}/", $hashed_size_name, $message ); + self::assertMatchesRegularExpression( "/{$size_name}-\d{13}/", $hashed_size_name, $message ); } /** From 93ec3dce1038874f539ff6e0f15c636304ebb3d2 Mon Sep 17 00:00:00 2001 From: Ari Stathopoulos Date: Wed, 17 May 2023 10:16:19 -0700 Subject: [PATCH 16/16] Reuse __return_null --- tests/modules/images/webp-uploads/helper-tests.php | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/tests/modules/images/webp-uploads/helper-tests.php b/tests/modules/images/webp-uploads/helper-tests.php index dc0f6ebc66..6a1f963740 100644 --- a/tests/modules/images/webp-uploads/helper-tests.php +++ b/tests/modules/images/webp-uploads/helper-tests.php @@ -364,12 +364,7 @@ public function it_should_return_empty_array_when_filter_returns_empty_array() { * @test */ public function it_should_return_default_transforms_when_filter_returns_non_array_type() { - add_filter( - 'webp_uploads_upload_image_mime_transforms', - function () { - return null; - } - ); + add_filter( 'webp_uploads_upload_image_mime_transforms', '__return_null' ); $default_transforms = array( 'image/jpeg' => array( 'image/webp' ),