From 53ca0bbed6f76a5f370d9d0f24bcac3ac535e493 Mon Sep 17 00:00:00 2001 From: Nathanael Esayeas Date: Wed, 22 Apr 2026 11:01:07 -0500 Subject: [PATCH 1/4] Normalize composer.json file Reformat and normalize `composer.json`. Add `@phpunit` and `@xdebug` scripts (setting `XDEBUG_MODE=coverage`) and update test scripts to enable coverage in future PRs. Signed-off-by: Nathanael Esayeas --- composer.json | 96 +++++++++++++++++++++++++++++++-------------------- 1 file changed, 58 insertions(+), 38 deletions(-) diff --git a/composer.json b/composer.json index ecdea01..7ced91b 100644 --- a/composer.json +++ b/composer.json @@ -1,46 +1,55 @@ { - "name" : "phpcsstandards/phpcsdevtools", - "description" : "Tools for PHP_CodeSniffer sniff developers.", - "type" : "phpcodesniffer-standard", - "keywords" : [ "phpcs", "devtools", "debug", "dev", "static analysis", "php_codesniffer", "phpcodesniffer-standard" ], - "homepage": "https://phpcsstandards.github.io/PHPCSDevTools/", - "license" : "LGPL-3.0-or-later", - "authors" : [ + "name": "phpcsstandards/phpcsdevtools", + "description": "Tools for PHP_CodeSniffer sniff developers.", + "license": "LGPL-3.0-or-later", + "type": "phpcodesniffer-standard", + "keywords": [ + "phpcs", + "devtools", + "debug", + "dev", + "static analysis", + "php_codesniffer", + "phpcodesniffer-standard" + ], + "authors": [ { - "name" : "Juliette Reinders Folmer", - "role" : "lead", - "homepage" : "https://github.com/jrfnl" + "name": "Juliette Reinders Folmer", + "homepage": "https://github.com/jrfnl", + "role": "lead" }, { - "name" : "Contributors", - "homepage" : "https://github.com/PHPCSStandards/PHPCSDevTools/graphs/contributors" + "name": "Contributors", + "homepage": "https://github.com/PHPCSStandards/PHPCSDevTools/graphs/contributors" } ], - "support" : { - "issues" : "https://github.com/PHPCSStandards/PHPCSDevTools/issues", - "source" : "https://github.com/PHPCSStandards/PHPCSDevTools", + "homepage": "https://phpcsstandards.github.io/PHPCSDevTools/", + "support": { + "issues": "https://github.com/PHPCSStandards/PHPCSDevTools/issues", + "source": "https://github.com/PHPCSStandards/PHPCSDevTools", "security": "https://github.com/PHPCSStandards/PHPCSDevTools/security/policy" }, - "require" : { - "php" : ">=5.4", - "squizlabs/php_codesniffer" : "^3.1.0 || ^4.0", - "dealerdirect/phpcodesniffer-composer-installer" : "^0.4.1 || ^0.5 || ^0.6.2 || ^0.7 || ^1.0" + "require": { + "php": ">=5.4", + "dealerdirect/phpcodesniffer-composer-installer": "^0.4.1 || ^0.5 || ^0.6.2 || ^0.7 || ^1.0", + "squizlabs/php_codesniffer": "^3.1.0 || ^4.0" }, - "require-dev" : { - "phpunit/phpunit" : "^4.8.36 || ^5.7.21 || ^6.0 || ^7.0 || ^8.0 || ^9.0 || ^10.5.32 || ^11.3.3", - "php-parallel-lint/php-parallel-lint": "^1.4.0", + "require-dev": { "php-parallel-lint/php-console-highlighter": "^1.0.0", + "php-parallel-lint/php-parallel-lint": "^1.4.0", "phpcsstandards/phpcsdevcs": "^1.2.0", - "phpcsstandards/phpcsutils" : "^1.0", + "phpcsstandards/phpcsutils": "^1.0", + "phpunit/phpunit": "^4.8.36 || ^5.7.21 || ^6.0 || ^7.0 || ^8.0 || ^9.0 || ^10.5.32 || ^11.3.3", "yoast/phpunit-polyfills": "^1.1 || ^2.0 || ^3.0" }, - "config": { - "allow-plugins": { - "dealerdirect/phpcodesniffer-composer-installer": true - }, - "lock": false + "minimum-stability": "dev", + "prefer-stable": true, + "autoload": { + "psr-4": { + "PHPCSDevTools\\Scripts\\": "Scripts/" + } }, - "autoload-dev" : { + "autoload-dev": { "psr-4": { "PHPCSDevTools\\Tests\\": "Tests/" } @@ -48,9 +57,13 @@ "bin": [ "bin/phpcs-check-feature-completeness" ], - "minimum-stability": "dev", - "prefer-stable": true, - "scripts" : { + "config": { + "allow-plugins": { + "dealerdirect/phpcodesniffer-composer-installer": true + }, + "lock": false + }, + "scripts": { "lint": [ "@php ./vendor/php-parallel-lint/php-parallel-lint/parallel-lint . -e php --show-deprecated --exclude vendor --exclude .git" ], @@ -64,25 +77,32 @@ "@php ./vendor/squizlabs/php_codesniffer/bin/phpcbf" ], "test": [ - "@php ./vendor/phpunit/phpunit/phpunit" + "@phpunit" ], "test-sniff": [ - "@php ./vendor/phpunit/phpunit/phpunit --testsuite DebugSniff" + "@phpunit --testsuite DebugSniff" ], "test-tools": [ - "@php ./vendor/phpunit/phpunit/phpunit --testsuite DevTools" + "@phpunit --testsuite DevTools" ], "test-lte9": [ - "@php ./vendor/phpunit/phpunit/phpunit -c phpunitlte9.xml.dist" + "@phpunit -c phpunitlte9.xml.dist" ], "test-sniff-lte9": [ - "@php ./vendor/phpunit/phpunit/phpunit -c phpunitlte9.xml.dist --testsuite DebugSniff" + "@phpunit -c phpunitlte9.xml.dist --testsuite DebugSniff" ], "test-tools-lte9": [ - "@php ./vendor/phpunit/phpunit/phpunit -c phpunitlte9.xml.dist --testsuite DevTools" + "@phpunit -c phpunitlte9.xml.dist --testsuite DevTools" ], "check-complete": [ "@php ./bin/phpcs-check-feature-completeness ./PHPCSDebug" + ], + "phpunit": [ + "@xdebug", + "@php ./vendor/phpunit/phpunit/phpunit" + ], + "xdebug": [ + "@putenv XDEBUG_MODE=coverage" ] } } From 84ddc326d7c53d9b94b8f018d394e3234dafebc7 Mon Sep 17 00:00:00 2001 From: Nathanael Esayeas Date: Wed, 22 Apr 2026 20:33:50 -0500 Subject: [PATCH 2/4] Revert composer scripts to invoke phpunit without code coverage Signed-off-by: Nathanael Esayeas --- composer.json | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/composer.json b/composer.json index 7ced91b..74bfff1 100644 --- a/composer.json +++ b/composer.json @@ -77,32 +77,25 @@ "@php ./vendor/squizlabs/php_codesniffer/bin/phpcbf" ], "test": [ - "@phpunit" + "@php ./vendor/phpunit/phpunit/phpunit" ], "test-sniff": [ - "@phpunit --testsuite DebugSniff" + "@php ./vendor/phpunit/phpunit/phpunit --testsuite DebugSniff" ], "test-tools": [ - "@phpunit --testsuite DevTools" + "@php ./vendor/phpunit/phpunit/phpunit --testsuite DevTools" ], "test-lte9": [ - "@phpunit -c phpunitlte9.xml.dist" + "@php ./vendor/phpunit/phpunit/phpunit -c phpunitlte9.xml.dist" ], "test-sniff-lte9": [ - "@phpunit -c phpunitlte9.xml.dist --testsuite DebugSniff" + "@php ./vendor/phpunit/phpunit/phpunit -c phpunitlte9.xml.dist --testsuite DebugSniff" ], "test-tools-lte9": [ - "@phpunit -c phpunitlte9.xml.dist --testsuite DevTools" + "@php ./vendor/phpunit/phpunit/phpunit -c phpunitlte9.xml.dist --testsuite DevTools" ], "check-complete": [ "@php ./bin/phpcs-check-feature-completeness ./PHPCSDebug" - ], - "phpunit": [ - "@xdebug", - "@php ./vendor/phpunit/phpunit/phpunit" - ], - "xdebug": [ - "@putenv XDEBUG_MODE=coverage" ] } } From 3a0ff91109d88e20cbb2eba56301ca5b0f4170fd Mon Sep 17 00:00:00 2001 From: Nathanael Esayeas Date: Wed, 22 Apr 2026 20:41:38 -0500 Subject: [PATCH 3/4] Add autoloading for non-sniff related files Signed-off-by: Nathanael Esayeas Co-Authored-By: Juliette <663378+jrfnl@users.noreply.github.com> --- composer.json | 5 ++++- devtools-autoload.php | 44 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 devtools-autoload.php diff --git a/composer.json b/composer.json index 74bfff1..c4d88f3 100644 --- a/composer.json +++ b/composer.json @@ -47,7 +47,10 @@ "autoload": { "psr-4": { "PHPCSDevTools\\Scripts\\": "Scripts/" - } + }, + "files": [ + "devtools-autoload.php" + ] }, "autoload-dev": { "psr-4": { diff --git a/devtools-autoload.php b/devtools-autoload.php new file mode 100644 index 0000000..e722bae --- /dev/null +++ b/devtools-autoload.php @@ -0,0 +1,44 @@ + Date: Wed, 22 Apr 2026 20:43:57 -0500 Subject: [PATCH 4/4] Revert "Add autoloading for non-sniff related files" This reverts commit 3a0ff91109d88e20cbb2eba56301ca5b0f4170fd. --- composer.json | 5 +---- devtools-autoload.php | 44 ------------------------------------------- 2 files changed, 1 insertion(+), 48 deletions(-) delete mode 100644 devtools-autoload.php diff --git a/composer.json b/composer.json index c4d88f3..74bfff1 100644 --- a/composer.json +++ b/composer.json @@ -47,10 +47,7 @@ "autoload": { "psr-4": { "PHPCSDevTools\\Scripts\\": "Scripts/" - }, - "files": [ - "devtools-autoload.php" - ] + } }, "autoload-dev": { "psr-4": { diff --git a/devtools-autoload.php b/devtools-autoload.php deleted file mode 100644 index e722bae..0000000 --- a/devtools-autoload.php +++ /dev/null @@ -1,44 +0,0 @@ -