From 6c39d7637fff8901c5fc5d1f5f07976dd5797216 Mon Sep 17 00:00:00 2001 From: Pascal Birchler Date: Tue, 25 Feb 2025 12:36:18 +0100 Subject: [PATCH 01/30] Prefix dependencies with PHP-Scoper --- .distignore | 2 + .gitignore | 4 + composer.json | 31 +- composer.lock | 355 ++++++++++++------ .../Checks/Abstract_PHP_CodeSniffer_Check.php | 6 +- .../Checks/Plugin_Repo/Trademarks_Check.php | 5 +- includes/Plugin_Context.php | 5 +- phpcs.xml.dist | 2 + phpstan.neon.dist | 3 + plugin.php | 9 +- scoper.inc.php | 71 ++++ tests/phpstan/stubs/readme-parser.php | 110 ++++++ 12 files changed, 466 insertions(+), 137 deletions(-) create mode 100644 scoper.inc.php create mode 100644 tests/phpstan/stubs/readme-parser.php diff --git a/.distignore b/.distignore index 7211cedad..4aed993e5 100644 --- a/.distignore +++ b/.distignore @@ -9,6 +9,7 @@ patches # Distributed via vendor/plugin-check/phpcs-sniffs instead /phpcs-sniffs/ tests +/vendor *.DS_Store .DS_Store @@ -40,3 +41,4 @@ phpunit.xml.dist plugin-check.iml README.md SECURITY.md +scoper.inc.php diff --git a/.gitignore b/.gitignore index 160702ca8..2a8c55218 100644 --- a/.gitignore +++ b/.gitignore @@ -29,6 +29,10 @@ build node_modules/ /vendor/ +/vendor-bin/ +/vendor-prefixed/ +/includes/vendor/ +/includes/composer.json ############ ## OSes diff --git a/composer.json b/composer.json index 860babec6..746e57da9 100644 --- a/composer.json +++ b/composer.json @@ -27,7 +27,9 @@ "wp-cli/i18n-command": "^2.6", "wp-cli/entity-command": "^2.8", "wp-phpunit/wp-phpunit": "^6.3", - "yoast/phpunit-polyfills": "^1.0" + "yoast/phpunit-polyfills": "^1.0", + "bamarni/composer-bin-plugin": "^1.8", + "sniccowp/php-scoper-wordpress-excludes": "^6.7" }, "repositories": [ { @@ -55,12 +57,20 @@ "composer/installers": true, "cweagans/composer-patches": false, "dealerdirect/phpcodesniffer-composer-installer": true, - "phpstan/extension-installer": true + "phpstan/extension-installer": true, + "bamarni/composer-bin-plugin": true }, "platform": { "php": "7.4" } }, + "extra": { + "bamarni-bin": { + "bin-links": false, + "target-directory": "vendor-bin", + "forward-command": true + } + }, "scripts": { "behat": "BEHAT_FEATURES_FOLDER=tests/behat/features run-behat-tests", "behat-rerun": "BEHAT_FEATURES_FOLDER=tests/behat/features rerun-behat-tests", @@ -69,7 +79,22 @@ "phpmd": "phpmd . text phpmd.xml", "phpstan": "phpstan analyse --memory-limit=2048M", "prepare-behat-tests": "install-package-tests", - "test": "phpunit" + "test": "phpunit", + "post-install-cmd": [ + "@prefix-dependencies" + ], + "post-update-cmd": [ + "@prefix-dependencies" + ], + "prefix-dependencies": [ + "vendor-bin/php-scoper/vendor/bin/php-scoper add-prefix --output-dir=./vendor-prefixed --force --quiet", + "echo '{ \"autoload\": { \"classmap\": [\"\"] } }' > ./vendor-prefixed/composer.json", + "@composer dump-autoload --working-dir ./vendor-prefixed --no-dev --classmap-authoritative", + "sed -i'.bak' -e 's/Composer\\\\Autoload/Plugin_Check_Composer\\\\Autoload/' vendor-prefixed/vendor/composer/*.php && rm -rf vendor-prefixed/vendor/composer/*.php.bak", + "echo '{ \"autoload\": { \"classmap\": [\"\"] } }' > ./includes/composer.json", + "@composer dump-autoload --working-dir ./includes --no-dev --classmap-authoritative", + "sed -i'.bak' -e 's/Composer\\\\Autoload/Plugin_Check_Composer\\\\Autoload/' includes/vendor/composer/*.php && rm -rf includes/vendor/composer/*.php.bak" + ] }, "scripts-descriptions": { "behat": "Run functional tests", diff --git a/composer.lock b/composer.lock index cf82a5a99..ab5add865 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": "6a528fe45d6befae68c21eb4b9e43f15", + "content-hash": "b9200ade0e6add63f035c11948d08e44", "packages": [ { "name": "afragen/wordpress-plugin-readme-parser", @@ -51,7 +51,7 @@ "issues": "https://github.com/afragen/wordpress-plugin-readme-parser/issues", "source": "https://github.com/afragen/wordpress-plugin-readme-parser/tree/master" }, - "time": "2024-04-30T13:39:49+00:00" + "time": "2024-12-10T23:43:17+00:00" }, { "name": "automattic/vipwpcs", @@ -549,7 +549,7 @@ }, { "name": "plugin-check/phpcs-sniffs", - "version": "dev-fix/phpunit", + "version": "dev-fix/328-php-scoper", "dist": { "type": "path", "url": "./phpcs-sniffs", @@ -616,16 +616,16 @@ }, { "name": "sirbrillig/phpcs-variable-analysis", - "version": "v2.11.21", + "version": "v2.11.22", "source": { "type": "git", "url": "https://github.com/sirbrillig/phpcs-variable-analysis.git", - "reference": "eb2b351927098c24860daa7484e290d3eed693be" + "reference": "ffb6f16c6033ec61ed84446b479a31d6529f0eb7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sirbrillig/phpcs-variable-analysis/zipball/eb2b351927098c24860daa7484e290d3eed693be", - "reference": "eb2b351927098c24860daa7484e290d3eed693be", + "url": "https://api.github.com/repos/sirbrillig/phpcs-variable-analysis/zipball/ffb6f16c6033ec61ed84446b479a31d6529f0eb7", + "reference": "ffb6f16c6033ec61ed84446b479a31d6529f0eb7", "shasum": "" }, "require": { @@ -637,7 +637,6 @@ "phpcsstandards/phpcsdevcs": "^1.1", "phpstan/phpstan": "^1.7", "phpunit/phpunit": "^4.8.36 || ^5.7.21 || ^6.5 || ^7.0 || ^8.0 || ^9.0 || ^10.5.32 || ^11.3.3", - "sirbrillig/phpcs-import-detection": "^1.1", "vimeo/psalm": "^0.2 || ^0.3 || ^1.1 || ^4.24 || ^5.0" }, "type": "phpcodesniffer-standard", @@ -670,20 +669,20 @@ "source": "https://github.com/sirbrillig/phpcs-variable-analysis", "wiki": "https://github.com/sirbrillig/phpcs-variable-analysis/wiki" }, - "time": "2024-12-02T16:37:49+00:00" + "time": "2025-01-06T17:54:24+00:00" }, { "name": "squizlabs/php_codesniffer", - "version": "3.11.1", + "version": "3.11.3", "source": { "type": "git", "url": "https://github.com/PHPCSStandards/PHP_CodeSniffer.git", - "reference": "19473c30efe4f7b3cd42522d0b2e6e7f243c6f87" + "reference": "ba05f990e79cbe69b9f35c8c1ac8dca7eecc3a10" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/19473c30efe4f7b3cd42522d0b2e6e7f243c6f87", - "reference": "19473c30efe4f7b3cd42522d0b2e6e7f243c6f87", + "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/ba05f990e79cbe69b9f35c8c1ac8dca7eecc3a10", + "reference": "ba05f990e79cbe69b9f35c8c1ac8dca7eecc3a10", "shasum": "" }, "require": { @@ -748,9 +747,13 @@ { "url": "https://opencollective.com/php_codesniffer", "type": "open_collective" + }, + { + "url": "https://thanks.dev/phpcsstandards", + "type": "thanks_dev" } ], - "time": "2024-11-16T12:02:36+00:00" + "time": "2025-01-23T17:04:15+00:00" }, { "name": "wp-coding-standards/wpcs", @@ -820,6 +823,63 @@ } ], "packages-dev": [ + { + "name": "bamarni/composer-bin-plugin", + "version": "1.8.2", + "source": { + "type": "git", + "url": "https://github.com/bamarni/composer-bin-plugin.git", + "reference": "92fd7b1e6e9cdae19b0d57369d8ad31a37b6a880" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/bamarni/composer-bin-plugin/zipball/92fd7b1e6e9cdae19b0d57369d8ad31a37b6a880", + "reference": "92fd7b1e6e9cdae19b0d57369d8ad31a37b6a880", + "shasum": "" + }, + "require": { + "composer-plugin-api": "^2.0", + "php": "^7.2.5 || ^8.0" + }, + "require-dev": { + "composer/composer": "^2.0", + "ext-json": "*", + "phpstan/extension-installer": "^1.1", + "phpstan/phpstan": "^1.8", + "phpstan/phpstan-phpunit": "^1.1", + "phpunit/phpunit": "^8.5 || ^9.5", + "symfony/console": "^2.8.52 || ^3.4.35 || ^4.4 || ^5.0 || ^6.0", + "symfony/finder": "^2.8.52 || ^3.4.35 || ^4.4 || ^5.0 || ^6.0", + "symfony/process": "^2.8.52 || ^3.4.35 || ^4.4 || ^5.0 || ^6.0" + }, + "type": "composer-plugin", + "extra": { + "class": "Bamarni\\Composer\\Bin\\BamarniBinPlugin" + }, + "autoload": { + "psr-4": { + "Bamarni\\Composer\\Bin\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "No conflicts for your bin dependencies", + "keywords": [ + "composer", + "conflict", + "dependency", + "executable", + "isolation", + "tool" + ], + "support": { + "issues": "https://github.com/bamarni/composer-bin-plugin/issues", + "source": "https://github.com/bamarni/composer-bin-plugin/tree/1.8.2" + }, + "time": "2022-10-31T08:38:03+00:00" + }, { "name": "behat/behat", "version": "v3.15.0", @@ -1045,13 +1105,13 @@ }, "type": "library", "extra": { - "branch-alias": { - "dev-main": "3.x-dev" - }, "phpstan": { "includes": [ "extension.neon" ] + }, + "branch-alias": { + "dev-main": "3.x-dev" } }, "autoload": { @@ -1628,16 +1688,16 @@ }, { "name": "myclabs/deep-copy", - "version": "1.12.1", + "version": "1.13.0", "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "123267b2c49fbf30d78a7b2d333f6be754b94845" + "reference": "024473a478be9df5fdaca2c793f2232fe788e414" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/123267b2c49fbf30d78a7b2d333f6be754b94845", - "reference": "123267b2c49fbf30d78a7b2d333f6be754b94845", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/024473a478be9df5fdaca2c793f2232fe788e414", + "reference": "024473a478be9df5fdaca2c793f2232fe788e414", "shasum": "" }, "require": { @@ -1676,7 +1736,7 @@ ], "support": { "issues": "https://github.com/myclabs/DeepCopy/issues", - "source": "https://github.com/myclabs/DeepCopy/tree/1.12.1" + "source": "https://github.com/myclabs/DeepCopy/tree/1.13.0" }, "funding": [ { @@ -1684,20 +1744,20 @@ "type": "tidelift" } ], - "time": "2024-11-08T17:47:46+00:00" + "time": "2025-02-12T12:17:51+00:00" }, { "name": "nikic/php-parser", - "version": "v5.3.1", + "version": "v5.4.0", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "8eea230464783aa9671db8eea6f8c6ac5285794b" + "reference": "447a020a1f875a434d62f2a401f53b82a396e494" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/8eea230464783aa9671db8eea6f8c6ac5285794b", - "reference": "8eea230464783aa9671db8eea6f8c6ac5285794b", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/447a020a1f875a434d62f2a401f53b82a396e494", + "reference": "447a020a1f875a434d62f2a401f53b82a396e494", "shasum": "" }, "require": { @@ -1740,9 +1800,9 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v5.3.1" + "source": "https://github.com/nikic/PHP-Parser/tree/v5.4.0" }, - "time": "2024-10-08T18:51:32+00:00" + "time": "2024-12-30T11:07:19+00:00" }, { "name": "pdepend/pdepend", @@ -2089,16 +2149,16 @@ }, { "name": "php-stubs/wordpress-stubs", - "version": "v6.7.1", + "version": "v6.7.2", "source": { "type": "git", "url": "https://github.com/php-stubs/wordpress-stubs.git", - "reference": "83448e918bf06d1ed3d67ceb6a985fc266a02fd1" + "reference": "c04f96cb232fab12a3cbcccf5a47767f0665c3f4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-stubs/wordpress-stubs/zipball/83448e918bf06d1ed3d67ceb6a985fc266a02fd1", - "reference": "83448e918bf06d1ed3d67ceb6a985fc266a02fd1", + "url": "https://api.github.com/repos/php-stubs/wordpress-stubs/zipball/c04f96cb232fab12a3cbcccf5a47767f0665c3f4", + "reference": "c04f96cb232fab12a3cbcccf5a47767f0665c3f4", "shasum": "" }, "require-dev": { @@ -2131,9 +2191,9 @@ ], "support": { "issues": "https://github.com/php-stubs/wordpress-stubs/issues", - "source": "https://github.com/php-stubs/wordpress-stubs/tree/v6.7.1" + "source": "https://github.com/php-stubs/wordpress-stubs/tree/v6.7.2" }, - "time": "2024-11-24T03:57:09+00:00" + "time": "2025-02-12T04:51:58+00:00" }, { "name": "phpcompatibility/php-compatibility", @@ -2330,30 +2390,30 @@ }, { "name": "phpstan/phpdoc-parser", - "version": "1.33.0", + "version": "2.1.0", "source": { "type": "git", "url": "https://github.com/phpstan/phpdoc-parser.git", - "reference": "82a311fd3690fb2bf7b64d5c98f912b3dd746140" + "reference": "9b30d6fd026b2c132b3985ce6b23bec09ab3aa68" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/82a311fd3690fb2bf7b64d5c98f912b3dd746140", - "reference": "82a311fd3690fb2bf7b64d5c98f912b3dd746140", + "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/9b30d6fd026b2c132b3985ce6b23bec09ab3aa68", + "reference": "9b30d6fd026b2c132b3985ce6b23bec09ab3aa68", "shasum": "" }, "require": { - "php": "^7.2 || ^8.0" + "php": "^7.4 || ^8.0" }, "require-dev": { "doctrine/annotations": "^2.0", - "nikic/php-parser": "^4.15", + "nikic/php-parser": "^5.3.0", "php-parallel-lint/php-parallel-lint": "^1.2", "phpstan/extension-installer": "^1.0", - "phpstan/phpstan": "^1.5", - "phpstan/phpstan-phpunit": "^1.1", - "phpstan/phpstan-strict-rules": "^1.0", - "phpunit/phpunit": "^9.5", + "phpstan/phpstan": "^2.0", + "phpstan/phpstan-phpunit": "^2.0", + "phpstan/phpstan-strict-rules": "^2.0", + "phpunit/phpunit": "^9.6", "symfony/process": "^5.2" }, "type": "library", @@ -2371,22 +2431,22 @@ "description": "PHPDoc parser with support for nullable, intersection and generic types", "support": { "issues": "https://github.com/phpstan/phpdoc-parser/issues", - "source": "https://github.com/phpstan/phpdoc-parser/tree/1.33.0" + "source": "https://github.com/phpstan/phpdoc-parser/tree/2.1.0" }, - "time": "2024-10-13T11:25:22+00:00" + "time": "2025-02-19T13:28:12+00:00" }, { "name": "phpstan/phpstan", - "version": "1.12.12", + "version": "1.12.19", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "b5ae1b88f471d3fd4ba1aa0046234b5ca3776dd0" + "reference": "c42ba9bab7a940ed00092ecb1c77bad98896d789" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/b5ae1b88f471d3fd4ba1aa0046234b5ca3776dd0", - "reference": "b5ae1b88f471d3fd4ba1aa0046234b5ca3776dd0", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/c42ba9bab7a940ed00092ecb1c77bad98896d789", + "reference": "c42ba9bab7a940ed00092ecb1c77bad98896d789", "shasum": "" }, "require": { @@ -2431,7 +2491,7 @@ "type": "github" } ], - "time": "2024-11-28T22:13:23+00:00" + "time": "2025-02-19T15:42:21+00:00" }, { "name": "phpunit/php-code-coverage", @@ -3968,32 +4028,32 @@ }, { "name": "slevomat/coding-standard", - "version": "8.15.0", + "version": "8.16.0", "source": { "type": "git", "url": "https://github.com/slevomat/coding-standard.git", - "reference": "7d1d957421618a3803b593ec31ace470177d7817" + "reference": "7748a4282df19daf966fda1d8c60a8aec803c83a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/slevomat/coding-standard/zipball/7d1d957421618a3803b593ec31ace470177d7817", - "reference": "7d1d957421618a3803b593ec31ace470177d7817", + "url": "https://api.github.com/repos/slevomat/coding-standard/zipball/7748a4282df19daf966fda1d8c60a8aec803c83a", + "reference": "7748a4282df19daf966fda1d8c60a8aec803c83a", "shasum": "" }, "require": { "dealerdirect/phpcodesniffer-composer-installer": "^0.6.2 || ^0.7 || ^1.0", - "php": "^7.2 || ^8.0", - "phpstan/phpdoc-parser": "^1.23.1", - "squizlabs/php_codesniffer": "^3.9.0" + "php": "^7.4 || ^8.0", + "phpstan/phpdoc-parser": "^2.1.0", + "squizlabs/php_codesniffer": "^3.11.3" }, "require-dev": { - "phing/phing": "2.17.4", - "php-parallel-lint/php-parallel-lint": "1.3.2", - "phpstan/phpstan": "1.10.60", - "phpstan/phpstan-deprecation-rules": "1.1.4", - "phpstan/phpstan-phpunit": "1.3.16", - "phpstan/phpstan-strict-rules": "1.5.2", - "phpunit/phpunit": "8.5.21|9.6.8|10.5.11" + "phing/phing": "3.0.1", + "php-parallel-lint/php-parallel-lint": "1.4.0", + "phpstan/phpstan": "2.1.6", + "phpstan/phpstan-deprecation-rules": "2.0.1", + "phpstan/phpstan-phpunit": "2.0.4", + "phpstan/phpstan-strict-rules": "2.0.3", + "phpunit/phpunit": "9.6.8|10.5.45|11.4.4|11.5.9|12.0.4" }, "type": "phpcodesniffer-standard", "extra": { @@ -4017,7 +4077,7 @@ ], "support": { "issues": "https://github.com/slevomat/coding-standard/issues", - "source": "https://github.com/slevomat/coding-standard/tree/8.15.0" + "source": "https://github.com/slevomat/coding-standard/tree/8.16.0" }, "funding": [ { @@ -4029,7 +4089,54 @@ "type": "tidelift" } ], - "time": "2024-03-09T15:20:58+00:00" + "time": "2025-02-23T18:12:49+00:00" + }, + { + "name": "sniccowp/php-scoper-wordpress-excludes", + "version": "6.7.1", + "source": { + "type": "git", + "url": "https://github.com/snicco/php-scoper-wordpress-excludes.git", + "reference": "d8e6b5fdc9e42300a8ab18b44b775836a7b52363" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/snicco/php-scoper-wordpress-excludes/zipball/d8e6b5fdc9e42300a8ab18b44b775836a7b52363", + "reference": "d8e6b5fdc9e42300a8ab18b44b775836a7b52363", + "shasum": "" + }, + "require-dev": { + "php": "^7.4", + "php-stubs/wordpress-globals": "0.2.0", + "php-stubs/wordpress-stubs": "6.7.1", + "sniccowp/php-scoper-excludes": "dev-master" + }, + "type": "library", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Calvin Alkan", + "email": "calvin@snicco.de" + }, + { + "name": "Marlon Alkan", + "email": "marlon@snicco.de" + } + ], + "description": "A list of all WordPress core classes, functions and constants. Meant to be used with the PHP-Scoper exclusion functionality.", + "keywords": [ + "php-scoper", + "scoping WordPress", + "wordpress" + ], + "support": { + "issues": "https://github.com/snicco/php-scoper-wordpress-excludes/issues", + "source": "https://github.com/snicco/php-scoper-wordpress-excludes/tree/6.7.1" + }, + "time": "2024-11-25T00:31:50+00:00" }, { "name": "symfony/config", @@ -4317,12 +4424,12 @@ }, "type": "library", "extra": { + "thanks": { + "url": "https://github.com/symfony/contracts", + "name": "symfony/contracts" + }, "branch-alias": { "dev-main": "2.5-dev" - }, - "thanks": { - "name": "symfony/contracts", - "url": "https://github.com/symfony/contracts" } }, "autoload": { @@ -4473,12 +4580,12 @@ }, "type": "library", "extra": { + "thanks": { + "url": "https://github.com/symfony/contracts", + "name": "symfony/contracts" + }, "branch-alias": { "dev-main": "2.5-dev" - }, - "thanks": { - "name": "symfony/contracts", - "url": "https://github.com/symfony/contracts" } }, "autoload": { @@ -4923,8 +5030,8 @@ "type": "library", "extra": { "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" } }, "autoload": { @@ -5236,12 +5343,12 @@ }, "type": "library", "extra": { + "thanks": { + "url": "https://github.com/symfony/contracts", + "name": "symfony/contracts" + }, "branch-alias": { "dev-main": "2.5-dev" - }, - "thanks": { - "name": "symfony/contracts", - "url": "https://github.com/symfony/contracts" } }, "autoload": { @@ -5497,12 +5604,12 @@ }, "type": "library", "extra": { + "thanks": { + "url": "https://github.com/symfony/contracts", + "name": "symfony/contracts" + }, "branch-alias": { "dev-main": "2.5-dev" - }, - "thanks": { - "name": "symfony/contracts", - "url": "https://github.com/symfony/contracts" } }, "autoload": { @@ -5765,9 +5872,6 @@ }, "type": "wp-cli-package", "extra": { - "branch-alias": { - "dev-main": "2.x-dev" - }, "bundled": true, "commands": [ "config", @@ -5781,7 +5885,10 @@ "config path", "config set", "config shuffle-salts" - ] + ], + "branch-alias": { + "dev-main": "2.x-dev" + } }, "autoload": { "files": [ @@ -5842,9 +5949,6 @@ }, "type": "wp-cli-package", "extra": { - "branch-alias": { - "dev-main": "2.x-dev" - }, "bundled": true, "commands": [ "core", @@ -5857,7 +5961,10 @@ "core update", "core update-db", "core version" - ] + ], + "branch-alias": { + "dev-main": "2.x-dev" + } }, "autoload": { "files": [ @@ -5913,9 +6020,6 @@ }, "type": "wp-cli-package", "extra": { - "branch-alias": { - "dev-main": "2.x-dev" - }, "bundled": true, "commands": [ "comment", @@ -6094,7 +6198,10 @@ "user term set", "user unspam", "user update" - ] + ], + "branch-alias": { + "dev-main": "2.x-dev" + } }, "autoload": { "files": [ @@ -6145,14 +6252,14 @@ }, "type": "wp-cli-package", "extra": { - "branch-alias": { - "dev-main": "2.x-dev" - }, "bundled": true, "commands": [ "eval", "eval-file" - ] + ], + "branch-alias": { + "dev-main": "2.x-dev" + } }, "autoload": { "files": [ @@ -6208,9 +6315,6 @@ }, "type": "wp-cli-package", "extra": { - "branch-alias": { - "dev-main": "2.x-dev" - }, "bundled": true, "commands": [ "plugin", @@ -6245,7 +6349,10 @@ "theme status", "theme update", "theme mod list" - ] + ], + "branch-alias": { + "dev-main": "2.x-dev" + } }, "autoload": { "files": [ @@ -6373,9 +6480,6 @@ }, "type": "wp-cli-package", "extra": { - "branch-alias": { - "dev-main": "2.x-dev" - }, "bundled": true, "commands": [ "language", @@ -6399,7 +6503,10 @@ "language theme uninstall", "language theme update", "site switch-language" - ] + ], + "branch-alias": { + "dev-main": "2.x-dev" + } }, "autoload": { "files": [ @@ -6654,19 +6761,19 @@ ], "type": "phpcodesniffer-standard", "extra": { - "branch-alias": { - "dev-main": "4.0.x-dev" - }, "readme": { + "using": { + "body": ".readme-partials/USING.md" + }, "sections": [ "Using", "Contributing", "Support" ], - "using": { - "body": ".readme-partials/USING.md" - }, "show_powered_by": false + }, + "branch-alias": { + "dev-main": "4.0.x-dev" } }, "autoload": { @@ -6790,16 +6897,16 @@ }, { "name": "yoast/phpunit-polyfills", - "version": "1.1.2", + "version": "1.1.4", "source": { "type": "git", "url": "https://github.com/Yoast/PHPUnit-Polyfills.git", - "reference": "e9c8413de4c8ae03d2923a44f17d0d7dad1b96be" + "reference": "e6faedf5e34cea4438e341f660e2f719760c531d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Yoast/PHPUnit-Polyfills/zipball/e9c8413de4c8ae03d2923a44f17d0d7dad1b96be", - "reference": "e9c8413de4c8ae03d2923a44f17d0d7dad1b96be", + "url": "https://api.github.com/repos/Yoast/PHPUnit-Polyfills/zipball/e6faedf5e34cea4438e341f660e2f719760c531d", + "reference": "e6faedf5e34cea4438e341f660e2f719760c531d", "shasum": "" }, "require": { @@ -6814,7 +6921,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "3.x-dev" + "dev-main": "4.x-dev" } }, "autoload": { @@ -6849,7 +6956,7 @@ "security": "https://github.com/Yoast/PHPUnit-Polyfills/security/policy", "source": "https://github.com/Yoast/PHPUnit-Polyfills" }, - "time": "2024-09-06T22:03:10+00:00" + "time": "2025-02-09T18:13:44+00:00" } ], "aliases": [], @@ -6864,9 +6971,9 @@ "php": ">=7.4", "ext-json": "*" }, - "platform-dev": [], + "platform-dev": {}, "platform-overrides": { "php": "7.4" }, - "plugin-api-version": "2.3.0" + "plugin-api-version": "2.6.0" } diff --git a/includes/Checker/Checks/Abstract_PHP_CodeSniffer_Check.php b/includes/Checker/Checks/Abstract_PHP_CodeSniffer_Check.php index 422eb1bb6..aedd7d93b 100644 --- a/includes/Checker/Checks/Abstract_PHP_CodeSniffer_Check.php +++ b/includes/Checker/Checks/Abstract_PHP_CodeSniffer_Check.php @@ -8,12 +8,12 @@ namespace WordPress\Plugin_Check\Checker\Checks; use Exception; -use PHP_CodeSniffer\Config; -use PHP_CodeSniffer\Runner; use WordPress\Plugin_Check\Checker\Check_Result; use WordPress\Plugin_Check\Checker\Static_Check; use WordPress\Plugin_Check\Traits\Amend_Check_Result; use WordPress\Plugin_Check\Utilities\Plugin_Request_Utility; +use WordPress\Plugin_Check\Vendor\PHP_CodeSniffer\Config; +use WordPress\Plugin_Check\Vendor\PHP_CodeSniffer\Runner; /** * Check for running one or more PHP CodeSniffer sniffs. @@ -69,7 +69,7 @@ abstract protected function get_args( Check_Result $result ); */ final public function run( Check_Result $result ) { // Include the PHPCS autoloader. - $autoloader = WP_PLUGIN_CHECK_PLUGIN_DIR_PATH . 'vendor/squizlabs/php_codesniffer/autoload.php'; + $autoloader = WP_PLUGIN_CHECK_PLUGIN_DIR_PATH . 'vendor_prefixed/squizlabs/php_codesniffer/autoload.php'; if ( file_exists( $autoloader ) ) { include_once $autoloader; diff --git a/includes/Checker/Checks/Plugin_Repo/Trademarks_Check.php b/includes/Checker/Checks/Plugin_Repo/Trademarks_Check.php index cf181fa03..8082a6b07 100644 --- a/includes/Checker/Checks/Plugin_Repo/Trademarks_Check.php +++ b/includes/Checker/Checks/Plugin_Repo/Trademarks_Check.php @@ -14,7 +14,8 @@ use WordPress\Plugin_Check\Traits\Amend_Check_Result; use WordPress\Plugin_Check\Traits\Find_Readme; use WordPress\Plugin_Check\Traits\Stable_Check; -use WordPressdotorg\Plugin_Directory\Readme\Parser; +use WordPress\Plugin_Check\Vendor\WordPressdotorg\Plugin_Directory\Readme\Parser as PrefixedParser; +use WordPressdotorg\Plugin_Directory\Readme\Parser as DotorgParser; /** * Check for trademarks. @@ -265,7 +266,7 @@ private function check_for_name_in_readme( Check_Result $result, array $files ) $readme_file = reset( $readme ); - $parser = new Parser( $readme_file ); + $parser = class_exists( DotorgParser::class ) ? new DotorgParser( $readme_file ) : new PrefixedParser( $readme_file ); try { $this->validate_name_has_no_trademarks( $parser->name ); diff --git a/includes/Plugin_Context.php b/includes/Plugin_Context.php index 9cdde25fc..c98cd6175 100644 --- a/includes/Plugin_Context.php +++ b/includes/Plugin_Context.php @@ -9,7 +9,8 @@ use Exception; use WordPress\Plugin_Check\Traits\Find_Readme; -use WordPressdotorg\Plugin_Directory\Readme\Parser; +use WordPress\Plugin_Check\Vendor\WordPressdotorg\Plugin_Directory\Readme\Parser as PrefixedParser; +use WordPressdotorg\Plugin_Directory\Readme\Parser as DotorgParser; use function WP_CLI\Utils\normalize_path; /** @@ -200,7 +201,7 @@ public function minimum_supported_wp() { $readme_files = $this->filter_files_for_readme( $readme_files, $this->path() ); $readme_file = reset( $readme_files ); if ( $readme_file ) { - $parser = new Parser( $readme_file ); + $parser = class_exists( DotorgParser::class ) ? new DotorgParser( $readme_file ) : new PrefixedParser( $readme_file ); if ( ! empty( $parser->requires ) ) { $this->minimum_supported_wp = $parser->requires; diff --git a/phpcs.xml.dist b/phpcs.xml.dist index 436717cd8..43de765a5 100644 --- a/phpcs.xml.dist +++ b/phpcs.xml.dist @@ -21,6 +21,8 @@ ./tests/phpunit */tests/phpunit/testdata/plugins/* + */includes/vendor/* + */vendor-prefixed/* diff --git a/phpstan.neon.dist b/phpstan.neon.dist index 7de736713..789620283 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -10,6 +10,9 @@ parameters: - tests/phpstan/stubs/wp-cli.php - tests/phpstan/stubs/exitexception.php - tests/phpstan/stubs/formatter.php + - tests/phpstan/stubs/readme-parser.php + scanDirectories: + - vendor-prefixed dynamicConstantNames: - WP_PLUGIN_CHECK_PLUGIN_DIR_URL treatPhpDocTypesAsCertain: false diff --git a/plugin.php b/plugin.php index 44368a4ad..91ec3b5d8 100644 --- a/plugin.php +++ b/plugin.php @@ -35,13 +35,16 @@ function wp_plugin_check_load() { } // Check Composer autoloader exists. - if ( ! file_exists( WP_PLUGIN_CHECK_PLUGIN_DIR_PATH . 'vendor/autoload.php' ) ) { + if ( ! file_exists( WP_PLUGIN_CHECK_PLUGIN_DIR_PATH . 'vendor-prefixed/vendor/scoper-autoload.php' ) ) { add_action( 'admin_notices', 'wp_plugin_check_display_composer_autoload_notice' ); return; } - // Load the Composer autoloader. - require_once WP_PLUGIN_CHECK_PLUGIN_DIR_PATH . 'vendor/autoload.php'; + // Autoloader for dependencies. + require_once WP_PLUGIN_CHECK_PLUGIN_DIR_PATH . 'vendor-prefixed/vendor/scoper-autoload.php'; + + // Autoloader for plugin itself. + require_once WP_PLUGIN_CHECK_PLUGIN_DIR_PATH . 'includes/vendor/autoload.php'; // Setup the plugin. $instance = new Plugin_Main( WP_PLUGIN_CHECK_MAIN_FILE ); diff --git a/scoper.inc.php b/scoper.inc.php new file mode 100644 index 000000000..9c41ed481 --- /dev/null +++ b/scoper.inc.php @@ -0,0 +1,71 @@ + 'WordPress\\Plugin_Check\\Vendor', + + // See: https://github.com/humbug/php-scoper#finders-and-paths. + 'finders' => array( + // PHP_CodeSniffer + Finder::create() + ->files() + ->ignoreVCS( true ) + ->ignoreDotFiles( true ) + ->name( '*.php' ) + ->exclude( + array( + 'bin', + 'tests', + ) + ) + ->in( + array( + 'vendor/squizlabs/php_codesniffer', + ) + ) + ->append( + array( + 'vendor/squizlabs/php_codesniffer/CodeSniffer.conf', + 'vendor/squizlabs/php_codesniffer/composer.json', + ) + ), + + // Plugin Check custom PHPCS sniffs. + Finder::create() + ->files() + ->ignoreVCS( true ) + ->ignoreDotFiles( true ) + ->name( '*.php' ) + ->exclude( + array( + 'build', + 'Tests', + 'vendor', + ) + ) + ->in( 'vendor/plugin-check/phpcs-sniffs' ) + ->append( array( 'vendor/plugin-check/phpcs-sniffs/composer.json' ) ), + + // WordPress plugin readme parser. + Finder::create() + ->files() + ->ignoreVCS( true ) + ->ignoreDotFiles( true ) + ->name( '*.php' ) + ->in( 'vendor/afragen/wordpress-plugin-readme-parser' ) + ->append( array( 'vendor/afragen/wordpress-plugin-readme-parser/composer.json' ) ), + + // Main composer.json file so that we can build a classmap. + Finder::create() + ->append( array( 'composer.json' ) ), + ), +); diff --git a/tests/phpstan/stubs/readme-parser.php b/tests/phpstan/stubs/readme-parser.php new file mode 100644 index 000000000..3d4bca0d4 --- /dev/null +++ b/tests/phpstan/stubs/readme-parser.php @@ -0,0 +1,110 @@ + to + * + * @var array + */ + public $alias_sections = array('frequently_asked_questions' => 'faq', 'change_log' => 'changelog', 'screenshot' => 'screenshots'); + /** + * These are the valid header mappings for the header. + * + * @var array + */ + public $valid_headers = array('tested' => 'tested', 'tested up to' => 'tested', 'requires' => 'requires', 'requires at least' => 'requires', 'requires php' => 'requires_php', 'tags' => 'tags', 'contributors' => 'contributors', 'donate link' => 'donate_link', 'stable tag' => 'stable_tag', 'license' => 'license', 'license uri' => 'license_uri'); + /** + * These plugin tags are ignored. + * + * @var array + */ + public $ignore_tags = array('plugin', 'wordpress'); + /** + * The maximum field lengths for the readme. + * + * @var array + */ + public $maximum_field_lengths = array('short_description' => 150, 'section' => 2500, 'section-changelog' => 5000, 'section-faq' => 5000); + /** + * The raw contents of the readme file. + * + * @var string + */ + public $raw_contents = ''; + + public function __construct($string = '') {} +} From 391bb4bfcc68cf2106957d27883aeeb467925427 Mon Sep 17 00:00:00 2001 From: Pascal Birchler Date: Tue, 25 Feb 2025 13:37:06 +0100 Subject: [PATCH 02/30] Don't ignore folder --- .gitignore | 2 +- composer.json | 3 +- composer.lock | 49 +- vendor-bin/php-scoper/composer.json | 5 + vendor-bin/php-scoper/composer.lock | 1723 +++++++++++++++++++++++++++ 5 files changed, 1731 insertions(+), 51 deletions(-) create mode 100644 vendor-bin/php-scoper/composer.json create mode 100644 vendor-bin/php-scoper/composer.lock diff --git a/.gitignore b/.gitignore index 2a8c55218..412532917 100644 --- a/.gitignore +++ b/.gitignore @@ -29,7 +29,7 @@ build node_modules/ /vendor/ -/vendor-bin/ +/vendor-bin/**/vendor/ /vendor-prefixed/ /includes/vendor/ /includes/composer.json diff --git a/composer.json b/composer.json index 746e57da9..3187f288e 100644 --- a/composer.json +++ b/composer.json @@ -28,8 +28,7 @@ "wp-cli/entity-command": "^2.8", "wp-phpunit/wp-phpunit": "^6.3", "yoast/phpunit-polyfills": "^1.0", - "bamarni/composer-bin-plugin": "^1.8", - "sniccowp/php-scoper-wordpress-excludes": "^6.7" + "bamarni/composer-bin-plugin": "^1.8" }, "repositories": [ { diff --git a/composer.lock b/composer.lock index ab5add865..e40ca11e2 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": "b9200ade0e6add63f035c11948d08e44", + "content-hash": "84c1b82cc8493a14f9c051db609d4cb8", "packages": [ { "name": "afragen/wordpress-plugin-readme-parser", @@ -4091,53 +4091,6 @@ ], "time": "2025-02-23T18:12:49+00:00" }, - { - "name": "sniccowp/php-scoper-wordpress-excludes", - "version": "6.7.1", - "source": { - "type": "git", - "url": "https://github.com/snicco/php-scoper-wordpress-excludes.git", - "reference": "d8e6b5fdc9e42300a8ab18b44b775836a7b52363" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/snicco/php-scoper-wordpress-excludes/zipball/d8e6b5fdc9e42300a8ab18b44b775836a7b52363", - "reference": "d8e6b5fdc9e42300a8ab18b44b775836a7b52363", - "shasum": "" - }, - "require-dev": { - "php": "^7.4", - "php-stubs/wordpress-globals": "0.2.0", - "php-stubs/wordpress-stubs": "6.7.1", - "sniccowp/php-scoper-excludes": "dev-master" - }, - "type": "library", - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Calvin Alkan", - "email": "calvin@snicco.de" - }, - { - "name": "Marlon Alkan", - "email": "marlon@snicco.de" - } - ], - "description": "A list of all WordPress core classes, functions and constants. Meant to be used with the PHP-Scoper exclusion functionality.", - "keywords": [ - "php-scoper", - "scoping WordPress", - "wordpress" - ], - "support": { - "issues": "https://github.com/snicco/php-scoper-wordpress-excludes/issues", - "source": "https://github.com/snicco/php-scoper-wordpress-excludes/tree/6.7.1" - }, - "time": "2024-11-25T00:31:50+00:00" - }, { "name": "symfony/config", "version": "v5.4.46", diff --git a/vendor-bin/php-scoper/composer.json b/vendor-bin/php-scoper/composer.json new file mode 100644 index 000000000..ad53be272 --- /dev/null +++ b/vendor-bin/php-scoper/composer.json @@ -0,0 +1,5 @@ +{ + "require-dev": { + "humbug/php-scoper": "^0.18.17" + } +} diff --git a/vendor-bin/php-scoper/composer.lock b/vendor-bin/php-scoper/composer.lock new file mode 100644 index 000000000..a3801eebc --- /dev/null +++ b/vendor-bin/php-scoper/composer.lock @@ -0,0 +1,1723 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", + "This file is @generated automatically" + ], + "content-hash": "fda6ed8ff7e5573ab061ffbe38af23f2", + "packages": [], + "packages-dev": [ + { + "name": "fidry/console", + "version": "0.6.11", + "source": { + "type": "git", + "url": "https://github.com/theofidry/console.git", + "reference": "bea8316beae874fc5b8be679d67dd3169c7e205f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/theofidry/console/zipball/bea8316beae874fc5b8be679d67dd3169c7e205f", + "reference": "bea8316beae874fc5b8be679d67dd3169c7e205f", + "shasum": "" + }, + "require": { + "php": "^8.2", + "psr/log": "^1.0 || ^2.0 || ^3.0", + "symfony/console": "^6.4 || ^7.2", + "symfony/deprecation-contracts": "^3.4", + "symfony/event-dispatcher-contracts": "^2.5 || ^3.0", + "symfony/polyfill-php84": "^1.31", + "symfony/service-contracts": "^2.5 || ^3.0", + "thecodingmachine/safe": "^2.0 || ^3.0", + "webmozart/assert": "^1.11" + }, + "conflict": { + "symfony/dependency-injection": "<6.4.0 || >=7.0.0 <7.2.0", + "symfony/framework-bundle": "<6.4.0 || >=7.0.0 <7.2.0", + "symfony/http-kernel": "<6.4.0 || >=7.0.0 <7.2.0" + }, + "require-dev": { + "bamarni/composer-bin-plugin": "^1.8.2", + "composer/semver": "^3.3.2", + "ergebnis/composer-normalize": "^2.33", + "fidry/makefile": "^0.2.1 || ^1.0.0", + "infection/infection": "^0.28", + "phpunit/phpunit": "^10.2", + "symfony/dependency-injection": "^6.4 || ^7.2", + "symfony/flex": "^2.4.0", + "symfony/framework-bundle": "^6.4 || ^7.2", + "symfony/http-kernel": "^6.4 || ^7.2", + "symfony/yaml": "^6.4 || ^7.2" + }, + "type": "library", + "extra": { + "bamarni-bin": { + "bin-links": false, + "forward-command": false + }, + "branch-alias": { + "dev-main": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Fidry\\Console\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Théo Fidry", + "email": "theo.fidry@gmail.com" + } + ], + "description": "Library to create CLI applications", + "keywords": [ + "cli", + "console", + "symfony" + ], + "support": { + "issues": "https://github.com/theofidry/console/issues", + "source": "https://github.com/theofidry/console/tree/0.6.11" + }, + "funding": [ + { + "url": "https://github.com/theofidry", + "type": "github" + } + ], + "time": "2025-02-14T11:06:15+00:00" + }, + { + "name": "fidry/filesystem", + "version": "1.3.0", + "source": { + "type": "git", + "url": "https://github.com/theofidry/filesystem.git", + "reference": "d0d9e8dfa43f7663da153c306b0d5bc24846ad8e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/theofidry/filesystem/zipball/d0d9e8dfa43f7663da153c306b0d5bc24846ad8e", + "reference": "d0d9e8dfa43f7663da153c306b0d5bc24846ad8e", + "shasum": "" + }, + "require": { + "php": "^8.3", + "symfony/filesystem": "^6.4 || ^7.0" + }, + "require-dev": { + "bamarni/composer-bin-plugin": "^1.4", + "ergebnis/composer-normalize": "^2.28", + "infection/infection": ">=0.26", + "phpunit/phpunit": "^12", + "symfony/finder": "^6.4 || ^7.0" + }, + "type": "library", + "extra": { + "bamarni-bin": { + "bin-links": false, + "forward-command": false + }, + "branch-alias": { + "dev-main": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Fidry\\FileSystem\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Théo Fidry", + "email": "theo.fidry@gmail.com" + } + ], + "description": "Symfony Filesystem with a few more utilities.", + "keywords": [ + "filesystem" + ], + "support": { + "issues": "https://github.com/theofidry/filesystem/issues", + "source": "https://github.com/theofidry/filesystem/tree/1.3.0" + }, + "funding": [ + { + "url": "https://github.com/theofidry", + "type": "github" + } + ], + "time": "2025-02-13T23:05:19+00:00" + }, + { + "name": "humbug/php-scoper", + "version": "0.18.17", + "source": { + "type": "git", + "url": "https://github.com/humbug/php-scoper.git", + "reference": "0a2556c7c23776a61cf22689e2f24298ba00e33a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/humbug/php-scoper/zipball/0a2556c7c23776a61cf22689e2f24298ba00e33a", + "reference": "0a2556c7c23776a61cf22689e2f24298ba00e33a", + "shasum": "" + }, + "require": { + "fidry/console": "^0.6.10", + "fidry/filesystem": "^1.1", + "jetbrains/phpstorm-stubs": "^2024.1", + "nikic/php-parser": "^5.0", + "php": "^8.2", + "symfony/console": "^6.4 || ^7.0", + "symfony/filesystem": "^6.4 || ^7.0", + "symfony/finder": "^6.4 || ^7.0", + "symfony/var-dumper": "^7.1", + "thecodingmachine/safe": "^3.0" + }, + "require-dev": { + "bamarni/composer-bin-plugin": "^1.1", + "ergebnis/composer-normalize": "^2.28", + "fidry/makefile": "^1.0", + "humbug/box": "^4.6.2", + "phpspec/prophecy-phpunit": "^2.0", + "phpunit/phpunit": "^10.0 || ^11.0", + "symfony/yaml": "^6.4 || ^7.0" + }, + "bin": [ + "bin/php-scoper" + ], + "type": "library", + "extra": { + "bamarni-bin": { + "bin-links": false, + "forward-command": false + }, + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "files": [ + "src/functions.php" + ], + "psr-4": { + "Humbug\\PhpScoper\\": "src/" + }, + "classmap": [ + "vendor-hotfix/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Bernhard Schussek", + "email": "bschussek@gmail.com" + }, + { + "name": "Théo Fidry", + "email": "theo.fidry@gmail.com" + }, + { + "name": "Pádraic Brady", + "email": "padraic.brady@gmail.com" + } + ], + "description": "Prefixes all PHP namespaces in a file or directory.", + "support": { + "issues": "https://github.com/humbug/php-scoper/issues", + "source": "https://github.com/humbug/php-scoper/tree/0.18.17" + }, + "time": "2025-02-19T22:50:39+00:00" + }, + { + "name": "jetbrains/phpstorm-stubs", + "version": "v2024.3", + "source": { + "type": "git", + "url": "https://github.com/JetBrains/phpstorm-stubs.git", + "reference": "0e82bdfe850c71857ee4ee3501ed82a9fc5d043c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/JetBrains/phpstorm-stubs/zipball/0e82bdfe850c71857ee4ee3501ed82a9fc5d043c", + "reference": "0e82bdfe850c71857ee4ee3501ed82a9fc5d043c", + "shasum": "" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "v3.64.0", + "nikic/php-parser": "v5.3.1", + "phpdocumentor/reflection-docblock": "5.6.0", + "phpunit/phpunit": "11.4.3" + }, + "type": "library", + "autoload": { + "files": [ + "PhpStormStubsMap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "description": "PHP runtime & extensions header files for PhpStorm", + "homepage": "https://www.jetbrains.com/phpstorm", + "keywords": [ + "autocomplete", + "code", + "inference", + "inspection", + "jetbrains", + "phpstorm", + "stubs", + "type" + ], + "support": { + "source": "https://github.com/JetBrains/phpstorm-stubs/tree/v2024.3" + }, + "time": "2024-12-14T08:03:12+00:00" + }, + { + "name": "nikic/php-parser", + "version": "v5.4.0", + "source": { + "type": "git", + "url": "https://github.com/nikic/PHP-Parser.git", + "reference": "447a020a1f875a434d62f2a401f53b82a396e494" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/447a020a1f875a434d62f2a401f53b82a396e494", + "reference": "447a020a1f875a434d62f2a401f53b82a396e494", + "shasum": "" + }, + "require": { + "ext-ctype": "*", + "ext-json": "*", + "ext-tokenizer": "*", + "php": ">=7.4" + }, + "require-dev": { + "ircmaxell/php-yacc": "^0.0.7", + "phpunit/phpunit": "^9.0" + }, + "bin": [ + "bin/php-parse" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.0-dev" + } + }, + "autoload": { + "psr-4": { + "PhpParser\\": "lib/PhpParser" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Nikita Popov" + } + ], + "description": "A PHP parser written in PHP", + "keywords": [ + "parser", + "php" + ], + "support": { + "issues": "https://github.com/nikic/PHP-Parser/issues", + "source": "https://github.com/nikic/PHP-Parser/tree/v5.4.0" + }, + "time": "2024-12-30T11:07:19+00:00" + }, + { + "name": "psr/container", + "version": "2.0.2", + "source": { + "type": "git", + "url": "https://github.com/php-fig/container.git", + "reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/container/zipball/c71ecc56dfe541dbd90c5360474fbc405f8d5963", + "reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963", + "shasum": "" + }, + "require": { + "php": ">=7.4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Container\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common Container Interface (PHP FIG PSR-11)", + "homepage": "https://github.com/php-fig/container", + "keywords": [ + "PSR-11", + "container", + "container-interface", + "container-interop", + "psr" + ], + "support": { + "issues": "https://github.com/php-fig/container/issues", + "source": "https://github.com/php-fig/container/tree/2.0.2" + }, + "time": "2021-11-05T16:47:00+00:00" + }, + { + "name": "psr/event-dispatcher", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/event-dispatcher.git", + "reference": "dbefd12671e8a14ec7f180cab83036ed26714bb0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/event-dispatcher/zipball/dbefd12671e8a14ec7f180cab83036ed26714bb0", + "reference": "dbefd12671e8a14ec7f180cab83036ed26714bb0", + "shasum": "" + }, + "require": { + "php": ">=7.2.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\EventDispatcher\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Standard interfaces for event handling.", + "keywords": [ + "events", + "psr", + "psr-14" + ], + "support": { + "issues": "https://github.com/php-fig/event-dispatcher/issues", + "source": "https://github.com/php-fig/event-dispatcher/tree/1.0.0" + }, + "time": "2019-01-08T18:20:26+00:00" + }, + { + "name": "psr/log", + "version": "3.0.2", + "source": { + "type": "git", + "url": "https://github.com/php-fig/log.git", + "reference": "f16e1d5863e37f8d8c2a01719f5b34baa2b714d3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/log/zipball/f16e1d5863e37f8d8c2a01719f5b34baa2b714d3", + "reference": "f16e1d5863e37f8d8c2a01719f5b34baa2b714d3", + "shasum": "" + }, + "require": { + "php": ">=8.0.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Log\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common interface for logging libraries", + "homepage": "https://github.com/php-fig/log", + "keywords": [ + "log", + "psr", + "psr-3" + ], + "support": { + "source": "https://github.com/php-fig/log/tree/3.0.2" + }, + "time": "2024-09-11T13:17:53+00:00" + }, + { + "name": "symfony/console", + "version": "v7.2.1", + "source": { + "type": "git", + "url": "https://github.com/symfony/console.git", + "reference": "fefcc18c0f5d0efe3ab3152f15857298868dc2c3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/console/zipball/fefcc18c0f5d0efe3ab3152f15857298868dc2c3", + "reference": "fefcc18c0f5d0efe3ab3152f15857298868dc2c3", + "shasum": "" + }, + "require": { + "php": ">=8.2", + "symfony/polyfill-mbstring": "~1.0", + "symfony/service-contracts": "^2.5|^3", + "symfony/string": "^6.4|^7.0" + }, + "conflict": { + "symfony/dependency-injection": "<6.4", + "symfony/dotenv": "<6.4", + "symfony/event-dispatcher": "<6.4", + "symfony/lock": "<6.4", + "symfony/process": "<6.4" + }, + "provide": { + "psr/log-implementation": "1.0|2.0|3.0" + }, + "require-dev": { + "psr/log": "^1|^2|^3", + "symfony/config": "^6.4|^7.0", + "symfony/dependency-injection": "^6.4|^7.0", + "symfony/event-dispatcher": "^6.4|^7.0", + "symfony/http-foundation": "^6.4|^7.0", + "symfony/http-kernel": "^6.4|^7.0", + "symfony/lock": "^6.4|^7.0", + "symfony/messenger": "^6.4|^7.0", + "symfony/process": "^6.4|^7.0", + "symfony/stopwatch": "^6.4|^7.0", + "symfony/var-dumper": "^6.4|^7.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\Console\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Eases the creation of beautiful and testable command line interfaces", + "homepage": "https://symfony.com", + "keywords": [ + "cli", + "command-line", + "console", + "terminal" + ], + "support": { + "source": "https://github.com/symfony/console/tree/v7.2.1" + }, + "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": "2024-12-11T03:49:26+00:00" + }, + { + "name": "symfony/deprecation-contracts", + "version": "v3.5.1", + "source": { + "type": "git", + "url": "https://github.com/symfony/deprecation-contracts.git", + "reference": "74c71c939a79f7d5bf3c1ce9f5ea37ba0114c6f6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/74c71c939a79f7d5bf3c1ce9f5ea37ba0114c6f6", + "reference": "74c71c939a79f7d5bf3c1ce9f5ea37ba0114c6f6", + "shasum": "" + }, + "require": { + "php": ">=8.1" + }, + "type": "library", + "extra": { + "thanks": { + "url": "https://github.com/symfony/contracts", + "name": "symfony/contracts" + }, + "branch-alias": { + "dev-main": "3.5-dev" + } + }, + "autoload": { + "files": [ + "function.php" + ] + }, + "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": "A generic function and convention to trigger deprecation notices", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/deprecation-contracts/tree/v3.5.1" + }, + "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": "2024-09-25T14:20:29+00:00" + }, + { + "name": "symfony/event-dispatcher-contracts", + "version": "v3.5.1", + "source": { + "type": "git", + "url": "https://github.com/symfony/event-dispatcher-contracts.git", + "reference": "7642f5e970b672283b7823222ae8ef8bbc160b9f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/7642f5e970b672283b7823222ae8ef8bbc160b9f", + "reference": "7642f5e970b672283b7823222ae8ef8bbc160b9f", + "shasum": "" + }, + "require": { + "php": ">=8.1", + "psr/event-dispatcher": "^1" + }, + "type": "library", + "extra": { + "thanks": { + "url": "https://github.com/symfony/contracts", + "name": "symfony/contracts" + }, + "branch-alias": { + "dev-main": "3.5-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Contracts\\EventDispatcher\\": "" + } + }, + "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": "Generic abstractions related to dispatching event", + "homepage": "https://symfony.com", + "keywords": [ + "abstractions", + "contracts", + "decoupling", + "interfaces", + "interoperability", + "standards" + ], + "support": { + "source": "https://github.com/symfony/event-dispatcher-contracts/tree/v3.5.1" + }, + "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": "2024-09-25T14:20:29+00:00" + }, + { + "name": "symfony/filesystem", + "version": "v7.2.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/filesystem.git", + "reference": "b8dce482de9d7c9fe2891155035a7248ab5c7fdb" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/b8dce482de9d7c9fe2891155035a7248ab5c7fdb", + "reference": "b8dce482de9d7c9fe2891155035a7248ab5c7fdb", + "shasum": "" + }, + "require": { + "php": ">=8.2", + "symfony/polyfill-ctype": "~1.8", + "symfony/polyfill-mbstring": "~1.8" + }, + "require-dev": { + "symfony/process": "^6.4|^7.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\Filesystem\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Provides basic utilities for the filesystem", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/filesystem/tree/v7.2.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": "2024-10-25T15:15:23+00:00" + }, + { + "name": "symfony/finder", + "version": "v7.2.2", + "source": { + "type": "git", + "url": "https://github.com/symfony/finder.git", + "reference": "87a71856f2f56e4100373e92529eed3171695cfb" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/finder/zipball/87a71856f2f56e4100373e92529eed3171695cfb", + "reference": "87a71856f2f56e4100373e92529eed3171695cfb", + "shasum": "" + }, + "require": { + "php": ">=8.2" + }, + "require-dev": { + "symfony/filesystem": "^6.4|^7.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\Finder\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Finds files and directories via an intuitive fluent interface", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/finder/tree/v7.2.2" + }, + "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": "2024-12-30T19:00:17+00:00" + }, + { + "name": "symfony/polyfill-ctype", + "version": "v1.31.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-ctype.git", + "reference": "a3cc8b044a6ea513310cbd48ef7333b384945638" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/a3cc8b044a6ea513310cbd48ef7333b384945638", + "reference": "a3cc8b044a6ea513310cbd48ef7333b384945638", + "shasum": "" + }, + "require": { + "php": ">=7.2" + }, + "provide": { + "ext-ctype": "*" + }, + "suggest": { + "ext-ctype": "For best performance" + }, + "type": "library", + "extra": { + "thanks": { + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Ctype\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Gert de Pagter", + "email": "BackEndTea@gmail.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for ctype functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "ctype", + "polyfill", + "portable" + ], + "support": { + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.31.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": "2024-09-09T11:45:10+00:00" + }, + { + "name": "symfony/polyfill-intl-grapheme", + "version": "v1.31.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-intl-grapheme.git", + "reference": "b9123926e3b7bc2f98c02ad54f6a4b02b91a8abe" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/b9123926e3b7bc2f98c02ad54f6a4b02b91a8abe", + "reference": "b9123926e3b7bc2f98c02ad54f6a4b02b91a8abe", + "shasum": "" + }, + "require": { + "php": ">=7.2" + }, + "suggest": { + "ext-intl": "For best performance" + }, + "type": "library", + "extra": { + "thanks": { + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Intl\\Grapheme\\": "" + } + }, + "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 for intl's grapheme_* functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "grapheme", + "intl", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.31.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": "2024-09-09T11:45:10+00:00" + }, + { + "name": "symfony/polyfill-intl-normalizer", + "version": "v1.31.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-intl-normalizer.git", + "reference": "3833d7255cc303546435cb650316bff708a1c75c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/3833d7255cc303546435cb650316bff708a1c75c", + "reference": "3833d7255cc303546435cb650316bff708a1c75c", + "shasum": "" + }, + "require": { + "php": ">=7.2" + }, + "suggest": { + "ext-intl": "For best performance" + }, + "type": "library", + "extra": { + "thanks": { + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Intl\\Normalizer\\": "" + }, + "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 for intl's Normalizer class and related functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "intl", + "normalizer", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.31.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": "2024-09-09T11:45:10+00:00" + }, + { + "name": "symfony/polyfill-mbstring", + "version": "v1.31.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-mbstring.git", + "reference": "85181ba99b2345b0ef10ce42ecac37612d9fd341" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/85181ba99b2345b0ef10ce42ecac37612d9fd341", + "reference": "85181ba99b2345b0ef10ce42ecac37612d9fd341", + "shasum": "" + }, + "require": { + "php": ">=7.2" + }, + "provide": { + "ext-mbstring": "*" + }, + "suggest": { + "ext-mbstring": "For best performance" + }, + "type": "library", + "extra": { + "thanks": { + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Mbstring\\": "" + } + }, + "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 for the Mbstring extension", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "mbstring", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.31.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": "2024-09-09T11:45:10+00:00" + }, + { + "name": "symfony/polyfill-php84", + "version": "v1.31.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php84.git", + "reference": "e5493eb51311ab0b1cc2243416613f06ed8f18bd" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php84/zipball/e5493eb51311ab0b1cc2243416613f06ed8f18bd", + "reference": "e5493eb51311ab0b1cc2243416613f06ed8f18bd", + "shasum": "" + }, + "require": { + "php": ">=7.2" + }, + "type": "library", + "extra": { + "thanks": { + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Php84\\": "" + }, + "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 8.4+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-php84/tree/v1.31.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": "2024-09-09T12:04:04+00:00" + }, + { + "name": "symfony/service-contracts", + "version": "v3.5.1", + "source": { + "type": "git", + "url": "https://github.com/symfony/service-contracts.git", + "reference": "e53260aabf78fb3d63f8d79d69ece59f80d5eda0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/e53260aabf78fb3d63f8d79d69ece59f80d5eda0", + "reference": "e53260aabf78fb3d63f8d79d69ece59f80d5eda0", + "shasum": "" + }, + "require": { + "php": ">=8.1", + "psr/container": "^1.1|^2.0", + "symfony/deprecation-contracts": "^2.5|^3" + }, + "conflict": { + "ext-psr": "<1.1|>=2" + }, + "type": "library", + "extra": { + "thanks": { + "url": "https://github.com/symfony/contracts", + "name": "symfony/contracts" + }, + "branch-alias": { + "dev-main": "3.5-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Contracts\\Service\\": "" + }, + "exclude-from-classmap": [ + "/Test/" + ] + }, + "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": "Generic abstractions related to writing services", + "homepage": "https://symfony.com", + "keywords": [ + "abstractions", + "contracts", + "decoupling", + "interfaces", + "interoperability", + "standards" + ], + "support": { + "source": "https://github.com/symfony/service-contracts/tree/v3.5.1" + }, + "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": "2024-09-25T14:20:29+00:00" + }, + { + "name": "symfony/string", + "version": "v7.2.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/string.git", + "reference": "446e0d146f991dde3e73f45f2c97a9faad773c82" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/string/zipball/446e0d146f991dde3e73f45f2c97a9faad773c82", + "reference": "446e0d146f991dde3e73f45f2c97a9faad773c82", + "shasum": "" + }, + "require": { + "php": ">=8.2", + "symfony/polyfill-ctype": "~1.8", + "symfony/polyfill-intl-grapheme": "~1.0", + "symfony/polyfill-intl-normalizer": "~1.0", + "symfony/polyfill-mbstring": "~1.0" + }, + "conflict": { + "symfony/translation-contracts": "<2.5" + }, + "require-dev": { + "symfony/emoji": "^7.1", + "symfony/error-handler": "^6.4|^7.0", + "symfony/http-client": "^6.4|^7.0", + "symfony/intl": "^6.4|^7.0", + "symfony/translation-contracts": "^2.5|^3.0", + "symfony/var-exporter": "^6.4|^7.0" + }, + "type": "library", + "autoload": { + "files": [ + "Resources/functions.php" + ], + "psr-4": { + "Symfony\\Component\\String\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "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": "Provides an object-oriented API to strings and deals with bytes, UTF-8 code points and grapheme clusters in a unified way", + "homepage": "https://symfony.com", + "keywords": [ + "grapheme", + "i18n", + "string", + "unicode", + "utf-8", + "utf8" + ], + "support": { + "source": "https://github.com/symfony/string/tree/v7.2.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": "2024-11-13T13:31:26+00:00" + }, + { + "name": "symfony/var-dumper", + "version": "v7.2.3", + "source": { + "type": "git", + "url": "https://github.com/symfony/var-dumper.git", + "reference": "82b478c69745d8878eb60f9a049a4d584996f73a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/var-dumper/zipball/82b478c69745d8878eb60f9a049a4d584996f73a", + "reference": "82b478c69745d8878eb60f9a049a4d584996f73a", + "shasum": "" + }, + "require": { + "php": ">=8.2", + "symfony/polyfill-mbstring": "~1.0" + }, + "conflict": { + "symfony/console": "<6.4" + }, + "require-dev": { + "ext-iconv": "*", + "symfony/console": "^6.4|^7.0", + "symfony/http-kernel": "^6.4|^7.0", + "symfony/process": "^6.4|^7.0", + "symfony/uid": "^6.4|^7.0", + "twig/twig": "^3.12" + }, + "bin": [ + "Resources/bin/var-dump-server" + ], + "type": "library", + "autoload": { + "files": [ + "Resources/functions/dump.php" + ], + "psr-4": { + "Symfony\\Component\\VarDumper\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "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": "Provides mechanisms for walking through any arbitrary PHP variable", + "homepage": "https://symfony.com", + "keywords": [ + "debug", + "dump" + ], + "support": { + "source": "https://github.com/symfony/var-dumper/tree/v7.2.3" + }, + "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": "2025-01-17T11:39:41+00:00" + }, + { + "name": "thecodingmachine/safe", + "version": "v3.0.2", + "source": { + "type": "git", + "url": "https://github.com/thecodingmachine/safe.git", + "reference": "22ffad3248982a784f9870a37aeb2e522bd19645" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/thecodingmachine/safe/zipball/22ffad3248982a784f9870a37aeb2e522bd19645", + "reference": "22ffad3248982a784f9870a37aeb2e522bd19645", + "shasum": "" + }, + "require": { + "php": "^8.1" + }, + "require-dev": { + "php-parallel-lint/php-parallel-lint": "^1.4", + "phpstan/phpstan": "^2", + "phpunit/phpunit": "^10", + "squizlabs/php_codesniffer": "^3.2" + }, + "type": "library", + "autoload": { + "files": [ + "lib/special_cases.php", + "generated/apache.php", + "generated/apcu.php", + "generated/array.php", + "generated/bzip2.php", + "generated/calendar.php", + "generated/classobj.php", + "generated/com.php", + "generated/cubrid.php", + "generated/curl.php", + "generated/datetime.php", + "generated/dir.php", + "generated/eio.php", + "generated/errorfunc.php", + "generated/exec.php", + "generated/fileinfo.php", + "generated/filesystem.php", + "generated/filter.php", + "generated/fpm.php", + "generated/ftp.php", + "generated/funchand.php", + "generated/gettext.php", + "generated/gmp.php", + "generated/gnupg.php", + "generated/hash.php", + "generated/ibase.php", + "generated/ibmDb2.php", + "generated/iconv.php", + "generated/image.php", + "generated/imap.php", + "generated/info.php", + "generated/inotify.php", + "generated/json.php", + "generated/ldap.php", + "generated/libxml.php", + "generated/lzf.php", + "generated/mailparse.php", + "generated/mbstring.php", + "generated/misc.php", + "generated/mysql.php", + "generated/mysqli.php", + "generated/network.php", + "generated/oci8.php", + "generated/opcache.php", + "generated/openssl.php", + "generated/outcontrol.php", + "generated/pcntl.php", + "generated/pcre.php", + "generated/pgsql.php", + "generated/posix.php", + "generated/ps.php", + "generated/pspell.php", + "generated/readline.php", + "generated/rnp.php", + "generated/rpminfo.php", + "generated/rrd.php", + "generated/sem.php", + "generated/session.php", + "generated/shmop.php", + "generated/sockets.php", + "generated/sodium.php", + "generated/solr.php", + "generated/spl.php", + "generated/sqlsrv.php", + "generated/ssdeep.php", + "generated/ssh2.php", + "generated/stream.php", + "generated/strings.php", + "generated/swoole.php", + "generated/uodbc.php", + "generated/uopz.php", + "generated/url.php", + "generated/var.php", + "generated/xdiff.php", + "generated/xml.php", + "generated/xmlrpc.php", + "generated/yaml.php", + "generated/yaz.php", + "generated/zip.php", + "generated/zlib.php" + ], + "classmap": [ + "lib/DateTime.php", + "lib/DateTimeImmutable.php", + "lib/Exceptions/", + "generated/Exceptions/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "PHP core functions that throw exceptions instead of returning FALSE on error", + "support": { + "issues": "https://github.com/thecodingmachine/safe/issues", + "source": "https://github.com/thecodingmachine/safe/tree/v3.0.2" + }, + "funding": [ + { + "url": "https://github.com/OskarStark", + "type": "github" + }, + { + "url": "https://github.com/shish", + "type": "github" + }, + { + "url": "https://github.com/staabm", + "type": "github" + } + ], + "time": "2025-02-19T19:23:00+00:00" + }, + { + "name": "webmozart/assert", + "version": "1.11.0", + "source": { + "type": "git", + "url": "https://github.com/webmozarts/assert.git", + "reference": "11cb2199493b2f8a3b53e7f19068fc6aac760991" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/webmozarts/assert/zipball/11cb2199493b2f8a3b53e7f19068fc6aac760991", + "reference": "11cb2199493b2f8a3b53e7f19068fc6aac760991", + "shasum": "" + }, + "require": { + "ext-ctype": "*", + "php": "^7.2 || ^8.0" + }, + "conflict": { + "phpstan/phpstan": "<0.12.20", + "vimeo/psalm": "<4.6.1 || 4.6.2" + }, + "require-dev": { + "phpunit/phpunit": "^8.5.13" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.10-dev" + } + }, + "autoload": { + "psr-4": { + "Webmozart\\Assert\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Bernhard Schussek", + "email": "bschussek@gmail.com" + } + ], + "description": "Assertions to validate method input/output with nice error messages.", + "keywords": [ + "assert", + "check", + "validate" + ], + "support": { + "issues": "https://github.com/webmozarts/assert/issues", + "source": "https://github.com/webmozarts/assert/tree/1.11.0" + }, + "time": "2022-06-03T18:03:27+00:00" + } + ], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": {}, + "prefer-stable": false, + "prefer-lowest": false, + "platform": {}, + "platform-dev": {}, + "plugin-api-version": "2.6.0" +} From 268eb8afac38f96c06db7c77ee878a65a0cea613 Mon Sep 17 00:00:00 2001 From: Nilambar Sharma Date: Wed, 26 Feb 2025 10:22:22 +0545 Subject: [PATCH 03/30] Fix spell checker issue --- tests/phpstan/stubs/readme-parser.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/phpstan/stubs/readme-parser.php b/tests/phpstan/stubs/readme-parser.php index 3d4bca0d4..a6205e529 100644 --- a/tests/phpstan/stubs/readme-parser.php +++ b/tests/phpstan/stubs/readme-parser.php @@ -64,7 +64,7 @@ class Parser { */ public $faq = array(); /** - * Warning flags which indicate specific parsing failures have occured. + * Warning flags which indicate specific parsing failures have occurred. * * @var array */ From 79971311718250f077f623b4aa377a9729c8aa8e Mon Sep 17 00:00:00 2001 From: Nilambar Sharma Date: Wed, 26 Feb 2025 11:00:41 +0545 Subject: [PATCH 04/30] Update test steps --- .github/workflows/php-test.yml | 4 ++++ vendor-bin/php-scoper/composer.lock | 16 ++++++++-------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/.github/workflows/php-test.yml b/.github/workflows/php-test.yml index b0bdeb10b..34b80350d 100644 --- a/.github/workflows/php-test.yml +++ b/.github/workflows/php-test.yml @@ -77,6 +77,10 @@ jobs: with: composer-options: '--prefer-dist' + - name: Setup PHP Scoper + working-directory: ./vendor-bin + run: composer install + - name: Setup Node.js (.nvmrc) uses: actions/setup-node@v4 with: diff --git a/vendor-bin/php-scoper/composer.lock b/vendor-bin/php-scoper/composer.lock index a3801eebc..26bf40d4a 100644 --- a/vendor-bin/php-scoper/composer.lock +++ b/vendor-bin/php-scoper/composer.lock @@ -95,27 +95,27 @@ }, { "name": "fidry/filesystem", - "version": "1.3.0", + "version": "1.2.3", "source": { "type": "git", "url": "https://github.com/theofidry/filesystem.git", - "reference": "d0d9e8dfa43f7663da153c306b0d5bc24846ad8e" + "reference": "3e1f9cac40f807b7c4196013ab77cc1b9416e3e5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/theofidry/filesystem/zipball/d0d9e8dfa43f7663da153c306b0d5bc24846ad8e", - "reference": "d0d9e8dfa43f7663da153c306b0d5bc24846ad8e", + "url": "https://api.github.com/repos/theofidry/filesystem/zipball/3e1f9cac40f807b7c4196013ab77cc1b9416e3e5", + "reference": "3e1f9cac40f807b7c4196013ab77cc1b9416e3e5", "shasum": "" }, "require": { - "php": "^8.3", + "php": "^8.1", "symfony/filesystem": "^6.4 || ^7.0" }, "require-dev": { "bamarni/composer-bin-plugin": "^1.4", "ergebnis/composer-normalize": "^2.28", "infection/infection": ">=0.26", - "phpunit/phpunit": "^12", + "phpunit/phpunit": "^10.3", "symfony/finder": "^6.4 || ^7.0" }, "type": "library", @@ -149,7 +149,7 @@ ], "support": { "issues": "https://github.com/theofidry/filesystem/issues", - "source": "https://github.com/theofidry/filesystem/tree/1.3.0" + "source": "https://github.com/theofidry/filesystem/tree/1.2.3" }, "funding": [ { @@ -157,7 +157,7 @@ "type": "github" } ], - "time": "2025-02-13T23:05:19+00:00" + "time": "2025-02-13T22:58:51+00:00" }, { "name": "humbug/php-scoper", From ad55d6aec91e08a9c4c48820171e9f7f3c076fc0 Mon Sep 17 00:00:00 2001 From: Nilambar Sharma Date: Wed, 26 Feb 2025 13:16:19 +0545 Subject: [PATCH 05/30] Update PHP array --- .github/workflows/php-test.yml | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/.github/workflows/php-test.yml b/.github/workflows/php-test.yml index 34b80350d..c0d0a13ca 100644 --- a/.github/workflows/php-test.yml +++ b/.github/workflows/php-test.yml @@ -48,13 +48,10 @@ jobs: fail-fast: true matrix: php: - - '7.4' - - '8.0' - - '8.1' - '8.2' wordpress: [ 'latest' ] include: - - php: '7.4' + - php: '8.2' wordpress: '6.3' - php: '8.3' wordpress: 'latest' @@ -78,7 +75,7 @@ jobs: composer-options: '--prefer-dist' - name: Setup PHP Scoper - working-directory: ./vendor-bin + working-directory: ./vendor-bin/php-scoper run: composer install - name: Setup Node.js (.nvmrc) From 1bf67dbdc9afb96289ac1255c4ea5d2dbfc4f55f Mon Sep 17 00:00:00 2001 From: Nilambar Sharma Date: Wed, 26 Feb 2025 13:51:51 +0545 Subject: [PATCH 06/30] Update parser in readme check --- .../Plugin_Repo/Plugin_Readme_Check.php | 25 ++++++++++--------- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/includes/Checker/Checks/Plugin_Repo/Plugin_Readme_Check.php b/includes/Checker/Checks/Plugin_Repo/Plugin_Readme_Check.php index 9e4ecb287..a305b5397 100644 --- a/includes/Checker/Checks/Plugin_Repo/Plugin_Readme_Check.php +++ b/includes/Checker/Checks/Plugin_Repo/Plugin_Readme_Check.php @@ -15,7 +15,8 @@ use WordPress\Plugin_Check\Traits\License_Utils; use WordPress\Plugin_Check\Traits\Stable_Check; use WordPress\Plugin_Check\Traits\Version_Utils; -use WordPressdotorg\Plugin_Directory\Readme\Parser; +use WordPress\Plugin_Check\Vendor\WordPressdotorg\Plugin_Directory\Readme\Parser as PrefixedParser; +use WordPressdotorg\Plugin_Directory\Readme\Parser as DotorgParser; /** * Check the plugins readme file and contents. @@ -83,7 +84,7 @@ protected function check_files( Check_Result $result, array $files ) { $readme_file = reset( $readme ); - $parser = new Parser( $readme_file ); + $parser = class_exists( DotorgParser::class ) ? new DotorgParser( $readme_file ) : new PrefixedParser( $readme_file ); // Check the readme file for plugin name. $this->check_name( $result, $readme_file, $parser ); @@ -125,7 +126,7 @@ protected function check_files( Check_Result $result, array $files ) { * @param string $readme_file Readme file. * @param Parser $parser The Parser object. */ - private function check_name( Check_Result $result, string $readme_file, Parser $parser ) { + private function check_name( Check_Result $result, string $readme_file, $parser ) { if ( isset( $parser->warnings['invalid_plugin_name_header'] ) && false === $parser->name ) { $this->add_result_error_for_file( $result, @@ -192,7 +193,7 @@ private function check_name( Check_Result $result, string $readme_file, Parser $ * @param string $readme_file Readme file. * @param Parser $parser The Parser object. */ - private function check_headers( Check_Result $result, string $readme_file, Parser $parser ) { + private function check_headers( Check_Result $result, string $readme_file, $parser ) { $ignored_warnings = $this->get_ignored_warnings( $parser ); $fields = array( @@ -283,7 +284,7 @@ private function check_headers( Check_Result $result, string $readme_file, Parse * @param string $readme_file Readme file. * @param Parser $parser The Parser object. */ - private function check_default_text( Check_Result $result, string $readme_file, Parser $parser ) { + private function check_default_text( Check_Result $result, string $readme_file, $parser ) { $short_description = $parser->short_description; $tags = $parser->tags; $donate_link = $parser->donate_link; @@ -315,7 +316,7 @@ private function check_default_text( Check_Result $result, string $readme_file, * @param string $readme_file Readme file. * @param Parser $parser The Parser object. */ - private function check_license( Check_Result $result, string $readme_file, Parser $parser ) { + private function check_license( Check_Result $result, string $readme_file, $parser ) { $license = $parser->license; $matches_license = array(); $plugin_main_file = $result->plugin()->main_file(); @@ -389,7 +390,7 @@ private function check_license( Check_Result $result, string $readme_file, Parse * @param string $readme_file Readme file. * @param Parser $parser The Parser object. */ - private function check_stable_tag( Check_Result $result, string $readme_file, Parser $parser ) { + private function check_stable_tag( Check_Result $result, string $readme_file, $parser ) { $stable_tag = $parser->stable_tag; if ( empty( $stable_tag ) ) { @@ -468,7 +469,7 @@ private function check_stable_tag( Check_Result $result, string $readme_file, Pa * @param string $readme_file Readme file. * @param Parser $parser The Parser object. */ - private function check_upgrade_notice( Check_Result $result, string $readme_file, Parser $parser ) { + private function check_upgrade_notice( Check_Result $result, string $readme_file, $parser ) { $notices = $parser->upgrade_notice; $maximum_characters = 300; @@ -504,7 +505,7 @@ private function check_upgrade_notice( Check_Result $result, string $readme_file * * @SuppressWarnings(PHPMD.ExcessiveMethodLength) */ - private function check_for_warnings( Check_Result $result, string $readme_file, Parser $parser ) { + private function check_for_warnings( Check_Result $result, string $readme_file, $parser ) { $warnings = $parser->warnings ? $parser->warnings : array(); // This should be ERROR rather than WARNING. So ignoring here to handle separately. @@ -646,7 +647,7 @@ private function check_for_warnings( Check_Result $result, string $readme_file, * @param string $readme_file Readme file. * @param Parser $parser The Parser object. */ - private function check_for_donate_link( Check_Result $result, string $readme_file, Parser $parser ) { + private function check_for_donate_link( Check_Result $result, string $readme_file, $parser ) { $donate_link = $parser->donate_link; // Bail if empty donate link. @@ -800,7 +801,7 @@ function ( $value ) { * @param string $readme_file Readme file. * @param Parser $parser The Parser object. */ - private function check_requires_headers( Check_Result $result, string $readme_file, Parser $parser ) { + private function check_requires_headers( Check_Result $result, string $readme_file, $parser ) { $ignored_warnings = $this->get_ignored_warnings( $parser ); $found_warnings = $parser->warnings ? $parser->warnings : array(); @@ -861,7 +862,7 @@ private function check_requires_headers( Check_Result $result, string $readme_fi * @param Parser $parser The Parser object. * @return array Ignored warnings. */ - private function get_ignored_warnings( Parser $parser ) { + private function get_ignored_warnings( $parser ) { $ignored_warnings = array( 'contributor_ignored', ); From 8d937389c119b45106748acb626518ce5765bf36 Mon Sep 17 00:00:00 2001 From: Nilambar Sharma Date: Wed, 26 Feb 2025 13:56:27 +0545 Subject: [PATCH 07/30] Trying PHP above 8.2 --- .github/workflows/behat-test.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/behat-test.yml b/.github/workflows/behat-test.yml index 70a38b76e..45ab19e24 100644 --- a/.github/workflows/behat-test.yml +++ b/.github/workflows/behat-test.yml @@ -60,16 +60,13 @@ jobs: fail-fast: true matrix: php: - - '7.4' - - '8.0' - - '8.1' - '8.2' wordpress: [ 'latest' ] include: - php: '8.3' wordpress: 'latest' coverage: true - - php: '7.4' + - php: '8.2' wordpress: '6.3' - php: '8.4' wordpress: 'trunk' From 32e07e2ebb14d984dcb0e9fc5d5908b0bac3e97d Mon Sep 17 00:00:00 2001 From: Pascal Birchler Date: Wed, 26 Feb 2025 09:39:07 +0100 Subject: [PATCH 08/30] Revert "Trying PHP above 8.2" This reverts commit 8d937389c119b45106748acb626518ce5765bf36. --- .github/workflows/behat-test.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/behat-test.yml b/.github/workflows/behat-test.yml index 45ab19e24..70a38b76e 100644 --- a/.github/workflows/behat-test.yml +++ b/.github/workflows/behat-test.yml @@ -60,13 +60,16 @@ jobs: fail-fast: true matrix: php: + - '7.4' + - '8.0' + - '8.1' - '8.2' wordpress: [ 'latest' ] include: - php: '8.3' wordpress: 'latest' coverage: true - - php: '8.2' + - php: '7.4' wordpress: '6.3' - php: '8.4' wordpress: 'trunk' From 21579b6802c092be923b2d12c42e59dc72f5e864 Mon Sep 17 00:00:00 2001 From: Pascal Birchler Date: Wed, 26 Feb 2025 09:39:13 +0100 Subject: [PATCH 09/30] Revert "Update PHP array" This reverts commit ad55d6aec91e08a9c4c48820171e9f7f3c076fc0. --- .github/workflows/php-test.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/php-test.yml b/.github/workflows/php-test.yml index c0d0a13ca..34b80350d 100644 --- a/.github/workflows/php-test.yml +++ b/.github/workflows/php-test.yml @@ -48,10 +48,13 @@ jobs: fail-fast: true matrix: php: + - '7.4' + - '8.0' + - '8.1' - '8.2' wordpress: [ 'latest' ] include: - - php: '8.2' + - php: '7.4' wordpress: '6.3' - php: '8.3' wordpress: 'latest' @@ -75,7 +78,7 @@ jobs: composer-options: '--prefer-dist' - name: Setup PHP Scoper - working-directory: ./vendor-bin/php-scoper + working-directory: ./vendor-bin run: composer install - name: Setup Node.js (.nvmrc) From c804d92e84938f5ace94ba3a3513f64754f2339b Mon Sep 17 00:00:00 2001 From: Pascal Birchler Date: Wed, 26 Feb 2025 09:39:19 +0100 Subject: [PATCH 10/30] Revert "Update test steps" This reverts commit 79971311718250f077f623b4aa377a9729c8aa8e. --- .github/workflows/php-test.yml | 4 ---- vendor-bin/php-scoper/composer.lock | 16 ++++++++-------- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/.github/workflows/php-test.yml b/.github/workflows/php-test.yml index 34b80350d..b0bdeb10b 100644 --- a/.github/workflows/php-test.yml +++ b/.github/workflows/php-test.yml @@ -77,10 +77,6 @@ jobs: with: composer-options: '--prefer-dist' - - name: Setup PHP Scoper - working-directory: ./vendor-bin - run: composer install - - name: Setup Node.js (.nvmrc) uses: actions/setup-node@v4 with: diff --git a/vendor-bin/php-scoper/composer.lock b/vendor-bin/php-scoper/composer.lock index 26bf40d4a..a3801eebc 100644 --- a/vendor-bin/php-scoper/composer.lock +++ b/vendor-bin/php-scoper/composer.lock @@ -95,27 +95,27 @@ }, { "name": "fidry/filesystem", - "version": "1.2.3", + "version": "1.3.0", "source": { "type": "git", "url": "https://github.com/theofidry/filesystem.git", - "reference": "3e1f9cac40f807b7c4196013ab77cc1b9416e3e5" + "reference": "d0d9e8dfa43f7663da153c306b0d5bc24846ad8e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/theofidry/filesystem/zipball/3e1f9cac40f807b7c4196013ab77cc1b9416e3e5", - "reference": "3e1f9cac40f807b7c4196013ab77cc1b9416e3e5", + "url": "https://api.github.com/repos/theofidry/filesystem/zipball/d0d9e8dfa43f7663da153c306b0d5bc24846ad8e", + "reference": "d0d9e8dfa43f7663da153c306b0d5bc24846ad8e", "shasum": "" }, "require": { - "php": "^8.1", + "php": "^8.3", "symfony/filesystem": "^6.4 || ^7.0" }, "require-dev": { "bamarni/composer-bin-plugin": "^1.4", "ergebnis/composer-normalize": "^2.28", "infection/infection": ">=0.26", - "phpunit/phpunit": "^10.3", + "phpunit/phpunit": "^12", "symfony/finder": "^6.4 || ^7.0" }, "type": "library", @@ -149,7 +149,7 @@ ], "support": { "issues": "https://github.com/theofidry/filesystem/issues", - "source": "https://github.com/theofidry/filesystem/tree/1.2.3" + "source": "https://github.com/theofidry/filesystem/tree/1.3.0" }, "funding": [ { @@ -157,7 +157,7 @@ "type": "github" } ], - "time": "2025-02-13T22:58:51+00:00" + "time": "2025-02-13T23:05:19+00:00" }, { "name": "humbug/php-scoper", From 91016ccd2bbc7315e63f3036a3c017d98eac8034 Mon Sep 17 00:00:00 2001 From: Pascal Birchler Date: Wed, 26 Feb 2025 09:42:57 +0100 Subject: [PATCH 11/30] Switch PHP version on CI --- .github/workflows/behat-test.yml | 17 +++++++++++++++++ .github/workflows/php-lint.yml | 11 +++++++++++ .github/workflows/php-test.yml | 17 +++++++++++++++++ composer.json | 8 +------- 4 files changed, 46 insertions(+), 7 deletions(-) diff --git a/.github/workflows/behat-test.yml b/.github/workflows/behat-test.yml index 70a38b76e..2f61fe186 100644 --- a/.github/workflows/behat-test.yml +++ b/.github/workflows/behat-test.yml @@ -81,6 +81,19 @@ jobs: - name: Checkout uses: actions/checkout@v4 + - name: Setup PHP for PHP-Scoper + uses: shivammathur/setup-php@v2 + with: + tools: composer + php-version: 8.4 + coverage: none + + - name: Install PHP-Scoper + uses: ramsey/composer-install@57532f8be5bda426838819c5ee9afb8af389d51a + with: + working-directory: "vendor-bin/php-scoper" + composer-options: '--prefer-dist' + - name: Setup PHP uses: shivammathur/setup-php@v2 with: @@ -95,6 +108,10 @@ jobs: with: composer-options: '--prefer-dist' + - name: Prefix Composer dependencies + run: | + composer prefix-dependencies + - name: Make Composer packages available globally run: | echo "${PWD}/vendor/bin" >> $GITHUB_PATH diff --git a/.github/workflows/php-lint.yml b/.github/workflows/php-lint.yml index 677cea92c..eefd25a58 100644 --- a/.github/workflows/php-lint.yml +++ b/.github/workflows/php-lint.yml @@ -48,11 +48,22 @@ jobs: - name: Validate Composer configuration run: composer validate + - name: Install PHP-Scoper + uses: ramsey/composer-install@57532f8be5bda426838819c5ee9afb8af389d51a + with: + working-directory: "vendor-bin/php-scoper" + composer-options: '--prefer-dist' + + - name: Install PHP dependencies uses: ramsey/composer-install@57532f8be5bda426838819c5ee9afb8af389d51a with: composer-options: '--prefer-dist' + - name: Prefix Composer dependencies + run: | + composer prefix-dependencies + - name: PHP Lint run: composer lint diff --git a/.github/workflows/php-test.yml b/.github/workflows/php-test.yml index b0bdeb10b..cf72cf969 100644 --- a/.github/workflows/php-test.yml +++ b/.github/workflows/php-test.yml @@ -68,6 +68,19 @@ jobs: steps: - uses: actions/checkout@v4 + - name: Setup PHP for PHP-Scoper + uses: shivammathur/setup-php@v2 + with: + tools: composer + php-version: 8.4 + coverage: none + + - name: Install PHP-Scoper + uses: ramsey/composer-install@57532f8be5bda426838819c5ee9afb8af389d51a + with: + working-directory: "vendor-bin/php-scoper" + composer-options: '--prefer-dist' + - uses: shivammathur/setup-php@v2 with: php-version: ${{ matrix.php }} @@ -77,6 +90,10 @@ jobs: with: composer-options: '--prefer-dist' + - name: Prefix Composer dependencies + run: | + composer prefix-dependencies + - name: Setup Node.js (.nvmrc) uses: actions/setup-node@v4 with: diff --git a/composer.json b/composer.json index 3187f288e..e8fe3bbf1 100644 --- a/composer.json +++ b/composer.json @@ -67,7 +67,7 @@ "bamarni-bin": { "bin-links": false, "target-directory": "vendor-bin", - "forward-command": true + "forward-command": false } }, "scripts": { @@ -79,12 +79,6 @@ "phpstan": "phpstan analyse --memory-limit=2048M", "prepare-behat-tests": "install-package-tests", "test": "phpunit", - "post-install-cmd": [ - "@prefix-dependencies" - ], - "post-update-cmd": [ - "@prefix-dependencies" - ], "prefix-dependencies": [ "vendor-bin/php-scoper/vendor/bin/php-scoper add-prefix --output-dir=./vendor-prefixed --force --quiet", "echo '{ \"autoload\": { \"classmap\": [\"\"] } }' > ./vendor-prefixed/composer.json", From c264650e8910b18d83210e03c4b010f113771660 Mon Sep 17 00:00:00 2001 From: Pascal Birchler Date: Wed, 26 Feb 2025 09:50:01 +0100 Subject: [PATCH 12/30] Move around --- .github/workflows/behat-test.yml | 33 ++++++++++++++++++-------------- .github/workflows/php-lint.yml | 3 +-- .github/workflows/php-test.yml | 22 ++++++++++++--------- 3 files changed, 33 insertions(+), 25 deletions(-) diff --git a/.github/workflows/behat-test.yml b/.github/workflows/behat-test.yml index 2f61fe186..4bf0c0821 100644 --- a/.github/workflows/behat-test.yml +++ b/.github/workflows/behat-test.yml @@ -81,40 +81,45 @@ jobs: - name: Checkout uses: actions/checkout@v4 - - name: Setup PHP for PHP-Scoper + - name: Setup PHP uses: shivammathur/setup-php@v2 with: tools: composer - php-version: 8.4 - coverage: none + php-version: ${{ matrix.php }} - - name: Install PHP-Scoper + - name: Install PHP dependencies uses: ramsey/composer-install@57532f8be5bda426838819c5ee9afb8af389d51a with: - working-directory: "vendor-bin/php-scoper" composer-options: '--prefer-dist' - - name: Setup PHP + - name: Make Composer packages available globally + run: | + echo "${PWD}/vendor/bin" >> $GITHUB_PATH + + - name: Setup PHP for PHP-Scoper uses: shivammathur/setup-php@v2 with: - extensions: mysql tools: composer - php-version: ${{ matrix.php }} - coverage: ${{ matrix.coverage && 'xdebug' || 'none' }} - ini-values: pcov.directory=.,pcov.exclude=~(vendor|tests)~ + php-version: latest - - name: Install PHP dependencies + - name: Install PHP-Scoper uses: ramsey/composer-install@57532f8be5bda426838819c5ee9afb8af389d51a with: + working-directory: 'vendor-bin/php-scoper' composer-options: '--prefer-dist' - name: Prefix Composer dependencies run: | composer prefix-dependencies - - name: Make Composer packages available globally - run: | - echo "${PWD}/vendor/bin" >> $GITHUB_PATH + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + extensions: mysql + tools: composer + php-version: ${{ matrix.php }} + coverage: ${{ matrix.coverage && 'xdebug' || 'none' }} + ini-values: pcov.directory=.,pcov.exclude=~(vendor|tests)~ - name: Install WP-CLI run: | diff --git a/.github/workflows/php-lint.yml b/.github/workflows/php-lint.yml index eefd25a58..02e0e5ad2 100644 --- a/.github/workflows/php-lint.yml +++ b/.github/workflows/php-lint.yml @@ -51,10 +51,9 @@ jobs: - name: Install PHP-Scoper uses: ramsey/composer-install@57532f8be5bda426838819c5ee9afb8af389d51a with: - working-directory: "vendor-bin/php-scoper" + working-directory: 'vendor-bin/php-scoper' composer-options: '--prefer-dist' - - name: Install PHP dependencies uses: ramsey/composer-install@57532f8be5bda426838819c5ee9afb8af389d51a with: diff --git a/.github/workflows/php-test.yml b/.github/workflows/php-test.yml index cf72cf969..bbc0e7da5 100644 --- a/.github/workflows/php-test.yml +++ b/.github/workflows/php-test.yml @@ -68,6 +68,15 @@ jobs: steps: - uses: actions/checkout@v4 + - uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + + - name: Install PHP dependencies + uses: ramsey/composer-install@57532f8be5bda426838819c5ee9afb8af389d51a + with: + composer-options: '--prefer-dist' + - name: Setup PHP for PHP-Scoper uses: shivammathur/setup-php@v2 with: @@ -81,19 +90,14 @@ jobs: working-directory: "vendor-bin/php-scoper" composer-options: '--prefer-dist' - - uses: shivammathur/setup-php@v2 - with: - php-version: ${{ matrix.php }} - - - name: Install PHP dependencies - uses: ramsey/composer-install@57532f8be5bda426838819c5ee9afb8af389d51a - with: - composer-options: '--prefer-dist' - - name: Prefix Composer dependencies run: | composer prefix-dependencies + - uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + - name: Setup Node.js (.nvmrc) uses: actions/setup-node@v4 with: From 60f400e28ef8668d99a375799c1f3d43c1d55664 Mon Sep 17 00:00:00 2001 From: Pascal Birchler Date: Wed, 26 Feb 2025 09:52:40 +0100 Subject: [PATCH 13/30] Update lock file --- composer.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.lock b/composer.lock index e40ca11e2..2f0d7a1d6 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": "84c1b82cc8493a14f9c051db609d4cb8", + "content-hash": "7428c7ad97bb5b76d3415105df70ec89", "packages": [ { "name": "afragen/wordpress-plugin-readme-parser", From ebab021cda9f418d88d8f5fa4a2f55a341768f9f Mon Sep 17 00:00:00 2001 From: Pascal Birchler Date: Wed, 26 Feb 2025 09:53:52 +0100 Subject: [PATCH 14/30] Update readme parser package --- composer.json | 2 +- composer.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.json b/composer.json index e8fe3bbf1..b92d4fb83 100644 --- a/composer.json +++ b/composer.json @@ -6,7 +6,7 @@ "require": { "php": ">=7.4", "ext-json": "*", - "afragen/wordpress-plugin-readme-parser": "dev-master#c3758599348148be684b3c4ad1105d09b6230d51", + "afragen/wordpress-plugin-readme-parser": "dev-master", "automattic/vipwpcs": "^3.0.0", "composer/installers": "^2.2", "dealerdirect/phpcodesniffer-composer-installer": "^1.0.0", diff --git a/composer.lock b/composer.lock index 2f0d7a1d6..153ede50c 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": "7428c7ad97bb5b76d3415105df70ec89", + "content-hash": "5c23db7d9c2ddd1c421122f8b4311f00", "packages": [ { "name": "afragen/wordpress-plugin-readme-parser", @@ -12,12 +12,12 @@ "source": { "type": "git", "url": "https://github.com/afragen/wordpress-plugin-readme-parser.git", - "reference": "c3758599348148be684b3c4ad1105d09b6230d51" + "reference": "803ccfc442d956aa04d69f4b234eda5d7f03afc4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/afragen/wordpress-plugin-readme-parser/zipball/c3758599348148be684b3c4ad1105d09b6230d51", - "reference": "c3758599348148be684b3c4ad1105d09b6230d51", + "url": "https://api.github.com/repos/afragen/wordpress-plugin-readme-parser/zipball/803ccfc442d956aa04d69f4b234eda5d7f03afc4", + "reference": "803ccfc442d956aa04d69f4b234eda5d7f03afc4", "shasum": "" }, "require": { From 6a00213e642c34a99f3cc8e68862dbe30c6739cc Mon Sep 17 00:00:00 2001 From: Pascal Birchler Date: Wed, 26 Feb 2025 09:59:41 +0100 Subject: [PATCH 15/30] Fix PHPCS path --- includes/Checker/Checks/Abstract_PHP_CodeSniffer_Check.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/Checker/Checks/Abstract_PHP_CodeSniffer_Check.php b/includes/Checker/Checks/Abstract_PHP_CodeSniffer_Check.php index aedd7d93b..32d243f5b 100644 --- a/includes/Checker/Checks/Abstract_PHP_CodeSniffer_Check.php +++ b/includes/Checker/Checks/Abstract_PHP_CodeSniffer_Check.php @@ -69,7 +69,7 @@ abstract protected function get_args( Check_Result $result ); */ final public function run( Check_Result $result ) { // Include the PHPCS autoloader. - $autoloader = WP_PLUGIN_CHECK_PLUGIN_DIR_PATH . 'vendor_prefixed/squizlabs/php_codesniffer/autoload.php'; + $autoloader = WP_PLUGIN_CHECK_PLUGIN_DIR_PATH . 'vendor-prefixed/squizlabs/php_codesniffer/autoload.php'; if ( file_exists( $autoloader ) ) { include_once $autoloader; From 3862936ff6cccf05c4ec0b55d809a2dc44160d23 Mon Sep 17 00:00:00 2001 From: Pascal Birchler Date: Wed, 26 Feb 2025 10:01:22 +0100 Subject: [PATCH 16/30] PHPStan fixes --- .../Plugin_Repo/Plugin_Readme_Check.php | 54 +++++++++---------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/includes/Checker/Checks/Plugin_Repo/Plugin_Readme_Check.php b/includes/Checker/Checks/Plugin_Repo/Plugin_Readme_Check.php index a305b5397..014c1c0c3 100644 --- a/includes/Checker/Checks/Plugin_Repo/Plugin_Readme_Check.php +++ b/includes/Checker/Checks/Plugin_Repo/Plugin_Readme_Check.php @@ -122,9 +122,9 @@ protected function check_files( Check_Result $result, array $files ) { * * @since 1.0.0 * - * @param Check_Result $result The Check Result to amend. - * @param string $readme_file Readme file. - * @param Parser $parser The Parser object. + * @param Check_Result $result The Check Result to amend. + * @param string $readme_file Readme file. + * @param DotorgParser|PrefixedParser $parser The Parser object. */ private function check_name( Check_Result $result, string $readme_file, $parser ) { if ( isset( $parser->warnings['invalid_plugin_name_header'] ) && false === $parser->name ) { @@ -189,9 +189,9 @@ private function check_name( Check_Result $result, string $readme_file, $parser * * @since 1.0.2 * - * @param Check_Result $result The Check Result to amend. - * @param string $readme_file Readme file. - * @param Parser $parser The Parser object. + * @param Check_Result $result The Check Result to amend. + * @param string $readme_file Readme file. + * @param DotorgParser|PrefixedParser $parser The Parser object. */ private function check_headers( Check_Result $result, string $readme_file, $parser ) { $ignored_warnings = $this->get_ignored_warnings( $parser ); @@ -280,9 +280,9 @@ private function check_headers( Check_Result $result, string $readme_file, $pars * * @since 1.0.0 * - * @param Check_Result $result The Check Result to amend. - * @param string $readme_file Readme file. - * @param Parser $parser The Parser object. + * @param Check_Result $result The Check Result to amend. + * @param string $readme_file Readme file. + * @param DotorgParser|PrefixedParser $parser The Parser object. */ private function check_default_text( Check_Result $result, string $readme_file, $parser ) { $short_description = $parser->short_description; @@ -312,9 +312,9 @@ private function check_default_text( Check_Result $result, string $readme_file, * * @since 1.0.0 * - * @param Check_Result $result The Check Result to amend. - * @param string $readme_file Readme file. - * @param Parser $parser The Parser object. + * @param Check_Result $result The Check Result to amend. + * @param string $readme_file Readme file. + * @param DotorgParser|PrefixedParser $parser The Parser object. */ private function check_license( Check_Result $result, string $readme_file, $parser ) { $license = $parser->license; @@ -386,9 +386,9 @@ private function check_license( Check_Result $result, string $readme_file, $pars * * @since 1.0.0 * - * @param Check_Result $result The Check Result to amend. - * @param string $readme_file Readme file. - * @param Parser $parser The Parser object. + * @param Check_Result $result The Check Result to amend. + * @param string $readme_file Readme file. + * @param DotorgParser|PrefixedParser $parser The Parser object. */ private function check_stable_tag( Check_Result $result, string $readme_file, $parser ) { $stable_tag = $parser->stable_tag; @@ -465,9 +465,9 @@ private function check_stable_tag( Check_Result $result, string $readme_file, $p * * @since 1.0.2 * - * @param Check_Result $result The Check Result to amend. - * @param string $readme_file Readme file. - * @param Parser $parser The Parser object. + * @param Check_Result $result The Check Result to amend. + * @param string $readme_file Readme file. + * @param DotorgParser|PrefixedParser $parser The Parser object. */ private function check_upgrade_notice( Check_Result $result, string $readme_file, $parser ) { $notices = $parser->upgrade_notice; @@ -499,9 +499,9 @@ private function check_upgrade_notice( Check_Result $result, string $readme_file * * @since 1.0.0 * - * @param Check_Result $result The Check Result to amend. - * @param string $readme_file Readme file. - * @param Parser $parser The Parser object. + * @param Check_Result $result The Check Result to amend. + * @param string $readme_file Readme file. + * @param DotorgParser|PrefixedParser $parser The Parser object. * * @SuppressWarnings(PHPMD.ExcessiveMethodLength) */ @@ -643,9 +643,9 @@ private function check_for_warnings( Check_Result $result, string $readme_file, * * @since 1.3.0 * - * @param Check_Result $result The Check Result to amend. - * @param string $readme_file Readme file. - * @param Parser $parser The Parser object. + * @param Check_Result $result The Check Result to amend. + * @param string $readme_file Readme file. + * @param DotorgParser|PrefixedParser $parser The Parser object. */ private function check_for_donate_link( Check_Result $result, string $readme_file, $parser ) { $donate_link = $parser->donate_link; @@ -797,9 +797,9 @@ function ( $value ) { * * @since 1.5.0 * - * @param Check_Result $result The Check Result to amend. - * @param string $readme_file Readme file. - * @param Parser $parser The Parser object. + * @param Check_Result $result The Check Result to amend. + * @param string $readme_file Readme file. + * @param DotorgParser|PrefixedParser $parser The Parser object. */ private function check_requires_headers( Check_Result $result, string $readme_file, $parser ) { $ignored_warnings = $this->get_ignored_warnings( $parser ); From e19f545e122dbacd8777681f4140cb0380eb896f Mon Sep 17 00:00:00 2001 From: Pascal Birchler Date: Wed, 26 Feb 2025 10:03:34 +0100 Subject: [PATCH 17/30] Another PHPStan fix --- includes/Checker/Checks/Plugin_Repo/Plugin_Readme_Check.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/includes/Checker/Checks/Plugin_Repo/Plugin_Readme_Check.php b/includes/Checker/Checks/Plugin_Repo/Plugin_Readme_Check.php index 014c1c0c3..9b63c427d 100644 --- a/includes/Checker/Checks/Plugin_Repo/Plugin_Readme_Check.php +++ b/includes/Checker/Checks/Plugin_Repo/Plugin_Readme_Check.php @@ -859,7 +859,7 @@ private function check_requires_headers( Check_Result $result, string $readme_fi * * @since 1.0.2 * - * @param Parser $parser The Parser object. + * @param DotorgParser|PrefixedParser $parser The Parser object. * @return array Ignored warnings. */ private function get_ignored_warnings( $parser ) { @@ -872,8 +872,8 @@ private function get_ignored_warnings( $parser ) { * * @since 1.0.2 * - * @param array $ignored_warnings Array of ignored warning keys. - * @param Parser $parser The Parser object. + * @param array $ignored_warnings Array of ignored warning keys. + * @param DotorgParser|PrefixedParser $parser The Parser object. */ $ignored_warnings = (array) apply_filters( 'wp_plugin_check_ignored_readme_warnings', $ignored_warnings, $parser ); From 8488febb2bbf0c3823a793b2eb8da7cf2d9049cc Mon Sep 17 00:00:00 2001 From: Pascal Birchler Date: Wed, 26 Feb 2025 10:25:02 +0100 Subject: [PATCH 18/30] Prefix more dependencies --- scoper.inc.php | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/scoper.inc.php b/scoper.inc.php index 9c41ed481..45f7ede83 100644 --- a/scoper.inc.php +++ b/scoper.inc.php @@ -39,6 +39,35 @@ ) ), + // WordPress coding standards. + Finder::create() + ->files() + ->ignoreVCS( true ) + ->ignoreDotFiles( true ) + ->name( + array( + '*.php', + 'ruleset.xml' + ) + ) + ->in( 'vendor/wp-coding-standards/wpcs' ) + ->append( array( 'vendor/wp-coding-standards/wpcs/composer.json' ) ), + + // VIP coding standards. + Finder::create() + ->files() + ->ignoreVCS( true ) + ->ignoreDotFiles( true ) + ->name( + array( + '*.php', + 'ruleset.xml' + ) + ) + ->notName( '*-test.php' ) + ->in( 'vendor/automattic/vipwpcs' ) + ->append( array( 'vendor/automattic/vipwpcs/composer.json' ) ), + // Plugin Check custom PHPCS sniffs. Finder::create() ->files() From b24341218a17e3b2640b7846547eb0573ca6317c Mon Sep 17 00:00:00 2001 From: Pascal Birchler Date: Wed, 26 Feb 2025 11:04:41 +0100 Subject: [PATCH 19/30] Fix autoloader path --- includes/Checker/Checks/Abstract_PHP_CodeSniffer_Check.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/Checker/Checks/Abstract_PHP_CodeSniffer_Check.php b/includes/Checker/Checks/Abstract_PHP_CodeSniffer_Check.php index 32d243f5b..f46e9f985 100644 --- a/includes/Checker/Checks/Abstract_PHP_CodeSniffer_Check.php +++ b/includes/Checker/Checks/Abstract_PHP_CodeSniffer_Check.php @@ -69,7 +69,7 @@ abstract protected function get_args( Check_Result $result ); */ final public function run( Check_Result $result ) { // Include the PHPCS autoloader. - $autoloader = WP_PLUGIN_CHECK_PLUGIN_DIR_PATH . 'vendor-prefixed/squizlabs/php_codesniffer/autoload.php'; + $autoloader = WP_PLUGIN_CHECK_PLUGIN_DIR_PATH . 'vendor-prefixed/vendor/squizlabs/php_codesniffer/autoload.php'; if ( file_exists( $autoloader ) ) { include_once $autoloader; From 7601690258c5e39b3df4ed9e4cf96875173e33cc Mon Sep 17 00:00:00 2001 From: Pascal Birchler Date: Wed, 26 Feb 2025 11:04:47 +0100 Subject: [PATCH 20/30] Make debugging a bit easier --- .../Checks/Abstract_PHP_CodeSniffer_Check.php | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/includes/Checker/Checks/Abstract_PHP_CodeSniffer_Check.php b/includes/Checker/Checks/Abstract_PHP_CodeSniffer_Check.php index f46e9f985..41d960e23 100644 --- a/includes/Checker/Checks/Abstract_PHP_CodeSniffer_Check.php +++ b/includes/Checker/Checks/Abstract_PHP_CodeSniffer_Check.php @@ -114,7 +114,7 @@ final public function run( Check_Result $result ) { ob_start(); $runner = new Runner(); $runner->runPHPCS(); - $reports = ob_get_clean(); + $output = ob_get_clean(); } catch ( Exception $e ) { $_SERVER['argv'] = $orig_cmd_args; throw $e; @@ -127,7 +127,18 @@ final public function run( Check_Result $result ) { $_SERVER['argv'] = $orig_cmd_args; // Parse the reports into data to add to the overall $result. - $reports = json_decode( trim( $reports ), true ); + $reports = json_decode( trim( $output ), true ); + + // Make debugging a bit easier. + if ( null === $reports ) { + throw new Exception( + sprintf( + /* translators: %s: PHPCS output. */ + __( 'Unexpected output by PHPCS: %s', 'plugin-check' ), + $output + ) + ); + } if ( empty( $reports['files'] ) ) { return; From 4e1aed7bd68e27e0ef0ff1a16ec0b94fb9dab449 Mon Sep 17 00:00:00 2001 From: Pascal Birchler Date: Wed, 26 Feb 2025 11:28:36 +0100 Subject: [PATCH 21/30] Try excluding PHPCS autoloader from classmap --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index b92d4fb83..d9d6dc338 100644 --- a/composer.json +++ b/composer.json @@ -81,7 +81,7 @@ "test": "phpunit", "prefix-dependencies": [ "vendor-bin/php-scoper/vendor/bin/php-scoper add-prefix --output-dir=./vendor-prefixed --force --quiet", - "echo '{ \"autoload\": { \"classmap\": [\"\"] } }' > ./vendor-prefixed/composer.json", + "echo '{ \"autoload\": { \"classmap\": [\"\"], \"exclude-from-classmap\": [\"vendor\\/squizlabs\\/php_codesniffer\\/autoload.php\"] } }' > ./vendor-prefixed/composer.json", "@composer dump-autoload --working-dir ./vendor-prefixed --no-dev --classmap-authoritative", "sed -i'.bak' -e 's/Composer\\\\Autoload/Plugin_Check_Composer\\\\Autoload/' vendor-prefixed/vendor/composer/*.php && rm -rf vendor-prefixed/vendor/composer/*.php.bak", "echo '{ \"autoload\": { \"classmap\": [\"\"] } }' > ./includes/composer.json", From 9142c4b87e70b88e1987771f7c37bda26dfd4f2b Mon Sep 17 00:00:00 2001 From: Pascal Birchler Date: Wed, 26 Feb 2025 11:28:43 +0100 Subject: [PATCH 22/30] Remove file_exists check --- includes/Checker/Checks/Abstract_PHP_CodeSniffer_Check.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/includes/Checker/Checks/Abstract_PHP_CodeSniffer_Check.php b/includes/Checker/Checks/Abstract_PHP_CodeSniffer_Check.php index 41d960e23..68004cd0f 100644 --- a/includes/Checker/Checks/Abstract_PHP_CodeSniffer_Check.php +++ b/includes/Checker/Checks/Abstract_PHP_CodeSniffer_Check.php @@ -71,9 +71,7 @@ final public function run( Check_Result $result ) { // Include the PHPCS autoloader. $autoloader = WP_PLUGIN_CHECK_PLUGIN_DIR_PATH . 'vendor-prefixed/vendor/squizlabs/php_codesniffer/autoload.php'; - if ( file_exists( $autoloader ) ) { - include_once $autoloader; - } + include_once $autoloader; if ( ! class_exists( Runner::class ) ) { throw new Exception( From 46645a2a75d084d2b5da2d3b44f308aab60eba3e Mon Sep 17 00:00:00 2001 From: Pascal Birchler Date: Wed, 26 Feb 2025 11:28:50 +0100 Subject: [PATCH 23/30] Update scoper config --- scoper.inc.php | 73 ++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 53 insertions(+), 20 deletions(-) diff --git a/scoper.inc.php b/scoper.inc.php index 45f7ede83..d89be2d2f 100644 --- a/scoper.inc.php +++ b/scoper.inc.php @@ -15,12 +15,19 @@ // See: https://github.com/humbug/php-scoper#finders-and-paths. 'finders' => array( - // PHP_CodeSniffer + // PHP_CodeSniffer. Finder::create() ->files() ->ignoreVCS( true ) ->ignoreDotFiles( true ) - ->name( '*.php' ) + ->name( + array( + '*.php', + 'ruleset.xml', + 'CodeSniffer.conf', + 'composer.json', + ) + ) ->exclude( array( 'bin', @@ -31,14 +38,32 @@ array( 'vendor/squizlabs/php_codesniffer', ) - ) - ->append( - array( - 'vendor/squizlabs/php_codesniffer/CodeSniffer.conf', - 'vendor/squizlabs/php_codesniffer/composer.json', - ) ), + // PHPCS Utils required by other sniffs. + Finder::create() + ->files() + ->ignoreVCS( true ) + ->ignoreDotFiles( true ) + ->name( + array( + '*.php', + 'ruleset.xml', + 'composer.json', + ) + ) + ->exclude( + array( + 'bin', + 'tests', + ) + ) + ->in( + array( + 'vendor/phpcsstandards', + ) + ), + // WordPress coding standards. Finder::create() ->files() @@ -47,11 +72,11 @@ ->name( array( '*.php', - 'ruleset.xml' + 'ruleset.xml', + 'composer.json', ) ) - ->in( 'vendor/wp-coding-standards/wpcs' ) - ->append( array( 'vendor/wp-coding-standards/wpcs/composer.json' ) ), + ->in( 'vendor/wp-coding-standards/wpcs' ), // VIP coding standards. Finder::create() @@ -61,19 +86,24 @@ ->name( array( '*.php', - 'ruleset.xml' + 'ruleset.xml', + 'composer.json', ) ) ->notName( '*-test.php' ) - ->in( 'vendor/automattic/vipwpcs' ) - ->append( array( 'vendor/automattic/vipwpcs/composer.json' ) ), + ->in( 'vendor/automattic/vipwpcs' ), // Plugin Check custom PHPCS sniffs. Finder::create() ->files() ->ignoreVCS( true ) ->ignoreDotFiles( true ) - ->name( '*.php' ) + ->name( + array( + '*.php', + 'composer.json', + ) + ) ->exclude( array( 'build', @@ -81,17 +111,20 @@ 'vendor', ) ) - ->in( 'vendor/plugin-check/phpcs-sniffs' ) - ->append( array( 'vendor/plugin-check/phpcs-sniffs/composer.json' ) ), + ->in( 'vendor/plugin-check/phpcs-sniffs' ), // WordPress plugin readme parser. Finder::create() ->files() ->ignoreVCS( true ) ->ignoreDotFiles( true ) - ->name( '*.php' ) - ->in( 'vendor/afragen/wordpress-plugin-readme-parser' ) - ->append( array( 'vendor/afragen/wordpress-plugin-readme-parser/composer.json' ) ), + ->name( + array( + '*.php', + 'composer.json', + ) + ) + ->in( 'vendor/afragen/wordpress-plugin-readme-parser' ), // Main composer.json file so that we can build a classmap. Finder::create() From 143afd2c1ec2750c77b3bf773b320530e0ee0d73 Mon Sep 17 00:00:00 2001 From: Pascal Birchler Date: Wed, 26 Feb 2025 18:00:04 +0100 Subject: [PATCH 24/30] Add patchers to fix namespace issues --- composer.json | 5 +- .../Checks/Abstract_PHP_CodeSniffer_Check.php | 2 +- scoper.inc.php | 55 ++++++++++++++++++- 3 files changed, 57 insertions(+), 5 deletions(-) diff --git a/composer.json b/composer.json index d9d6dc338..ce6d5620d 100644 --- a/composer.json +++ b/composer.json @@ -81,9 +81,10 @@ "test": "phpunit", "prefix-dependencies": [ "vendor-bin/php-scoper/vendor/bin/php-scoper add-prefix --output-dir=./vendor-prefixed --force --quiet", - "echo '{ \"autoload\": { \"classmap\": [\"\"], \"exclude-from-classmap\": [\"vendor\\/squizlabs\\/php_codesniffer\\/autoload.php\"] } }' > ./vendor-prefixed/composer.json", + "echo '{ \"autoload\": { \"classmap\": [\"\"], \"exclude-from-classmap\": [\"vendor\\/squizlabs//\"] } }' > ./vendor-prefixed/composer.json", "@composer dump-autoload --working-dir ./vendor-prefixed --no-dev --classmap-authoritative", - "sed -i'.bak' -e 's/Composer\\\\Autoload/Plugin_Check_Composer\\\\Autoload/' vendor-prefixed/vendor/composer/*.php && rm -rf vendor-prefixed/vendor/composer/*.php.bak", + "sed -i'.bak' -e 's/Composer\\\\Autoload/Plugin_Check_Composer\\\\Autoload/' vendor-prefixed/vendor/composer/*.php", + "rm -rf vendor-prefixed/vendor/composer/*.php.bak", "echo '{ \"autoload\": { \"classmap\": [\"\"] } }' > ./includes/composer.json", "@composer dump-autoload --working-dir ./includes --no-dev --classmap-authoritative", "sed -i'.bak' -e 's/Composer\\\\Autoload/Plugin_Check_Composer\\\\Autoload/' includes/vendor/composer/*.php && rm -rf includes/vendor/composer/*.php.bak" diff --git a/includes/Checker/Checks/Abstract_PHP_CodeSniffer_Check.php b/includes/Checker/Checks/Abstract_PHP_CodeSniffer_Check.php index 68004cd0f..8752fff7d 100644 --- a/includes/Checker/Checks/Abstract_PHP_CodeSniffer_Check.php +++ b/includes/Checker/Checks/Abstract_PHP_CodeSniffer_Check.php @@ -204,7 +204,7 @@ private function get_argv_defaults( Check_Result $result ): array { $defaults = array( '', $result->plugin()->location(), - '--report=Json', + '--report=WordPress\Plugin_Check\Vendor\PHP_CodeSniffer\Reports\Json', '--report-width=9999', ); diff --git a/scoper.inc.php b/scoper.inc.php index d89be2d2f..03ca5c620 100644 --- a/scoper.inc.php +++ b/scoper.inc.php @@ -11,10 +11,10 @@ use Isolated\Symfony\Component\Finder\Finder; return array( - 'prefix' => 'WordPress\\Plugin_Check\\Vendor', + 'prefix' => 'WordPress\\Plugin_Check\\Vendor', // See: https://github.com/humbug/php-scoper#finders-and-paths. - 'finders' => array( + 'finders' => array( // PHP_CodeSniffer. Finder::create() ->files() @@ -93,6 +93,20 @@ ->notName( '*-test.php' ) ->in( 'vendor/automattic/vipwpcs' ), + // VariableAnalysis is used by WPCS. + Finder::create() + ->files() + ->ignoreVCS( true ) + ->ignoreDotFiles( true ) + ->name( + array( + '*.php', + 'ruleset.xml', + 'composer.json', + ) + ) + ->in( 'vendor/sirbrillig/phpcs-variable-analysis' ), + // Plugin Check custom PHPCS sniffs. Finder::create() ->files() @@ -101,6 +115,7 @@ ->name( array( '*.php', + 'ruleset.xml', 'composer.json', ) ) @@ -130,4 +145,40 @@ Finder::create() ->append( array( 'composer.json' ) ), ), + + 'patchers' => array( + static function ( string $file_path, string $prefix, string $content ) { + if ( str_ends_with( $file_path, 'vendor/squizlabs/php_codesniffer/autoload.php' ) ) { + $content = str_replace( + 'substr($class, 0, 16) === \'PHP_CodeSniffer\\', + 'substr($class, 0, 46) === \'WordPress\Plugin_Check\Vendor\PHP_CodeSniffer\\', + $content + ); + + $content = str_replace( + 'substr(str_replace(\'\\\\\', $ds, $class), 16)', + 'substr(str_replace(\'\\\\\', $ds, $class), 46)', + $content + ); + } + + if ( str_ends_with( $file_path, 'vendor/squizlabs/php_codesniffer/src/Files/File.php' ) ) { + $content = str_replace( + 'PHP_CodeSniffer\Tokenizers\\', + 'WordPress\Plugin_Check\Vendor\PHP_CodeSniffer\Tokenizers\\', + $content + ); + } + + if ( str_ends_with( $file_path, 'vendor/squizlabs/php_codesniffer/src/Standards/PEAR/Sniffs/Commenting/FileCommentSniff.php' ) ) { + $content = str_replace( + 'PHP_CodeSniffer\Standards\PEAR\Sniffs\Commenting\FileCommentSniff', + 'WordPress\Plugin_Check\Vendor\PHP_CodeSniffer\Standards\PEAR\Sniffs\Commenting\FileCommentSniff', + $content + ); + } + + return $content; + }, + ), ); From 40e83607e85d273496983ed43c9fbc23654d5c21 Mon Sep 17 00:00:00 2001 From: Pascal Birchler Date: Thu, 27 Feb 2025 09:36:59 +0100 Subject: [PATCH 25/30] Set WP_DEBUG for Behat tests --- tests/behat/includes/FeatureContext.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/behat/includes/FeatureContext.php b/tests/behat/includes/FeatureContext.php index a320fbb86..38d361700 100644 --- a/tests/behat/includes/FeatureContext.php +++ b/tests/behat/includes/FeatureContext.php @@ -71,6 +71,8 @@ public static function forget_feature( AfterFeatureScope $scope ) { */ public function given_a_wp_installation_with_plugin_check() { $this->install_wp(); + $this->proc( 'wp config set WP_DEBUG true --raw' )->run_check(); + $this->proc( 'wp config set WP_DEBUG_DISPLAY true --raw' )->run_check(); // Symlink the current project folder into the WP folder as a plugin. $project_dir = realpath( self::get_vendor_dir() . '/../' ); From d48d8428141bb215038be965ce043d58b5a87e36 Mon Sep 17 00:00:00 2001 From: Pascal Birchler Date: Thu, 27 Feb 2025 09:51:56 +0100 Subject: [PATCH 26/30] Try verbose phpunit output --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 9d586afe5..c36ba4b12 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ "phpstan": "wp-env run tests-cli --env-cwd=wp-content/plugins/$(basename \"$(pwd)\")/ composer run-script phpstan", "lint-php": "wp-env run tests-cli --env-cwd=wp-content/plugins/$(basename \"$(pwd)\")/ composer run-script lint", "format-php": "wp-env run tests-cli --env-cwd=wp-content/plugins/$(basename \"$(pwd)\")/ composer run-script format", - "test-php": "wp-env run tests-cli --env-cwd=/var/www/html/wp-content/plugins/$(basename \"$(pwd)\") vendor/bin/phpunit -c phpunit.xml.dist", + "test-php": "wp-env run tests-cli --env-cwd=/var/www/html/wp-content/plugins/$(basename \"$(pwd)\") vendor/bin/phpunit -c phpunit.xml.dist --debug", "test-php-coverage": "wp-env run tests-cli --env-cwd=/var/www/html/wp-content/plugins/$(basename \"$(pwd)\") vendor/bin/phpunit -c phpunit.xml.dist --coverage-clover build/logs/php-coverage.xml", "test-php-multisite": "wp-env run tests-cli --env-cwd=/var/www/html/wp-content/plugins/$(basename \"$(pwd)\") vendor/bin/phpunit -c tests/phpunit/multisite.xml", "test-php-multisite-coverage": "wp-env run tests-cli --env-cwd=/var/www/html/wp-content/plugins/$(basename \"$(pwd)\") vendor/bin/phpunit -c tests/phpunit/multisite.xml --coverage-clover build/logs/php-coverage-multisite.xml" From 00cb4c871ddbbd32d470acb62f28772b638d7b44 Mon Sep 17 00:00:00 2001 From: Pascal Birchler Date: Thu, 27 Feb 2025 09:57:35 +0100 Subject: [PATCH 27/30] Try php-error.php drop-in for Behat --- tests/behat/includes/FeatureContext.php | 5 +++++ tests/behat/includes/php-error.php | 8 ++++++++ 2 files changed, 13 insertions(+) create mode 100644 tests/behat/includes/php-error.php diff --git a/tests/behat/includes/FeatureContext.php b/tests/behat/includes/FeatureContext.php index 38d361700..3ec283b65 100644 --- a/tests/behat/includes/FeatureContext.php +++ b/tests/behat/includes/FeatureContext.php @@ -74,6 +74,10 @@ public function given_a_wp_installation_with_plugin_check() { $this->proc( 'wp config set WP_DEBUG true --raw' )->run_check(); $this->proc( 'wp config set WP_DEBUG_DISPLAY true --raw' )->run_check(); + $wp_content = $this->variables['RUN_DIR'] . '/wp-content'; + $php_error_drop_in = __DIR__ . '/php-error.php'; + $this->proc( "ln -s {$php_error_drop_in} {$wp_content}/php-error.php" )->run_check(); + // Symlink the current project folder into the WP folder as a plugin. $project_dir = realpath( self::get_vendor_dir() . '/../' ); $plugin_dir = $this->variables['RUN_DIR'] . '/wp-content/plugins'; @@ -83,6 +87,7 @@ public function given_a_wp_installation_with_plugin_check() { // Activate the plugin. $this->proc( 'wp plugin activate plugin-check' )->run_check(); } + /** * @Given a Plugin Check add-on being installed */ diff --git a/tests/behat/includes/php-error.php b/tests/behat/includes/php-error.php new file mode 100644 index 000000000..a9513c64e --- /dev/null +++ b/tests/behat/includes/php-error.php @@ -0,0 +1,8 @@ + Date: Thu, 27 Feb 2025 10:12:33 +0100 Subject: [PATCH 28/30] double dash --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index c36ba4b12..a1a29cd16 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ "phpstan": "wp-env run tests-cli --env-cwd=wp-content/plugins/$(basename \"$(pwd)\")/ composer run-script phpstan", "lint-php": "wp-env run tests-cli --env-cwd=wp-content/plugins/$(basename \"$(pwd)\")/ composer run-script lint", "format-php": "wp-env run tests-cli --env-cwd=wp-content/plugins/$(basename \"$(pwd)\")/ composer run-script format", - "test-php": "wp-env run tests-cli --env-cwd=/var/www/html/wp-content/plugins/$(basename \"$(pwd)\") vendor/bin/phpunit -c phpunit.xml.dist --debug", + "test-php": "wp-env run tests-cli --env-cwd=/var/www/html/wp-content/plugins/$(basename \"$(pwd)\") vendor/bin/phpunit -c phpunit.xml.dist -- --debug", "test-php-coverage": "wp-env run tests-cli --env-cwd=/var/www/html/wp-content/plugins/$(basename \"$(pwd)\") vendor/bin/phpunit -c phpunit.xml.dist --coverage-clover build/logs/php-coverage.xml", "test-php-multisite": "wp-env run tests-cli --env-cwd=/var/www/html/wp-content/plugins/$(basename \"$(pwd)\") vendor/bin/phpunit -c tests/phpunit/multisite.xml", "test-php-multisite-coverage": "wp-env run tests-cli --env-cwd=/var/www/html/wp-content/plugins/$(basename \"$(pwd)\") vendor/bin/phpunit -c tests/phpunit/multisite.xml --coverage-clover build/logs/php-coverage-multisite.xml" From cbf4ff29c1bc74b570e1a754399e492bef4bc83b Mon Sep 17 00:00:00 2001 From: Pascal Birchler Date: Thu, 27 Feb 2025 10:31:14 +0100 Subject: [PATCH 29/30] Exclude vipwpcs from classmap --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index ce6d5620d..2e40b7838 100644 --- a/composer.json +++ b/composer.json @@ -81,7 +81,7 @@ "test": "phpunit", "prefix-dependencies": [ "vendor-bin/php-scoper/vendor/bin/php-scoper add-prefix --output-dir=./vendor-prefixed --force --quiet", - "echo '{ \"autoload\": { \"classmap\": [\"\"], \"exclude-from-classmap\": [\"vendor\\/squizlabs//\"] } }' > ./vendor-prefixed/composer.json", + "echo '{ \"autoload\": { \"classmap\": [\"\"], \"exclude-from-classmap\": [\"vendor\\/squizlabs//\", \"vendor\\/automattic//\"] } }' > ./vendor-prefixed/composer.json", "@composer dump-autoload --working-dir ./vendor-prefixed --no-dev --classmap-authoritative", "sed -i'.bak' -e 's/Composer\\\\Autoload/Plugin_Check_Composer\\\\Autoload/' vendor-prefixed/vendor/composer/*.php", "rm -rf vendor-prefixed/vendor/composer/*.php.bak", From 93b777d79f4dbb7f6ffef25cbf8955c705217de5 Mon Sep 17 00:00:00 2001 From: Pascal Birchler Date: Thu, 27 Feb 2025 11:22:36 +0100 Subject: [PATCH 30/30] Remove debug flag --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index a1a29cd16..9d586afe5 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ "phpstan": "wp-env run tests-cli --env-cwd=wp-content/plugins/$(basename \"$(pwd)\")/ composer run-script phpstan", "lint-php": "wp-env run tests-cli --env-cwd=wp-content/plugins/$(basename \"$(pwd)\")/ composer run-script lint", "format-php": "wp-env run tests-cli --env-cwd=wp-content/plugins/$(basename \"$(pwd)\")/ composer run-script format", - "test-php": "wp-env run tests-cli --env-cwd=/var/www/html/wp-content/plugins/$(basename \"$(pwd)\") vendor/bin/phpunit -c phpunit.xml.dist -- --debug", + "test-php": "wp-env run tests-cli --env-cwd=/var/www/html/wp-content/plugins/$(basename \"$(pwd)\") vendor/bin/phpunit -c phpunit.xml.dist", "test-php-coverage": "wp-env run tests-cli --env-cwd=/var/www/html/wp-content/plugins/$(basename \"$(pwd)\") vendor/bin/phpunit -c phpunit.xml.dist --coverage-clover build/logs/php-coverage.xml", "test-php-multisite": "wp-env run tests-cli --env-cwd=/var/www/html/wp-content/plugins/$(basename \"$(pwd)\") vendor/bin/phpunit -c tests/phpunit/multisite.xml", "test-php-multisite-coverage": "wp-env run tests-cli --env-cwd=/var/www/html/wp-content/plugins/$(basename \"$(pwd)\") vendor/bin/phpunit -c tests/phpunit/multisite.xml --coverage-clover build/logs/php-coverage-multisite.xml"