From d734c4e8beaf7a0caa9ba541ebcbb357160937a6 Mon Sep 17 00:00:00 2001 From: Jakub Zalas Date: Mon, 24 Feb 2025 14:20:38 +0000 Subject: [PATCH 01/32] Update readme tools --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 83e1bc4..ccc071b 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ It has been extracted as a separate project to make maintenance easier and enabl | cyclonedx-php-composer | [Composer plugin to create Software-Bill-of-Materials (SBOM) in CycloneDX format](https://github.com/CycloneDX/cyclonedx-php-composer) | ✅ | ✅ | ✅ | ✅ | | dephpend | [Detect flaws in your architecture](https://dephpend.com/) | ✅ | ✅ | ✅ | ✅ | | deprecation-detector | [Finds usages of deprecated code](https://github.com/sensiolabs-de/deprecation-detector) | ✅ | ✅ | ✅ | ✅ | -| deptrac | [Enforces dependency rules between software layers](https://github.com/qossmic/deptrac) | ✅ | ✅ | ✅ | ✅ | +| deptrac | [Enforces dependency rules between software layers](https://github.com/deptrac/deptrac) | ✅ | ✅ | ✅ | ✅ | | diffFilter | [Applies QA tools to run on a single pull request](https://github.com/exussum12/coverageChecker) | ✅ | ✅ | ✅ | ✅ | | ecs | [Sets up and runs coding standard checks](https://github.com/Symplify/EasyCodingStandard) | ✅ | ✅ | ✅ | ✅ | | infection | [AST based PHP Mutation Testing Framework](https://infection.github.io/) | ❌ | ✅ | ✅ | ✅ | From b999ca9fb0865a54f40b1bd41c8adb32ba5b626c Mon Sep 17 00:00:00 2001 From: Jakub Zalas Date: Mon, 24 Feb 2025 14:37:10 +0000 Subject: [PATCH 02/32] Drop PHP 8.1 support --- .github/workflows/build.yml | 10 +- .github/workflows/publish-website.yml | 2 +- .github/workflows/update-phars.yml | 2 +- Makefile | 4 +- README.md | 168 +++++++++++++------------- bin/devkit.php | 7 +- composer.json | 2 +- resources/composer.json | 2 +- resources/linting.json | 2 +- resources/pre-installation.json | 2 +- resources/test.json | 8 +- 11 files changed, 104 insertions(+), 105 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a820e21..be7baee 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -20,10 +20,10 @@ jobs: name: Build and test strategy: matrix: - php: [8.1, 8.2, 8.3, 8.4] + php: [8.2, 8.3, 8.4] deps: [high] include: - - php: 8.1 + - php: 8.2 deps: low steps: @@ -44,13 +44,13 @@ jobs: run: make update-min test-min - uses: actions/upload-artifact@v4 - if: matrix.php == '8.1' && matrix.deps == 'high' + if: matrix.php == '8.2' && matrix.deps == 'high' with: name: toolbox.phar path: build/toolbox.phar - uses: actions/upload-artifact@v4 - if: matrix.php == '8.1' && matrix.deps == 'high' + if: matrix.php == '8.2' && matrix.deps == 'high' with: name: devkit.phar path: build/devkit.phar @@ -61,7 +61,7 @@ jobs: needs: tests strategy: matrix: - php: [8.1, 8.2, 8.3, 8.4] + php: [8.2, 8.3, 8.4] steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/publish-website.yml b/.github/workflows/publish-website.yml index 72cd3c1..309ac15 100644 --- a/.github/workflows/publish-website.yml +++ b/.github/workflows/publish-website.yml @@ -18,7 +18,7 @@ jobs: - name: Setup PHP uses: shivammathur/setup-php@v2 with: - php-version: "8.1" + php-version: "8.2" ini-values: "phar.readonly=0" - name: Build the website diff --git a/.github/workflows/update-phars.yml b/.github/workflows/update-phars.yml index 6e02a88..38db0c0 100644 --- a/.github/workflows/update-phars.yml +++ b/.github/workflows/update-phars.yml @@ -13,7 +13,7 @@ jobs: - name: Setup PHP uses: shivammathur/setup-php@v2 with: - php-version: "8.1" + php-version: "8.2" ini-values: "phar.readonly=0" - name: Configure git diff --git a/Makefile b/Makefile index fff6583..06f222b 100644 --- a/Makefile +++ b/Makefile @@ -63,7 +63,7 @@ package: tools/box sed -e 's/Application('"'"'dev/Application('"'"'$(TOOLBOX_VERSION)/g' bin/toolbox.php > build/phar/bin/toolbox.php cd build/phar && \ - composer config platform.php 8.1.0 && \ + composer config platform.php 8.2.0 && \ composer update --no-dev -o -a tools/box compile @@ -79,7 +79,7 @@ package-devkit: tools/box sed -e 's/\(Application(.*\)'"'"'dev/\1'"'"'$(TOOLBOX_VERSION)/g' bin/devkit.php > build/devkit-phar/bin/devkit.php cd build/devkit-phar && \ - composer config platform.php 8.1.0 && \ + composer config platform.php 8.2.0 && \ composer update --no-dev -o -a tools/box compile -c box-devkit.json.dist diff --git a/README.md b/README.md index ccc071b..6f470c9 100644 --- a/README.md +++ b/README.md @@ -14,89 +14,89 @@ It has been extracted as a separate project to make maintenance easier and enabl ## Available tools -| Name | Description | PHP 8.1 | PHP 8.2 | PHP 8.3 | PHP 8.4 | -| :--- | :---------- | :------ | :------ | :------ | :------ | -| behat | [Helps to test business expectations](http://behat.org/) | ✅ | ✅ | ✅ | ✅ | -| box | [Fast, zero config application bundler with PHARs](https://github.com/humbug/box) | ❌ | ✅ | ✅ | ✅ | -| box-3 | [Fast, zero config application bundler with PHARs](https://github.com/humbug/box) | ✅ | ❌ | ✅ | ✅ | -| churn | [Discovers good candidates for refactoring](https://github.com/bmitch/churn-php) | ✅ | ✅ | ✅ | ✅ | -| codeception | [Codeception is a BDD-styled PHP testing framework](https://codeception.com/) | ✅ | ✅ | ✅ | ✅ | -| composer | [Dependency Manager for PHP](https://getcomposer.org/) | ✅ | ✅ | ✅ | ✅ | -| composer-bin-plugin | [Composer plugin to install bin vendors in isolated locations](https://github.com/bamarni/composer-bin-plugin) | ✅ | ✅ | ✅ | ✅ | -| composer-normalize | [Composer plugin to normalize composer.json files](https://github.com/ergebnis/composer-normalize) | ✅ | ✅ | ✅ | ✅ | -| composer-require-checker | [Verify that no unknown symbols are used in the sources of a package.](https://github.com/maglnet/ComposerRequireChecker) | ❌ | ✅ | ✅ | ✅ | -| composer-require-checker-3 | [Verify that no unknown symbols are used in the sources of a package.](https://github.com/maglnet/ComposerRequireChecker) | ✅ | ✅ | ✅ | ✅ | -| composer-unused | [Show unused packages by scanning your code](https://github.com/icanhazstring/composer-unused) | ✅ | ✅ | ✅ | ✅ | -| cyclonedx-php-composer | [Composer plugin to create Software-Bill-of-Materials (SBOM) in CycloneDX format](https://github.com/CycloneDX/cyclonedx-php-composer) | ✅ | ✅ | ✅ | ✅ | -| dephpend | [Detect flaws in your architecture](https://dephpend.com/) | ✅ | ✅ | ✅ | ✅ | -| deprecation-detector | [Finds usages of deprecated code](https://github.com/sensiolabs-de/deprecation-detector) | ✅ | ✅ | ✅ | ✅ | -| deptrac | [Enforces dependency rules between software layers](https://github.com/deptrac/deptrac) | ✅ | ✅ | ✅ | ✅ | -| diffFilter | [Applies QA tools to run on a single pull request](https://github.com/exussum12/coverageChecker) | ✅ | ✅ | ✅ | ✅ | -| ecs | [Sets up and runs coding standard checks](https://github.com/Symplify/EasyCodingStandard) | ✅ | ✅ | ✅ | ✅ | -| infection | [AST based PHP Mutation Testing Framework](https://infection.github.io/) | ❌ | ✅ | ✅ | ✅ | -| larastan | [PHPStan extension for Laravel](https://github.com/nunomaduro/larastan) | ✅ | ✅ | ✅ | ✅ | -| local-php-security-checker | [Checks composer dependencies for known security vulnerabilities](https://github.com/fabpot/local-php-security-checker) | ✅ | ✅ | ✅ | ✅ | -| parallel-lint | [Checks PHP file syntax](https://github.com/php-parallel-lint/PHP-Parallel-Lint) | ✅ | ✅ | ✅ | ✅ | -| paratest | [Parallel testing for PHPUnit](https://github.com/paratestphp/paratest) | ✅ | ✅ | ✅ | ✅ | -| pdepend | [Static Analysis Tool](https://pdepend.org/) | ✅ | ✅ | ✅ | ✅ | -| pest | [The elegant PHP Testing Framework](https://github.com/pestphp/pest) | ✅ | ✅ | ✅ | ✅ | -| phan | [Static Analysis Tool](https://github.com/phan/phan) | ✅ | ✅ | ✅ | ✅ | -| phive | [PHAR Installation and Verification Environment](https://phar.io/) | ✅ | ✅ | ✅ | ✅ | -| php-cs-fixer | [PHP Coding Standards Fixer](http://cs.symfony.com/) | ✅ | ✅ | ✅ | ❌ | -| php-fuzzer | [A fuzzer for PHP, which can be used to find bugs in libraries by feeding them 'random' inputs](https://github.com/nikic/PHP-Fuzzer) | ✅ | ✅ | ✅ | ✅ | -| php-semver-checker | [Suggests a next version according to semantic versioning](https://github.com/tomzx/php-semver-checker) | ✅ | ✅ | ✅ | ✅ | -| phpa | [Checks for weak assumptions](https://github.com/rskuipers/php-assumptions) | ✅ | ✅ | ✅ | ✅ | -| phparkitect | [Helps to put architectural constraints in a PHP code base](https://github.com/phparkitect/arkitect) | ✅ | ✅ | ✅ | ✅ | -| phpat | [Easy to use architecture testing tool](https://github.com/carlosas/phpat) | ✅ | ✅ | ✅ | ✅ | -| phpbench | [PHP Benchmarking framework](https://github.com/phpbench/phpbench) | ✅ | ✅ | ✅ | ✅ | -| phpca | [Finds usage of non-built-in extensions](https://github.com/wapmorgan/PhpCodeAnalyzer) | ✅ | ✅ | ✅ | ✅ | -| phpcb | [PHP Code Browser](https://github.com/mayflower/PHP_CodeBrowser) | ✅ | ✅ | ✅ | ✅ | -| phpcbf | [Automatically corrects coding standard violations](https://github.com/squizlabs/PHP_CodeSniffer) | ✅ | ✅ | ✅ | ✅ | -| phpcodesniffer-composer-install | [Easy installation of PHP_CodeSniffer coding standards (rulesets).](https://github.com/Dealerdirect/phpcodesniffer-composer-installer) | ✅ | ✅ | ✅ | ✅ | -| phpcov | [a command-line frontend for the PHP_CodeCoverage library](https://github.com/sebastianbergmann/phpcov) | ❌ | ✅ | ✅ | ✅ | -| phpcpd | [Copy/Paste Detector](https://github.com/sebastianbergmann/phpcpd) | ✅ | ✅ | ✅ | ✅ | -| phpcs | [Detects coding standard violations](https://github.com/squizlabs/PHP_CodeSniffer) | ✅ | ✅ | ✅ | ✅ | -| phpcs-security-audit | [Finds vulnerabilities and weaknesses related to security in PHP code](https://github.com/FloeDesignTechnologies/phpcs-security-audit) | ✅ | ✅ | ✅ | ✅ | -| phpdd | [Finds usage of deprecated features](http://wapmorgan.github.io/PhpDeprecationDetector) | ✅ | ✅ | ✅ | ✅ | -| phpDocumentor | [Documentation generator](https://www.phpdoc.org/) | ✅ | ✅ | ✅ | ✅ | -| phpinsights | [Analyses code quality, style, architecture and complexity](https://phpinsights.com/) | ✅ | ✅ | ✅ | ✅ | -| phplint | [Lints php files in parallel](https://github.com/overtrue/phplint) | ✅ | ✅ | ✅ | ✅ | -| phploc | [A tool for quickly measuring the size of a PHP project](https://github.com/sebastianbergmann/phploc) | ✅ | ✅ | ✅ | ✅ | -| phpmd | [A tool for finding problems in PHP code](https://phpmd.org/) | ✅ | ✅ | ✅ | ✅ | -| phpmetrics | [Static Analysis Tool](http://www.phpmetrics.org/) | ✅ | ✅ | ✅ | ✅ | -| phpmnd | [Helps to detect magic numbers](https://github.com/povils/phpmnd) | ✅ | ✅ | ✅ | ✅ | -| phpspec | [SpecBDD Framework](http://www.phpspec.net/) | ✅ | ✅ | ✅ | ❌ | -| phpstan | [Static Analysis Tool](https://github.com/phpstan/phpstan) | ✅ | ✅ | ✅ | ✅ | -| phpstan-banned-code | [PHPStan rules for detecting calls to specific functions you don't want in your project](https://github.com/ekino/phpstan-banned-code) | ✅ | ✅ | ✅ | ✅ | -| phpstan-beberlei-assert | [PHPStan extension for beberlei/assert](https://github.com/phpstan/phpstan-beberlei-assert) | ✅ | ✅ | ✅ | ✅ | -| phpstan-deprecation-rules | [PHPStan rules for detecting deprecated code](https://github.com/phpstan/phpstan-deprecation-rules) | ✅ | ✅ | ✅ | ✅ | -| phpstan-doctrine | [Doctrine extensions for PHPStan](https://github.com/phpstan/phpstan-doctrine) | ✅ | ✅ | ✅ | ✅ | -| phpstan-ergebnis-rules | [Additional rules for PHPstan](https://github.com/ergebnis/phpstan-rules) | ✅ | ✅ | ✅ | ✅ | -| phpstan-exception-rules | [PHPStan rules for checked and unchecked exceptions](https://github.com/pepakriz/phpstan-exception-rules) | ✅ | ✅ | ✅ | ✅ | -| phpstan-larastan | [Separate installation of phpstan for larastan](https://github.com/phpstan/phpstan) | ✅ | ✅ | ✅ | ✅ | -| phpstan-phpunit | [PHPUnit extensions and rules for PHPStan](https://github.com/phpstan/phpstan-phpunit) | ✅ | ✅ | ✅ | ✅ | -| phpstan-strict-rules | [Extra strict and opinionated rules for PHPStan](https://github.com/phpstan/phpstan-strict-rules) | ✅ | ✅ | ✅ | ✅ | -| phpstan-symfony | [Symfony extension for PHPStan](https://github.com/phpstan/phpstan-symfony) | ✅ | ✅ | ✅ | ✅ | -| phpstan-webmozart-assert | [PHPStan extension for webmozart/assert](https://github.com/phpstan/phpstan-webmozart-assert) | ✅ | ✅ | ✅ | ✅ | -| phpunit | [The PHP testing framework](https://phpunit.de/) | ❌ | ❌ | ✅ | ✅ | -| phpunit-10 | [The PHP testing framework (10.x version)](https://phpunit.de/) | ✅ | ✅ | ✅ | ✅ | -| phpunit-11 | [The PHP testing framework (11.x version)](https://phpunit.de/) | ❌ | ✅ | ✅ | ✅ | -| phpunit-8 | [The PHP testing framework (8.x version)](https://phpunit.de/) | ✅ | ✅ | ✅ | ✅ | -| phpunit-9 | [The PHP testing framework (9.x version)](https://phpunit.de/) | ✅ | ✅ | ✅ | ✅ | -| pint | [Opinionated PHP code style fixer for Laravel](https://github.com/laravel/pint) | ✅ | ✅ | ✅ | ✅ | -| psalm | [Finds errors in PHP applications](https://psalm.dev/) | ✅ | ✅ | ✅ | ✅ | -| psalm-plugin-doctrine | [Stubs to let Psalm understand Doctrine better](https://github.com/weirdan/doctrine-psalm-plugin) | ✅ | ✅ | ✅ | ✅ | -| psalm-plugin-phpunit | [Psalm plugin for PHPUnit](https://github.com/psalm/psalm-plugin-phpunit) | ✅ | ✅ | ✅ | ✅ | -| psalm-plugin-symfony | [Psalm Plugin for Symfony](https://github.com/psalm/psalm-plugin-symfony) | ✅ | ✅ | ✅ | ✅ | -| psecio-parse | [Scans code for potential security-related issues](https://github.com/psecio/parse) | ✅ | ✅ | ✅ | ✅ | -| rector | [Tool for instant code upgrades and refactoring](https://github.com/rectorphp/rector) | ✅ | ✅ | ✅ | ✅ | -| roave-backward-compatibility-check | [Tool to compare two revisions of a class API to check for BC breaks](https://github.com/Roave/BackwardCompatibilityCheck) | ✅ | ✅ | ✅ | ❌ | -| simple-phpunit | [Provides utilities to report legacy tests and usage of deprecated code](https://symfony.com/doc/current/components/phpunit_bridge.html) | ✅ | ✅ | ✅ | ✅ | -| twig-cs-fixer | [Automatically corrects twig files following the official coding standard rules](https://github.com/VincentLanglet/Twig-CS-Fixer) | ✅ | ✅ | ✅ | ✅ | -| twig-lint | [Standalone cli twig 1.X linter](https://github.com/asm89/twig-lint) | ✅ | ✅ | ✅ | ✅ | -| twig-linter | [Standalone cli twig 3.X linter](https://github.com/sserbin/twig-linter) | ✅ | ✅ | ✅ | ✅ | -| twigcs | [The missing checkstyle for twig!](https://github.com/friendsoftwig/twigcs) | ✅ | ✅ | ✅ | ✅ | -| yaml-lint | [Compact command line utility for checking YAML file syntax](https://github.com/j13k/yaml-lint) | ❌ | ✅ | ✅ | ✅ | +| Name | Description | PHP 8.2 | PHP 8.3 | PHP 8.4 | +| :--- | :---------- | :------ | :------ | :------ | +| behat | [Helps to test business expectations](http://behat.org/) | ✅ | ✅ | ✅ | +| box | [Fast, zero config application bundler with PHARs](https://github.com/humbug/box) | ✅ | ✅ | ✅ | +| box-3 | [Fast, zero config application bundler with PHARs](https://github.com/humbug/box) | ❌ | ✅ | ✅ | +| churn | [Discovers good candidates for refactoring](https://github.com/bmitch/churn-php) | ✅ | ✅ | ✅ | +| codeception | [Codeception is a BDD-styled PHP testing framework](https://codeception.com/) | ✅ | ✅ | ✅ | +| composer | [Dependency Manager for PHP](https://getcomposer.org/) | ✅ | ✅ | ✅ | +| composer-bin-plugin | [Composer plugin to install bin vendors in isolated locations](https://github.com/bamarni/composer-bin-plugin) | ✅ | ✅ | ✅ | +| composer-normalize | [Composer plugin to normalize composer.json files](https://github.com/ergebnis/composer-normalize) | ✅ | ✅ | ✅ | +| composer-require-checker | [Verify that no unknown symbols are used in the sources of a package.](https://github.com/maglnet/ComposerRequireChecker) | ✅ | ✅ | ✅ | +| composer-require-checker-3 | [Verify that no unknown symbols are used in the sources of a package.](https://github.com/maglnet/ComposerRequireChecker) | ✅ | ✅ | ✅ | +| composer-unused | [Show unused packages by scanning your code](https://github.com/icanhazstring/composer-unused) | ✅ | ✅ | ✅ | +| cyclonedx-php-composer | [Composer plugin to create Software-Bill-of-Materials (SBOM) in CycloneDX format](https://github.com/CycloneDX/cyclonedx-php-composer) | ✅ | ✅ | ✅ | +| dephpend | [Detect flaws in your architecture](https://dephpend.com/) | ✅ | ✅ | ✅ | +| deprecation-detector | [Finds usages of deprecated code](https://github.com/sensiolabs-de/deprecation-detector) | ✅ | ✅ | ✅ | +| deptrac | [Enforces dependency rules between software layers](https://github.com/deptrac/deptrac) | ✅ | ✅ | ✅ | +| diffFilter | [Applies QA tools to run on a single pull request](https://github.com/exussum12/coverageChecker) | ✅ | ✅ | ✅ | +| ecs | [Sets up and runs coding standard checks](https://github.com/Symplify/EasyCodingStandard) | ✅ | ✅ | ✅ | +| infection | [AST based PHP Mutation Testing Framework](https://infection.github.io/) | ✅ | ✅ | ✅ | +| larastan | [PHPStan extension for Laravel](https://github.com/nunomaduro/larastan) | ✅ | ✅ | ✅ | +| local-php-security-checker | [Checks composer dependencies for known security vulnerabilities](https://github.com/fabpot/local-php-security-checker) | ✅ | ✅ | ✅ | +| parallel-lint | [Checks PHP file syntax](https://github.com/php-parallel-lint/PHP-Parallel-Lint) | ✅ | ✅ | ✅ | +| paratest | [Parallel testing for PHPUnit](https://github.com/paratestphp/paratest) | ✅ | ✅ | ✅ | +| pdepend | [Static Analysis Tool](https://pdepend.org/) | ✅ | ✅ | ✅ | +| pest | [The elegant PHP Testing Framework](https://github.com/pestphp/pest) | ✅ | ✅ | ✅ | +| phan | [Static Analysis Tool](https://github.com/phan/phan) | ✅ | ✅ | ✅ | +| phive | [PHAR Installation and Verification Environment](https://phar.io/) | ✅ | ✅ | ✅ | +| php-cs-fixer | [PHP Coding Standards Fixer](http://cs.symfony.com/) | ✅ | ✅ | ❌ | +| php-fuzzer | [A fuzzer for PHP, which can be used to find bugs in libraries by feeding them 'random' inputs](https://github.com/nikic/PHP-Fuzzer) | ✅ | ✅ | ✅ | +| php-semver-checker | [Suggests a next version according to semantic versioning](https://github.com/tomzx/php-semver-checker) | ✅ | ✅ | ✅ | +| phpa | [Checks for weak assumptions](https://github.com/rskuipers/php-assumptions) | ✅ | ✅ | ✅ | +| phparkitect | [Helps to put architectural constraints in a PHP code base](https://github.com/phparkitect/arkitect) | ✅ | ✅ | ✅ | +| phpat | [Easy to use architecture testing tool](https://github.com/carlosas/phpat) | ✅ | ✅ | ✅ | +| phpbench | [PHP Benchmarking framework](https://github.com/phpbench/phpbench) | ✅ | ✅ | ✅ | +| phpca | [Finds usage of non-built-in extensions](https://github.com/wapmorgan/PhpCodeAnalyzer) | ✅ | ✅ | ✅ | +| phpcb | [PHP Code Browser](https://github.com/mayflower/PHP_CodeBrowser) | ✅ | ✅ | ✅ | +| phpcbf | [Automatically corrects coding standard violations](https://github.com/squizlabs/PHP_CodeSniffer) | ✅ | ✅ | ✅ | +| phpcodesniffer-composer-install | [Easy installation of PHP_CodeSniffer coding standards (rulesets).](https://github.com/Dealerdirect/phpcodesniffer-composer-installer) | ✅ | ✅ | ✅ | +| phpcov | [a command-line frontend for the PHP_CodeCoverage library](https://github.com/sebastianbergmann/phpcov) | ✅ | ✅ | ✅ | +| phpcpd | [Copy/Paste Detector](https://github.com/sebastianbergmann/phpcpd) | ✅ | ✅ | ✅ | +| phpcs | [Detects coding standard violations](https://github.com/squizlabs/PHP_CodeSniffer) | ✅ | ✅ | ✅ | +| phpcs-security-audit | [Finds vulnerabilities and weaknesses related to security in PHP code](https://github.com/FloeDesignTechnologies/phpcs-security-audit) | ✅ | ✅ | ✅ | +| phpdd | [Finds usage of deprecated features](http://wapmorgan.github.io/PhpDeprecationDetector) | ✅ | ✅ | ✅ | +| phpDocumentor | [Documentation generator](https://www.phpdoc.org/) | ✅ | ✅ | ✅ | +| phpinsights | [Analyses code quality, style, architecture and complexity](https://phpinsights.com/) | ✅ | ✅ | ✅ | +| phplint | [Lints php files in parallel](https://github.com/overtrue/phplint) | ✅ | ✅ | ✅ | +| phploc | [A tool for quickly measuring the size of a PHP project](https://github.com/sebastianbergmann/phploc) | ✅ | ✅ | ✅ | +| phpmd | [A tool for finding problems in PHP code](https://phpmd.org/) | ✅ | ✅ | ✅ | +| phpmetrics | [Static Analysis Tool](http://www.phpmetrics.org/) | ✅ | ✅ | ✅ | +| phpmnd | [Helps to detect magic numbers](https://github.com/povils/phpmnd) | ✅ | ✅ | ✅ | +| phpspec | [SpecBDD Framework](http://www.phpspec.net/) | ✅ | ✅ | ❌ | +| phpstan | [Static Analysis Tool](https://github.com/phpstan/phpstan) | ✅ | ✅ | ✅ | +| phpstan-banned-code | [PHPStan rules for detecting calls to specific functions you don't want in your project](https://github.com/ekino/phpstan-banned-code) | ✅ | ✅ | ✅ | +| phpstan-beberlei-assert | [PHPStan extension for beberlei/assert](https://github.com/phpstan/phpstan-beberlei-assert) | ✅ | ✅ | ✅ | +| phpstan-deprecation-rules | [PHPStan rules for detecting deprecated code](https://github.com/phpstan/phpstan-deprecation-rules) | ✅ | ✅ | ✅ | +| phpstan-doctrine | [Doctrine extensions for PHPStan](https://github.com/phpstan/phpstan-doctrine) | ✅ | ✅ | ✅ | +| phpstan-ergebnis-rules | [Additional rules for PHPstan](https://github.com/ergebnis/phpstan-rules) | ✅ | ✅ | ✅ | +| phpstan-exception-rules | [PHPStan rules for checked and unchecked exceptions](https://github.com/pepakriz/phpstan-exception-rules) | ✅ | ✅ | ✅ | +| phpstan-larastan | [Separate installation of phpstan for larastan](https://github.com/phpstan/phpstan) | ✅ | ✅ | ✅ | +| phpstan-phpunit | [PHPUnit extensions and rules for PHPStan](https://github.com/phpstan/phpstan-phpunit) | ✅ | ✅ | ✅ | +| phpstan-strict-rules | [Extra strict and opinionated rules for PHPStan](https://github.com/phpstan/phpstan-strict-rules) | ✅ | ✅ | ✅ | +| phpstan-symfony | [Symfony extension for PHPStan](https://github.com/phpstan/phpstan-symfony) | ✅ | ✅ | ✅ | +| phpstan-webmozart-assert | [PHPStan extension for webmozart/assert](https://github.com/phpstan/phpstan-webmozart-assert) | ✅ | ✅ | ✅ | +| phpunit | [The PHP testing framework](https://phpunit.de/) | ❌ | ✅ | ✅ | +| phpunit-10 | [The PHP testing framework (10.x version)](https://phpunit.de/) | ✅ | ✅ | ✅ | +| phpunit-11 | [The PHP testing framework (11.x version)](https://phpunit.de/) | ✅ | ✅ | ✅ | +| phpunit-8 | [The PHP testing framework (8.x version)](https://phpunit.de/) | ✅ | ✅ | ✅ | +| phpunit-9 | [The PHP testing framework (9.x version)](https://phpunit.de/) | ✅ | ✅ | ✅ | +| pint | [Opinionated PHP code style fixer for Laravel](https://github.com/laravel/pint) | ✅ | ✅ | ✅ | +| psalm | [Finds errors in PHP applications](https://psalm.dev/) | ✅ | ✅ | ✅ | +| psalm-plugin-doctrine | [Stubs to let Psalm understand Doctrine better](https://github.com/weirdan/doctrine-psalm-plugin) | ✅ | ✅ | ✅ | +| psalm-plugin-phpunit | [Psalm plugin for PHPUnit](https://github.com/psalm/psalm-plugin-phpunit) | ✅ | ✅ | ✅ | +| psalm-plugin-symfony | [Psalm Plugin for Symfony](https://github.com/psalm/psalm-plugin-symfony) | ✅ | ✅ | ✅ | +| psecio-parse | [Scans code for potential security-related issues](https://github.com/psecio/parse) | ✅ | ✅ | ✅ | +| rector | [Tool for instant code upgrades and refactoring](https://github.com/rectorphp/rector) | ✅ | ✅ | ✅ | +| roave-backward-compatibility-check | [Tool to compare two revisions of a class API to check for BC breaks](https://github.com/Roave/BackwardCompatibilityCheck) | ✅ | ✅ | ❌ | +| simple-phpunit | [Provides utilities to report legacy tests and usage of deprecated code](https://symfony.com/doc/current/components/phpunit_bridge.html) | ✅ | ✅ | ✅ | +| twig-cs-fixer | [Automatically corrects twig files following the official coding standard rules](https://github.com/VincentLanglet/Twig-CS-Fixer) | ✅ | ✅ | ✅ | +| twig-lint | [Standalone cli twig 1.X linter](https://github.com/asm89/twig-lint) | ✅ | ✅ | ✅ | +| twig-linter | [Standalone cli twig 3.X linter](https://github.com/sserbin/twig-linter) | ✅ | ✅ | ✅ | +| twigcs | [The missing checkstyle for twig!](https://github.com/friendsoftwig/twigcs) | ✅ | ✅ | ✅ | +| yaml-lint | [Compact command line utility for checking YAML file syntax](https://github.com/j13k/yaml-lint) | ✅ | ✅ | ✅ | ### Removed tools @@ -244,7 +244,7 @@ Tools can be tagged in order to enable grouping and filtering them. The tags below have a special meaning: * `pre-installation` - these tools will be installed before any other tools. -* `exclude-php:8.1`, `exclude-php:8.2` etc - used to exclude installation on the specified php version. +* `exclude-php:8.2`, `exclude-php:8.3` etc - used to exclude installation on the specified php version. ## Contributing diff --git a/bin/devkit.php b/bin/devkit.php index 3352354..47363c4 100755 --- a/bin/devkit.php +++ b/bin/devkit.php @@ -73,17 +73,16 @@ protected function execute(InputInterface $input, OutputInterface $output) $readmePath = $input->getOption('readme'); $tools = $this->loadTools($jsonPath); - $toolsList = '| Name | Description | PHP 8.1 | PHP 8.2 | PHP 8.3 | PHP 8.4 |' . PHP_EOL; - $toolsList .= '| :--- | :---------- | :------ | :------ | :------ | :------ |' . PHP_EOL; + $toolsList = '| Name | Description | PHP 8.2 | PHP 8.3 | PHP 8.4 |' . PHP_EOL; + $toolsList .= '| :--- | :---------- | :------ | :------ | :------ |' . PHP_EOL; $toolsList .= $tools->sort(function (Tool $left, Tool $right) { return strcasecmp($left->name(), $right->name()); })->reduce('', function ($acc, Tool $tool) { - return $acc . sprintf('| %s | [%s](%s) | %s | %s | %s | %s |', + return $acc . sprintf('| %s | [%s](%s) | %s | %s | %s |', $tool->name(), $tool->summary(), $tool->website(), - in_array('exclude-php:8.1', $tool->tags(), true) ? '❌' : '✅', in_array('exclude-php:8.2', $tool->tags(), true) ? '❌' : '✅', in_array('exclude-php:8.3', $tool->tags(), true) ? '❌' : '✅', in_array('exclude-php:8.4', $tool->tags(), true) ? '❌' : '✅', diff --git a/composer.json b/composer.json index 98a45a1..bb2808b 100644 --- a/composer.json +++ b/composer.json @@ -3,7 +3,7 @@ "description": "Helps to discover and install tools", "type": "project", "require": { - "php": "~8.1.0 || ~8.2.0 || ~8.3.0 || ~8.4.0", + "php": "~8.2.0 || ~8.3.0 || ~8.4.0", "symfony/console": "^5.4.31 || ^6.3", "psr/container": "^2.0" }, diff --git a/resources/composer.json b/resources/composer.json index 24b1923..0b41c8a 100644 --- a/resources/composer.json +++ b/resources/composer.json @@ -41,7 +41,7 @@ } }, "test": "composer-require-checker -V", - "tags": ["composer", "exclude-php:8.1"] + "tags": ["composer"] }, { "name": "composer-require-checker-3", diff --git a/resources/linting.json b/resources/linting.json index b5f7465..9a87b64 100644 --- a/resources/linting.json +++ b/resources/linting.json @@ -52,7 +52,7 @@ } }, "test": "yaml-lint --version", - "tags": ["linting", "exclude-php:8.1"] + "tags": ["linting"] }, { "name": "twig-linter", diff --git a/resources/pre-installation.json b/resources/pre-installation.json index 2352065..dc785a1 100644 --- a/resources/pre-installation.json +++ b/resources/pre-installation.json @@ -59,7 +59,7 @@ } }, "test": "box list", - "tags": ["exclude-php:8.1", "pre-installation"] + "tags": ["pre-installation"] }, { "name": "box-3", diff --git a/resources/test.json b/resources/test.json index ffdb1c7..9ee36f0 100644 --- a/resources/test.json +++ b/resources/test.json @@ -39,7 +39,7 @@ } }, "test": "infection --version", - "tags": ["featured", "test", "exclude-php:8.1"] + "tags": ["featured", "test"] }, { "name": "paratest", @@ -84,7 +84,7 @@ } }, "test": "phpcov -v", - "tags": ["test", "exclude-php:8.1"] + "tags": ["test"] }, { "name": "php-fuzzer", @@ -124,7 +124,7 @@ } }, "test": "phpunit --version", - "tags": ["featured", "test", "exclude-php:8.1", "exclude-php:8.2"] + "tags": ["featured", "test", "exclude-php:8.2"] }, { "name": "phpunit-11", @@ -138,7 +138,7 @@ } }, "test": "phpunit-11 --version", - "tags": ["test", "exclude-php:8.1"] + "tags": ["test"] }, { "name": "phpunit-10", From e1ac4641700a272f922cd55e45b49561ab2e1141 Mon Sep 17 00:00:00 2001 From: Jakub Zalas Date: Mon, 24 Feb 2025 10:05:18 +0000 Subject: [PATCH 03/32] Update the required minimum Symfony version --- composer.json | 2 +- src/Cli/Application.php | 2 +- src/Cli/Command/InstallCommand.php | 2 +- src/Cli/Command/ListCommand.php | 2 +- src/Cli/Command/TestCommand.php | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.json b/composer.json index bb2808b..9374722 100644 --- a/composer.json +++ b/composer.json @@ -4,7 +4,7 @@ "type": "project", "require": { "php": "~8.2.0 || ~8.3.0 || ~8.4.0", - "symfony/console": "^5.4.31 || ^6.3", + "symfony/console": "^6.4.18 || ^7.2", "psr/container": "^2.0" }, "require-dev": { diff --git a/src/Cli/Application.php b/src/Cli/Application.php index 8fd9608..7f25432 100644 --- a/src/Cli/Application.php +++ b/src/Cli/Application.php @@ -27,7 +27,7 @@ public function __construct(string $version, ServiceContainer $serviceContainer) $this->setCommandLoader($this->createCommandLoader($serviceContainer)); } - public function doRun(InputInterface $input, OutputInterface $output) + public function doRun(InputInterface $input, OutputInterface $output): int { $this->serviceContainer->set(InputInterface::class, $input); $this->serviceContainer->set(OutputInterface::class, $output); diff --git a/src/Cli/Command/InstallCommand.php b/src/Cli/Command/InstallCommand.php index 1863036..f6c53fc 100644 --- a/src/Cli/Command/InstallCommand.php +++ b/src/Cli/Command/InstallCommand.php @@ -37,7 +37,7 @@ protected function configure() $this->addOption('tag', 't', InputOption::VALUE_REQUIRED|InputOption::VALUE_IS_ARRAY, 'Tool tags to filter by', $this->defaultTag()); } - protected function execute(InputInterface $input, OutputInterface $output) + protected function execute(InputInterface $input, OutputInterface $output): int { return $this->runner->run(\call_user_func($this->useCase, new Filter($input->getOption('exclude-tag'), $input->getOption('tag')))); } diff --git a/src/Cli/Command/ListCommand.php b/src/Cli/Command/ListCommand.php index 9ee4f9a..7d3ea27 100644 --- a/src/Cli/Command/ListCommand.php +++ b/src/Cli/Command/ListCommand.php @@ -34,7 +34,7 @@ protected function configure() $this->addOption('tag', 't', InputOption::VALUE_REQUIRED|InputOption::VALUE_IS_ARRAY, 'Tool tags to filter by', $this->defaultTag()); } - protected function execute(InputInterface $input, OutputInterface $output) + protected function execute(InputInterface $input, OutputInterface $output): int { $tools = \call_user_func($this->listTools, new Filter($input->getOption('exclude-tag'), $input->getOption('tag'))); diff --git a/src/Cli/Command/TestCommand.php b/src/Cli/Command/TestCommand.php index 5192b83..1443a65 100644 --- a/src/Cli/Command/TestCommand.php +++ b/src/Cli/Command/TestCommand.php @@ -37,7 +37,7 @@ protected function configure() $this->addOption('tag', 't', InputOption::VALUE_REQUIRED|InputOption::VALUE_IS_ARRAY, 'Tool tags to filter by', $this->defaultTag()); } - protected function execute(InputInterface $input, OutputInterface $output) + protected function execute(InputInterface $input, OutputInterface $output): int { return $this->runner->run(\call_user_func($this->useCase, new Filter($input->getOption('exclude-tag'), $input->getOption('tag')))); } From a8489482e13c1f980e36faee6dff0dbbe1cfac8f Mon Sep 17 00:00:00 2001 From: Jakub Zalas Date: Mon, 24 Feb 2025 15:08:47 +0000 Subject: [PATCH 04/32] Update PHPUnit (10.4 -> 11.5.9) --- composer.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 9374722..c0673cf 100644 --- a/composer.json +++ b/composer.json @@ -8,8 +8,8 @@ "psr/container": "^2.0" }, "require-dev": { - "phpunit/phpunit": "^10.4", - "zalas/phpunit-globals": "^3.2", + "phpunit/phpunit": "^11.5.9", + "zalas/phpunit-globals": "^3.5", "infection/infection": "^0.29", "deptrac/deptrac": "^3.0" }, From c3a5bb74287bbe12e4a3c4d6eb4c3991c42cb9c2 Mon Sep 17 00:00:00 2001 From: Jakub Zalas Date: Mon, 24 Feb 2025 15:10:39 +0000 Subject: [PATCH 05/32] Update devkit to be compatible with latest Symfony --- bin/devkit.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bin/devkit.php b/bin/devkit.php index 47363c4..fac9276 100755 --- a/bin/devkit.php +++ b/bin/devkit.php @@ -67,7 +67,7 @@ protected function configure() $this->addOption('readme', null, InputOption::VALUE_REQUIRED, 'Path to the readme file', __DIR__ . '/../README.md'); } - protected function execute(InputInterface $input, OutputInterface $output) + protected function execute(InputInterface $input, OutputInterface $output): int { $jsonPath = $input->getOption('tools'); $readmePath = $input->getOption('readme'); @@ -112,7 +112,7 @@ protected function configure() $this->addOption('tools', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Path(s) to the list of tools. Can also be set with TOOLBOX_JSON environment variable.', $this->toolsJsonDefault()); } - protected function execute(InputInterface $input, OutputInterface $output) + protected function execute(InputInterface $input, OutputInterface $output): int { foreach ($input->getOption('tools') as $jsonPath) { $result = $this->updatePhars($jsonPath, $output); @@ -199,7 +199,7 @@ protected function configure() $this->addOption('tools', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Path(s) to the list of tools. Can also be set with TOOLBOX_JSON environment variable.', $this->toolsJsonDefault()); } - protected function execute(InputInterface $input, OutputInterface $output) + protected function execute(InputInterface $input, OutputInterface $output): int { $tools = $this->loadTools($input->getOption('tools'), new Filter(['pre-installation'], [])); From 66cfaf8ac5ed88793b4e7658905caa2a4cd11ed1 Mon Sep 17 00:00:00 2001 From: Jakub Zalas Date: Mon, 24 Feb 2025 17:31:26 +0000 Subject: [PATCH 06/32] Switch scrutinizr to PHP 8.4 --- .scrutinizer.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.scrutinizer.yml b/.scrutinizer.yml index 832cd37..c011f44 100644 --- a/.scrutinizer.yml +++ b/.scrutinizer.yml @@ -3,7 +3,7 @@ inherit: true build: environment: php: - version: 8.2 + version: 8.4 variables: XDEBUG_MODE: coverage tests: From 9a52aced4dd0b7e4af95dea0ecbe0fafcb42b5f8 Mon Sep 17 00:00:00 2001 From: Jakub Zalas Date: Mon, 24 Feb 2025 17:33:44 +0000 Subject: [PATCH 07/32] Revert "Switch scrutinizr to PHP 8.4" This reverts commit 66cfaf8ac5ed88793b4e7658905caa2a4cd11ed1. --- .scrutinizer.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.scrutinizer.yml b/.scrutinizer.yml index c011f44..832cd37 100644 --- a/.scrutinizer.yml +++ b/.scrutinizer.yml @@ -3,7 +3,7 @@ inherit: true build: environment: php: - version: 8.4 + version: 8.2 variables: XDEBUG_MODE: coverage tests: From 0c98c78a8d0f99f241de6b148aeca2e1a105cee5 Mon Sep 17 00:00:00 2001 From: Jakub Zalas Date: Mon, 24 Feb 2025 17:43:56 +0000 Subject: [PATCH 08/32] Allow PHPUnit 12 --- composer.json | 4 ++-- tests/Cli/ServiceContainer/RunnerFactoryTest.php | 5 +---- tests/Cli/ServiceContainerTest.php | 5 ++--- tests/Json/Factory/BoxBuildCommandFactoryTest.php | 5 ++--- tests/Json/Factory/ComposerBinPluginCommandFactoryTest.php | 5 ++--- tests/Json/Factory/ComposerInstallCommandFactoryTest.php | 7 +++---- tests/Json/Factory/FileDownloadCommandFactoryTest.php | 5 ++--- tests/Json/Factory/PharDownloadCommandFactoryTest.php | 5 ++--- tests/Json/Factory/PhiveInstallCommandFactoryTest.php | 5 ++--- tests/Json/Factory/ToolFactoryTest.php | 5 ++--- 10 files changed, 20 insertions(+), 31 deletions(-) diff --git a/composer.json b/composer.json index c0673cf..04fbb10 100644 --- a/composer.json +++ b/composer.json @@ -8,8 +8,8 @@ "psr/container": "^2.0" }, "require-dev": { - "phpunit/phpunit": "^11.5.9", - "zalas/phpunit-globals": "^3.5", + "phpunit/phpunit": "^11.5.9 || ^12.0", + "zalas/phpunit-globals": "^4.0", "infection/infection": "^0.29", "deptrac/deptrac": "^3.0" }, diff --git a/tests/Cli/ServiceContainer/RunnerFactoryTest.php b/tests/Cli/ServiceContainer/RunnerFactoryTest.php index 1d2ea6e..af3c75e 100644 --- a/tests/Cli/ServiceContainer/RunnerFactoryTest.php +++ b/tests/Cli/ServiceContainer/RunnerFactoryTest.php @@ -2,7 +2,6 @@ namespace Zalas\Toolbox\Tests\Cli\ServiceContainer; -use PHPUnit\Framework\Attributes\DoesNotPerformAssertions; use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Psr\Container\ContainerExceptionInterface; @@ -43,7 +42,7 @@ class RunnerFactoryTest extends TestCase protected function setUp(): void { $this->input = $this->givenInput([]); - $this->output = $this->createStub(OutputInterface::class); + $this->output = $this->createMock(OutputInterface::class); $this->container = new class([ InputInterface::class => &$this->input, OutputInterface::class => &$this->output, ]) implements ContainerInterface { @@ -90,7 +89,6 @@ public function test_it_creates_the_parametrised_runner_if_target_dir_option_is_ $this->assertInstanceOf(ParametrisedRunner::class, $runner); } - #[DoesNotPerformAssertions] public function test_the_parametrised_runner_includes_the_target_dir_parameter() { $this->givenInput(['--target-dir' => '/usr/local/bin', '--dry-run' => true]); @@ -116,7 +114,6 @@ public function test_it_throws_an_exception_if_target_dir_does_not_exist() $this->runnerFactory->createRunner(); } - #[DoesNotPerformAssertions] public function test_it_uses_the_real_path_as_target_dir() { $this->givenInput(['--target-dir' => __DIR__.'/../../../bin', '--dry-run' => true]); diff --git a/tests/Cli/ServiceContainerTest.php b/tests/Cli/ServiceContainerTest.php index 7bda293..56260c5 100644 --- a/tests/Cli/ServiceContainerTest.php +++ b/tests/Cli/ServiceContainerTest.php @@ -2,6 +2,7 @@ namespace Zalas\Toolbox\Tests\Cli; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Psr\Container\ContainerExceptionInterface; use Psr\Container\ContainerInterface; @@ -39,9 +40,7 @@ public function test_it_returns_false_if_service_is_not_registered() $this->assertFalse($this->container->has('foo')); } - /** - * @dataProvider provideApplicationServices - */ + #[DataProvider('provideApplicationServices')] public function test_it_creates_application_services(string $serviceId, string $expectedType) { $this->assertTrue($this->container->has($serviceId)); diff --git a/tests/Json/Factory/BoxBuildCommandFactoryTest.php b/tests/Json/Factory/BoxBuildCommandFactoryTest.php index df1170b..5f1f9c9 100644 --- a/tests/Json/Factory/BoxBuildCommandFactoryTest.php +++ b/tests/Json/Factory/BoxBuildCommandFactoryTest.php @@ -2,6 +2,7 @@ namespace Zalas\Toolbox\Tests\Json\Factory; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Zalas\Toolbox\Json\Factory\BoxBuildCommandFactory; use Zalas\Toolbox\Tool\Command\BoxBuildCommand; @@ -40,9 +41,7 @@ public function test_the_version_is_not_required() $this->assertInstanceOf(BoxBuildCommand::class, $command); } - /** - * @dataProvider provideRequiredProperties - */ + #[DataProvider('provideRequiredProperties')] public function test_it_complains_if_any_of_required_properties_is_missing(string $property) { $this->expectException(\InvalidArgumentException::class); diff --git a/tests/Json/Factory/ComposerBinPluginCommandFactoryTest.php b/tests/Json/Factory/ComposerBinPluginCommandFactoryTest.php index b214af0..fdee673 100644 --- a/tests/Json/Factory/ComposerBinPluginCommandFactoryTest.php +++ b/tests/Json/Factory/ComposerBinPluginCommandFactoryTest.php @@ -2,6 +2,7 @@ namespace Zalas\Toolbox\Tests\Json\Factory; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Zalas\Toolbox\Json\Factory\ComposerBinPluginCommandFactory; use Zalas\Toolbox\Tool\Collection; @@ -40,9 +41,7 @@ public function test_it_creates_a_command_with_links_in_tools() ); } - /** - * @dataProvider provideRequiredProperties - */ + #[DataProvider('provideRequiredProperties')] public function test_it_complains_if_any_of_required_properties_is_missing(string $property) { $this->expectException(\InvalidArgumentException::class); diff --git a/tests/Json/Factory/ComposerInstallCommandFactoryTest.php b/tests/Json/Factory/ComposerInstallCommandFactoryTest.php index c3fd595..40470d6 100644 --- a/tests/Json/Factory/ComposerInstallCommandFactoryTest.php +++ b/tests/Json/Factory/ComposerInstallCommandFactoryTest.php @@ -2,6 +2,7 @@ namespace Zalas\Toolbox\Tests\Json\Factory; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Zalas\Toolbox\Json\Factory\ComposerInstallCommandFactory; use Zalas\Toolbox\Tool\Command\ComposerInstallCommand; @@ -24,9 +25,7 @@ public function test_it_creates_a_command() $this->assertMatchesRegularExpression('#git checkout '.self::VERSION.'#', (string) $command); } - /** - * @dataProvider provideRequiredProperties - */ + #[DataProvider('provideRequiredProperties')] public function test_it_complains_if_a_required_property_is_missing(string $property) { $this->expectException(\InvalidArgumentException::class); @@ -41,7 +40,7 @@ public function test_it_complains_if_a_required_property_is_missing(string $prop ComposerInstallCommandFactory::import($properties); } - public static function provideRequiredProperties() + public static function provideRequiredProperties(): \Generator { yield ['repository']; yield ['target-dir']; diff --git a/tests/Json/Factory/FileDownloadCommandFactoryTest.php b/tests/Json/Factory/FileDownloadCommandFactoryTest.php index f17b0aa..6aa492c 100644 --- a/tests/Json/Factory/FileDownloadCommandFactoryTest.php +++ b/tests/Json/Factory/FileDownloadCommandFactoryTest.php @@ -2,6 +2,7 @@ namespace Zalas\Toolbox\Tests\Json\Factory; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Zalas\Toolbox\Json\Factory\FileDownloadCommandFactory; use Zalas\Toolbox\Tool\Command\FileDownloadCommand; @@ -21,9 +22,7 @@ public function test_it_creates_a_command() $this->assertInstanceOf(FileDownloadCommand::class, $command); } - /** - * @dataProvider provideRequiredProperties - */ + #[DataProvider('provideRequiredProperties')] public function test_it_complains_if_any_of_required_properties_is_missing(string $property) { $this->expectException(\InvalidArgumentException::class); diff --git a/tests/Json/Factory/PharDownloadCommandFactoryTest.php b/tests/Json/Factory/PharDownloadCommandFactoryTest.php index 1664278..6b74a46 100644 --- a/tests/Json/Factory/PharDownloadCommandFactoryTest.php +++ b/tests/Json/Factory/PharDownloadCommandFactoryTest.php @@ -2,6 +2,7 @@ namespace Zalas\Toolbox\Tests\Json\Factory; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Zalas\Toolbox\Json\Factory\PharDownloadCommandFactory; use Zalas\Toolbox\Tool\Command\PharDownloadCommand; @@ -21,9 +22,7 @@ public function test_it_creates_a_command() $this->assertInstanceOf(PharDownloadCommand::class, $command); } - /** - * @dataProvider provideRequiredProperties - */ + #[DataProvider('provideRequiredProperties')] public function test_it_complains_if_any_of_required_properties_is_missing(string $property) { $this->expectException(\InvalidArgumentException::class); diff --git a/tests/Json/Factory/PhiveInstallCommandFactoryTest.php b/tests/Json/Factory/PhiveInstallCommandFactoryTest.php index b8d406a..5f48da0 100644 --- a/tests/Json/Factory/PhiveInstallCommandFactoryTest.php +++ b/tests/Json/Factory/PhiveInstallCommandFactoryTest.php @@ -2,6 +2,7 @@ namespace Zalas\Toolbox\Tests\Json\Factory; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Zalas\Toolbox\Json\Factory\PhiveInstallCommandFactory; use Zalas\Toolbox\Tool\Command\PhiveInstallCommand; @@ -24,9 +25,7 @@ public function test_it_creates_a_command() $this->assertStringNotContainsString('unsigned', (string)$command); } - /** - * @dataProvider provideRequiredProperties - */ + #[DataProvider('provideRequiredProperties')] public function test_it_complains_if_any_of_required_properties_is_missing(string $property) { $this->expectException(\InvalidArgumentException::class); diff --git a/tests/Json/Factory/ToolFactoryTest.php b/tests/Json/Factory/ToolFactoryTest.php index bbf0b9b..b437579 100644 --- a/tests/Json/Factory/ToolFactoryTest.php +++ b/tests/Json/Factory/ToolFactoryTest.php @@ -2,6 +2,7 @@ namespace Zalas\Toolbox\Tests\Json\Factory; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Zalas\Toolbox\Json\Factory\ToolFactory; use Zalas\Toolbox\Tool\Command; @@ -195,9 +196,7 @@ public function test_it_complains_if_the_command_is_empty() ToolFactory::import($this->definition(['command' => []])); } - /** - * @dataProvider provideRequiredProperties - */ + #[DataProvider('provideRequiredProperties')] public function test_it_complains_if_any_of_required_properties_is_missing(string $property) { $this->expectException(\InvalidArgumentException::class); From b22a3e993afb50c5197365a8d23dab8b0fc5838f Mon Sep 17 00:00:00 2001 From: Jakub Zalas Date: Mon, 24 Feb 2025 21:38:06 +0000 Subject: [PATCH 09/32] Define property types --- bin/devkit.php | 15 +++------- src/Cli/Application.php | 5 +++- src/Cli/Command/InstallCommand.php | 6 ++-- src/Cli/Command/ListCommand.php | 4 +-- src/Cli/Command/TestCommand.php | 6 ++-- src/Cli/Runner/DryRunner.php | 2 +- src/Cli/ServiceContainer.php | 28 +++++++++++++++-- src/Cli/ServiceContainer/LazyRunner.php | 14 +++++++-- src/Cli/ServiceContainer/RunnerFactory.php | 20 +++++++++++-- src/Json/Factory/Assert.php | 2 +- src/Json/JsonTools.php | 4 +-- src/Runner/ParametrisedRunner.php | 8 ++--- src/Tool/Collection.php | 5 +--- src/Tool/Command/BoxBuildCommand.php | 10 +++---- src/Tool/Command/ComposerBinPluginCommand.php | 6 ++-- .../Command/ComposerBinPluginLinkCommand.php | 6 ++-- .../Command/ComposerGlobalInstallCommand.php | 2 +- .../ComposerGlobalMultiInstallCommand.php | 2 +- src/Tool/Command/ComposerInstallCommand.php | 6 ++-- src/Tool/Command/FileDownloadCommand.php | 4 +-- src/Tool/Command/MultiStepCommand.php | 4 +-- .../OptimisedComposerBinPluginCommand.php | 2 +- src/Tool/Command/PharDownloadCommand.php | 4 +-- src/Tool/Command/PhiveInstallCommand.php | 6 ++-- src/Tool/Command/ShCommand.php | 2 +- src/Tool/Command/TestCommand.php | 4 +-- src/Tool/Filter.php | 4 +-- src/Tool/Tool.php | 12 ++++---- src/Tool/Tools.php | 3 +- src/UseCase/InstallTools.php | 6 ++-- src/UseCase/ListTools.php | 9 +----- src/UseCase/TestTools.php | 2 +- tests/Cli/ApplicationTest.php | 15 ++-------- tests/Cli/Command/InstallCommandTest.php | 12 ++------ tests/Cli/Command/ListCommandTest.php | 5 +--- tests/Cli/Command/TestCommandTest.php | 12 ++------ tests/Cli/Command/ToolboxCommandTestCase.php | 7 ++--- tests/Cli/Runner/DryRunnerTest.php | 12 ++------ tests/Cli/ServiceContainer/LazyRunnerTest.php | 12 ++------ .../ServiceContainer/RunnerFactoryTest.php | 30 +++++-------------- tests/Cli/ServiceContainerTest.php | 7 ++--- tests/Runner/ParametrisedRunnerTest.php | 12 ++------ tests/Tool/CollectionTest.php | 7 +++-- .../Command/ComposerBinPluginCommandTest.php | 5 +--- .../ComposerBinPluginLinkCommandTest.php | 5 +--- .../ComposerGlobalInstallCommandTest.php | 5 +--- .../Tool/Command/FileDownloadCommandTest.php | 5 +--- .../Tool/Command/PharDownloadCommandTest.php | 2 +- .../Tool/Command/PhiveInstallCommandTest.php | 2 +- tests/UseCase/InstallToolsTest.php | 12 ++------ 50 files changed, 168 insertions(+), 212 deletions(-) diff --git a/bin/devkit.php b/bin/devkit.php index fac9276..8201017 100755 --- a/bin/devkit.php +++ b/bin/devkit.php @@ -42,9 +42,6 @@ private function toolsJsonDefault(): array ]; } - /** - * @return Collection|Tool[] - */ private function loadTools($jsonPath, ?Filter $filter = null): Collection { return (new JsonTools(function () use ($jsonPath) { @@ -59,7 +56,7 @@ private function loadTools($jsonPath, ?Filter $filter = null): Collection { use Tools; - protected function configure() + protected function configure(): void { $this->setName('update:readme'); $this->setDescription('Updates README.md with latest list of available tools'); @@ -105,7 +102,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int { use Tools; - protected function configure() + protected function configure(): void { $this->setName('update:phars'); $this->setDescription('Attempts to update phar links to latest versions'); @@ -125,7 +122,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int return 0; } - private function updatePhars(string $jsonPath, OutputInterface $output) + private function updatePhars(string $jsonPath, OutputInterface $output): int { $phars = $this->findLatestPhars($jsonPath); @@ -192,7 +189,7 @@ function (string $phar) { { use Tools; - protected function configure() + protected function configure(): void { $this->setName('generate:html'); $this->setDescription('Generates an html list of available tools'); @@ -241,10 +238,6 @@ private function toolToHtml(): \Closure }; } - /** - * @param Collection|string[] $toolsHtml - * @return string - */ private function renderPage(Collection $toolsHtml): string { $template = <<<'TEMPLATE' diff --git a/src/Cli/Application.php b/src/Cli/Application.php index 7f25432..8078230 100644 --- a/src/Cli/Application.php +++ b/src/Cli/Application.php @@ -16,7 +16,7 @@ final class Application extends CliApplication { - private $serviceContainer; + private ServiceContainer $serviceContainer; public function __construct(string $version, ServiceContainer $serviceContainer) { @@ -27,6 +27,9 @@ public function __construct(string $version, ServiceContainer $serviceContainer) $this->setCommandLoader($this->createCommandLoader($serviceContainer)); } + /** + * @throws \Throwable + */ public function doRun(InputInterface $input, OutputInterface $output): int { $this->serviceContainer->set(InputInterface::class, $input); diff --git a/src/Cli/Command/InstallCommand.php b/src/Cli/Command/InstallCommand.php index f6c53fc..6c5ab9e 100644 --- a/src/Cli/Command/InstallCommand.php +++ b/src/Cli/Command/InstallCommand.php @@ -17,8 +17,8 @@ final class InstallCommand extends Command public const NAME = 'install'; - private $useCase; - private $runner; + private InstallTools $useCase; + private Runner $runner; public function __construct(InstallTools $useCase, Runner $runner) { @@ -28,7 +28,7 @@ public function __construct(InstallTools $useCase, Runner $runner) $this->runner = $runner; } - protected function configure() + protected function configure(): void { $this->setDescription('Installs tools'); $this->addOption('dry-run', null, InputOption::VALUE_NONE, 'Output the command without executing it'); diff --git a/src/Cli/Command/ListCommand.php b/src/Cli/Command/ListCommand.php index 7d3ea27..d29a35a 100644 --- a/src/Cli/Command/ListCommand.php +++ b/src/Cli/Command/ListCommand.php @@ -18,7 +18,7 @@ final class ListCommand extends Command public const NAME = 'list-tools'; - private $listTools; + private ListTools $listTools; public function __construct(ListTools $listTools) { @@ -27,7 +27,7 @@ public function __construct(ListTools $listTools) $this->listTools = $listTools; } - protected function configure() + protected function configure(): void { $this->setDescription('Lists available tools'); $this->addOption('exclude-tag', 'e', InputOption::VALUE_REQUIRED|InputOption::VALUE_IS_ARRAY, 'Tool tags to exclude', $this->defaultExcludeTag()); diff --git a/src/Cli/Command/TestCommand.php b/src/Cli/Command/TestCommand.php index 1443a65..7116991 100644 --- a/src/Cli/Command/TestCommand.php +++ b/src/Cli/Command/TestCommand.php @@ -17,8 +17,8 @@ final class TestCommand extends Command public const NAME = 'test'; - private $useCase; - private $runner; + private TestTools $useCase; + private Runner $runner; public function __construct(TestTools $useCase, Runner $runner) { @@ -28,7 +28,7 @@ public function __construct(TestTools $useCase, Runner $runner) $this->runner = $runner; } - protected function configure() + protected function configure(): void { $this->setDescription('Runs basic tests to verify tools are installed'); $this->addOption('dry-run', null, InputOption::VALUE_NONE, 'Output the command without executing it'); diff --git a/src/Cli/Runner/DryRunner.php b/src/Cli/Runner/DryRunner.php index 244ca60..109fb50 100644 --- a/src/Cli/Runner/DryRunner.php +++ b/src/Cli/Runner/DryRunner.php @@ -8,7 +8,7 @@ final class DryRunner implements Runner { - private $output; + private OutputInterface $output; public function __construct(OutputInterface $output) { diff --git a/src/Cli/ServiceContainer.php b/src/Cli/ServiceContainer.php index 11996ec..655005f 100644 --- a/src/Cli/ServiceContainer.php +++ b/src/Cli/ServiceContainer.php @@ -22,7 +22,7 @@ class ServiceContainer implements ContainerInterface { - private $services = [ + private array $services = [ InstallCommand::class => 'createInstallCommand', ListCommand::class => 'createListCommand', TestCommand::class => 'createTestCommand', @@ -33,7 +33,7 @@ class ServiceContainer implements ContainerInterface Tools::class => 'createTools', ]; - private $runtimeServices = [ + private array $runtimeServices = [ InputInterface::class => null, OutputInterface::class => null, ]; @@ -73,16 +73,28 @@ public function has(string $id): bool return isset($this->services[$id]) || isset($this->runtimeServices[$id]); } + /** + * @throws ContainerExceptionInterface + * @throws NotFoundExceptionInterface + */ private function createInstallCommand(): InstallCommand { return new InstallCommand($this->get(InstallTools::class), $this->get(Runner::class)); } + /** + * @throws ContainerExceptionInterface + * @throws NotFoundExceptionInterface + */ private function createListCommand(): ListCommand { return new ListCommand($this->get(ListTools::class)); } + /** + * @throws ContainerExceptionInterface + * @throws NotFoundExceptionInterface + */ private function createTestCommand(): TestCommand { return new TestCommand($this->get(TestTools::class), $this->get(Runner::class)); @@ -93,16 +105,28 @@ private function createRunner(): Runner return new LazyRunner(new RunnerFactory($this)); } + /** + * @throws ContainerExceptionInterface + * @throws NotFoundExceptionInterface + */ private function createInstallToolsUseCase(): InstallTools { return new InstallTools($this->get(Tools::class)); } + /** + * @throws ContainerExceptionInterface + * @throws NotFoundExceptionInterface + */ private function createListToolsUseCase(): ListTools { return new ListTools($this->get(Tools::class)); } + /** + * @throws ContainerExceptionInterface + * @throws NotFoundExceptionInterface + */ private function createTestToolsUseCase(): TestTools { return new TestTools($this->get(Tools::class)); diff --git a/src/Cli/ServiceContainer/LazyRunner.php b/src/Cli/ServiceContainer/LazyRunner.php index b2ce407..8f49a28 100644 --- a/src/Cli/ServiceContainer/LazyRunner.php +++ b/src/Cli/ServiceContainer/LazyRunner.php @@ -2,25 +2,35 @@ namespace Zalas\Toolbox\Cli\ServiceContainer; +use Psr\Container\ContainerExceptionInterface; +use Psr\Container\NotFoundExceptionInterface; use Zalas\Toolbox\Runner\Runner; use Zalas\Toolbox\Tool\Command; final class LazyRunner implements Runner { - private $runner; + private ?Runner $runner = null; - private $factory; + private RunnerFactory $factory; public function __construct(RunnerFactory $factory) { $this->factory = $factory; } + /** + * @throws ContainerExceptionInterface + * @throws NotFoundExceptionInterface + */ public function run(Command $command): int { return $this->runner()->run($command); } + /** + * @throws ContainerExceptionInterface + * @throws NotFoundExceptionInterface + */ private function runner(): Runner { if (null === $this->runner) { diff --git a/src/Cli/ServiceContainer/RunnerFactory.php b/src/Cli/ServiceContainer/RunnerFactory.php index 225c215..8056c42 100644 --- a/src/Cli/ServiceContainer/RunnerFactory.php +++ b/src/Cli/ServiceContainer/RunnerFactory.php @@ -4,6 +4,7 @@ use Psr\Container\ContainerExceptionInterface; use Psr\Container\ContainerInterface; +use Psr\Container\NotFoundExceptionInterface; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Zalas\Toolbox\Cli\Runner\DryRunner; @@ -13,13 +14,17 @@ class RunnerFactory { - private $container; + private ContainerInterface $container; public function __construct(ContainerInterface $container) { $this->container = $container; } + /** + * @throws ContainerExceptionInterface + * @throws NotFoundExceptionInterface + */ public function createRunner(): Runner { $runner = $this->createRealRunner(); @@ -32,9 +37,10 @@ public function createRunner(): Runner } /** - * @return DryRunner|PassthruRunner + * @throws ContainerExceptionInterface + * @throws NotFoundExceptionInterface */ - private function createRealRunner() + private function createRealRunner(): DryRunner|PassthruRunner { if ($this->container->get(InputInterface::class)->getOption('dry-run')) { return new DryRunner($this->container->get(OutputInterface::class)); @@ -43,6 +49,10 @@ private function createRealRunner() return new PassthruRunner(); } + /** + * @throws ContainerExceptionInterface + * @throws NotFoundExceptionInterface + */ private function parameters(): array { if ($targetDir = $this->targetDir()) { @@ -52,6 +62,10 @@ private function parameters(): array return []; } + /** + * @throws ContainerExceptionInterface + * @throws NotFoundExceptionInterface + */ private function targetDir(): ?string { if (!$this->container->get(InputInterface::class)->hasOption('target-dir')) { diff --git a/src/Json/Factory/Assert.php b/src/Json/Factory/Assert.php index 1ff0a1e..105becf 100644 --- a/src/Json/Factory/Assert.php +++ b/src/Json/Factory/Assert.php @@ -4,7 +4,7 @@ final class Assert { - public static function requireFields(array $fields, array $data, string $type) + public static function requireFields(array $fields, array $data, string $type): void { $missingFields = \array_filter($fields, function (string $field) use ($data) { return !isset($data[$field]); diff --git a/src/Json/JsonTools.php b/src/Json/JsonTools.php index c33f51f..ad5ff1a 100644 --- a/src/Json/JsonTools.php +++ b/src/Json/JsonTools.php @@ -7,7 +7,6 @@ use Zalas\Toolbox\Json\Factory\ToolFactory; use Zalas\Toolbox\Tool\Collection; use Zalas\Toolbox\Tool\Filter; -use Zalas\Toolbox\Tool\Tool; use Zalas\Toolbox\Tool\Tools; final class JsonTools implements Tools @@ -23,7 +22,8 @@ public function __construct(callable $resourceLocator) } /** - * @return Collection|Tool[] + * @param Filter $filter + * @return Collection */ public function all(Filter $filter): Collection { diff --git a/src/Runner/ParametrisedRunner.php b/src/Runner/ParametrisedRunner.php index 1f6ec04..b73a8f4 100644 --- a/src/Runner/ParametrisedRunner.php +++ b/src/Runner/ParametrisedRunner.php @@ -6,8 +6,8 @@ final class ParametrisedRunner implements Runner { - private $decoratedRunner; - private $parameters; + private Runner $decoratedRunner; + private array $parameters; public function __construct(Runner $decoratedRunner, array $parameters) { @@ -18,8 +18,8 @@ public function __construct(Runner $decoratedRunner, array $parameters) public function run(Command $command): int { return $this->decoratedRunner->run(new class($command, $this->parameters) implements Command { - private $command; - private $parameters; + private Command $command; + private array $parameters; public function __construct(Command $command, array $parameters) { diff --git a/src/Tool/Collection.php b/src/Tool/Collection.php index 0405da2..5493945 100644 --- a/src/Tool/Collection.php +++ b/src/Tool/Collection.php @@ -8,10 +8,7 @@ class Collection implements IteratorAggregate, Countable { - /** - * @var array - */ - private $elements; + private array $elements; private function __construct(array $elements) { diff --git a/src/Tool/Command/BoxBuildCommand.php b/src/Tool/Command/BoxBuildCommand.php index d2e0e8c..547a417 100644 --- a/src/Tool/Command/BoxBuildCommand.php +++ b/src/Tool/Command/BoxBuildCommand.php @@ -6,11 +6,11 @@ final class BoxBuildCommand implements Command { - private $repository; - private $phar; - private $bin; - private $workDir; - private $version; + private string $repository; + private string $phar; + private string $bin; + private string $workDir; + private ?string $version; public function __construct(string $repository, string $phar, string $bin, string $workDir, ?string $version = null) { diff --git a/src/Tool/Command/ComposerBinPluginCommand.php b/src/Tool/Command/ComposerBinPluginCommand.php index de66cea..0a2986c 100644 --- a/src/Tool/Command/ComposerBinPluginCommand.php +++ b/src/Tool/Command/ComposerBinPluginCommand.php @@ -7,11 +7,11 @@ final class ComposerBinPluginCommand implements Command { - private $package; + private string $package; - private $namespace; + private string $namespace; - private $links; + private Collection $links; public function __construct(string $package, string $namespace, Collection $links) { diff --git a/src/Tool/Command/ComposerBinPluginLinkCommand.php b/src/Tool/Command/ComposerBinPluginLinkCommand.php index cb2cd99..4587f52 100644 --- a/src/Tool/Command/ComposerBinPluginLinkCommand.php +++ b/src/Tool/Command/ComposerBinPluginLinkCommand.php @@ -6,9 +6,9 @@ final class ComposerBinPluginLinkCommand implements Command { - private $source; - private $target; - private $namespace; + private string $source; + private string $target; + private string $namespace; public function __construct(string $source, string $target, string $namespace) { diff --git a/src/Tool/Command/ComposerGlobalInstallCommand.php b/src/Tool/Command/ComposerGlobalInstallCommand.php index 1fef35c..70f3bd7 100644 --- a/src/Tool/Command/ComposerGlobalInstallCommand.php +++ b/src/Tool/Command/ComposerGlobalInstallCommand.php @@ -6,7 +6,7 @@ final class ComposerGlobalInstallCommand implements Command { - private $package; + private string $package; public function __construct(string $package) { diff --git a/src/Tool/Command/ComposerGlobalMultiInstallCommand.php b/src/Tool/Command/ComposerGlobalMultiInstallCommand.php index 1a2b1e7..7ee962f 100644 --- a/src/Tool/Command/ComposerGlobalMultiInstallCommand.php +++ b/src/Tool/Command/ComposerGlobalMultiInstallCommand.php @@ -8,7 +8,7 @@ final class ComposerGlobalMultiInstallCommand implements Command { - private $commands; + private Collection $commands; public function __construct(Collection $commands) { diff --git a/src/Tool/Command/ComposerInstallCommand.php b/src/Tool/Command/ComposerInstallCommand.php index 519c04c..74f0840 100644 --- a/src/Tool/Command/ComposerInstallCommand.php +++ b/src/Tool/Command/ComposerInstallCommand.php @@ -6,9 +6,9 @@ final class ComposerInstallCommand implements Command { - private $repository; - private $targetDir; - private $version; + private string $repository; + private string $targetDir; + private ?string $version; public function __construct(string $repository, string $targetDir, ?string $version = null) { diff --git a/src/Tool/Command/FileDownloadCommand.php b/src/Tool/Command/FileDownloadCommand.php index 9b910f4..610b380 100644 --- a/src/Tool/Command/FileDownloadCommand.php +++ b/src/Tool/Command/FileDownloadCommand.php @@ -6,8 +6,8 @@ final class FileDownloadCommand implements Command { - private $url; - private $file; + private string $url; + private string $file; public function __construct(string $url, string $file) { diff --git a/src/Tool/Command/MultiStepCommand.php b/src/Tool/Command/MultiStepCommand.php index 5763171..1ef8ddc 100644 --- a/src/Tool/Command/MultiStepCommand.php +++ b/src/Tool/Command/MultiStepCommand.php @@ -8,8 +8,8 @@ final class MultiStepCommand implements Command { - private $commands; - private $glue; + private Collection $commands; + private mixed $glue; public function __construct(Collection $commands, $glue = ' && ') { diff --git a/src/Tool/Command/OptimisedComposerBinPluginCommand.php b/src/Tool/Command/OptimisedComposerBinPluginCommand.php index e7d0c62..78d23dc 100644 --- a/src/Tool/Command/OptimisedComposerBinPluginCommand.php +++ b/src/Tool/Command/OptimisedComposerBinPluginCommand.php @@ -8,7 +8,7 @@ final class OptimisedComposerBinPluginCommand implements Command { - private $commands; + private Collection $commands; public function __construct(Collection $commands) { diff --git a/src/Tool/Command/PharDownloadCommand.php b/src/Tool/Command/PharDownloadCommand.php index 8037541..92a3532 100644 --- a/src/Tool/Command/PharDownloadCommand.php +++ b/src/Tool/Command/PharDownloadCommand.php @@ -6,8 +6,8 @@ final class PharDownloadCommand implements Command { - private $phar; - private $bin; + private string $phar; + private string $bin; public function __construct(string $phar, string $bin) { diff --git a/src/Tool/Command/PhiveInstallCommand.php b/src/Tool/Command/PhiveInstallCommand.php index 790cad0..e0dbf44 100644 --- a/src/Tool/Command/PhiveInstallCommand.php +++ b/src/Tool/Command/PhiveInstallCommand.php @@ -6,9 +6,9 @@ final class PhiveInstallCommand implements Command { - private $alias; - private $bin; - private $sig; + private string $alias; + private string $bin; + private ?string $sig; public function __construct(string $alias, string $bin, ?string $sig = null) { diff --git a/src/Tool/Command/ShCommand.php b/src/Tool/Command/ShCommand.php index f2b058e..0e8acc5 100644 --- a/src/Tool/Command/ShCommand.php +++ b/src/Tool/Command/ShCommand.php @@ -6,7 +6,7 @@ final class ShCommand implements Command { - private $command; + private string $command; public function __construct(string $command) { diff --git a/src/Tool/Command/TestCommand.php b/src/Tool/Command/TestCommand.php index 2c539b9..2b591cf 100644 --- a/src/Tool/Command/TestCommand.php +++ b/src/Tool/Command/TestCommand.php @@ -6,8 +6,8 @@ final class TestCommand implements Command { - private $command; - private $name; + private string $command; + private string $name; public function __construct(string $command, string $name) { diff --git a/src/Tool/Filter.php b/src/Tool/Filter.php index afcbcb6..8434161 100644 --- a/src/Tool/Filter.php +++ b/src/Tool/Filter.php @@ -7,12 +7,12 @@ class Filter /** * @var string[] */ - private $excludedTags; + private array $excludedTags; /** * @var string[] */ - private $tags; + private array $tags; /** * @param string[] $excludedTags diff --git a/src/Tool/Tool.php b/src/Tool/Tool.php index d7033b3..b1b019a 100644 --- a/src/Tool/Tool.php +++ b/src/Tool/Tool.php @@ -4,12 +4,12 @@ class Tool { - private $name; - private $summary; - private $website; - private $command; - private $testCommand; - private $tags; + private string $name; + private string $summary; + private string $website; + private Command $command; + private Command $testCommand; + private array $tags; public function __construct(string $name, string $summary, string $website, array $tags, Command $command, Command $testCommand) { diff --git a/src/Tool/Tools.php b/src/Tool/Tools.php index 99b5d15..eb38e49 100644 --- a/src/Tool/Tools.php +++ b/src/Tool/Tools.php @@ -7,7 +7,8 @@ interface Tools { /** - * @return Collection|Tool[] + * @param Filter $filter + * @return Collection * @throws RuntimeException in case tools cannot be loaded */ public function all(Filter $filter): Collection; diff --git a/src/UseCase/InstallTools.php b/src/UseCase/InstallTools.php index 5b49fe6..4fdf707 100644 --- a/src/UseCase/InstallTools.php +++ b/src/UseCase/InstallTools.php @@ -24,7 +24,7 @@ class InstallTools { public const PRE_INSTALLATION_TAG = 'pre-installation'; - private $tools; + private Tools $tools; public function __construct(Tools $tools) { @@ -60,7 +60,7 @@ private function commandFilter(Collection $commands): Closure }; } - private function installationCommands(Collection $tools) + private function installationCommands(Collection $tools): Collection { return $tools->filter(function (Tool $tool) { return \in_array(self::PRE_INSTALLATION_TAG, $tool->tags()); @@ -69,7 +69,7 @@ private function installationCommands(Collection $tools) }); } - private function toolCommands(Collection $tools) + private function toolCommands(Collection $tools): Collection { return $tools->filter(function (Tool $tool) { return !\in_array(self::PRE_INSTALLATION_TAG, $tool->tags()); diff --git a/src/UseCase/ListTools.php b/src/UseCase/ListTools.php index 04f1ab9..7f761c5 100644 --- a/src/UseCase/ListTools.php +++ b/src/UseCase/ListTools.php @@ -4,24 +4,17 @@ use Zalas\Toolbox\Tool\Collection; use Zalas\Toolbox\Tool\Filter; -use Zalas\Toolbox\Tool\Tool; use Zalas\Toolbox\Tool\Tools; class ListTools { - /** - * @var Tools - */ - private $tools; + private Tools $tools; public function __construct(Tools $tools) { $this->tools = $tools; } - /** - * @return Collection|Tool[] - */ public function __invoke(Filter $filter): Collection { return $this->tools->all($filter); diff --git a/src/UseCase/TestTools.php b/src/UseCase/TestTools.php index 4c255bb..6468113 100644 --- a/src/UseCase/TestTools.php +++ b/src/UseCase/TestTools.php @@ -10,7 +10,7 @@ class TestTools { - private $tools; + private Tools $tools; public function __construct(Tools $tools) { diff --git a/tests/Cli/ApplicationTest.php b/tests/Cli/ApplicationTest.php index 7963c00..a880c03 100644 --- a/tests/Cli/ApplicationTest.php +++ b/tests/Cli/ApplicationTest.php @@ -2,7 +2,6 @@ namespace Zalas\Toolbox\Tests\Cli; -use PHPUnit\Framework\MockObject\Stub; use PHPUnit\Framework\TestCase; use Symfony\Component\Console\Application as CliApplication; use Symfony\Component\Console\Input\ArrayInput; @@ -18,20 +17,12 @@ class ApplicationTest extends TestCase { private const VERSION = 'test'; - /** - * @var Application - */ - private $app; - - /** - * @var ServiceContainer|Stub - */ - private $container; + private Application $app; protected function setUp(): void { - $this->container = $this->createStub(ServiceContainer::class); - $this->app = new Application(self::VERSION, $this->container); + $container = $this->createStub(ServiceContainer::class); + $this->app = new Application(self::VERSION, $container); } public function test_it_is_a_cli_application() diff --git a/tests/Cli/Command/InstallCommandTest.php b/tests/Cli/Command/InstallCommandTest.php index 227fa93..2081e85 100644 --- a/tests/Cli/Command/InstallCommandTest.php +++ b/tests/Cli/Command/InstallCommandTest.php @@ -15,15 +15,9 @@ class InstallCommandTest extends ToolboxCommandTestCase { protected const CLI_COMMAND_NAME = InstallCommand::NAME; - /** - * @var Runner|Stub - */ - private $runner; - - /** - * @var InstallTools|Stub - */ - private $useCase; + private Runner|Stub $runner; + + private InstallTools|Stub $useCase; protected function setUp(): void { diff --git a/tests/Cli/Command/ListCommandTest.php b/tests/Cli/Command/ListCommandTest.php index 1d7142d..8195b76 100644 --- a/tests/Cli/Command/ListCommandTest.php +++ b/tests/Cli/Command/ListCommandTest.php @@ -16,10 +16,7 @@ class ListCommandTest extends ToolboxCommandTestCase { protected const CLI_COMMAND_NAME = ListCommand::NAME; - /** - * @var ListTools|Stub - */ - private $useCase; + private ListTools|Stub $useCase; protected function setUp(): void { diff --git a/tests/Cli/Command/TestCommandTest.php b/tests/Cli/Command/TestCommandTest.php index d219869..1f8b5a2 100644 --- a/tests/Cli/Command/TestCommandTest.php +++ b/tests/Cli/Command/TestCommandTest.php @@ -15,15 +15,9 @@ class TestCommandTest extends ToolboxCommandTestCase { protected const CLI_COMMAND_NAME = TestCommand::NAME; - /** - * @var Runner|Stub - */ - private $runner; - - /** - * @var TestTools|Stub - */ - private $useCase; + private Runner|Stub $runner; + + private TestTools|Stub $useCase; protected function setUp(): void { diff --git a/tests/Cli/Command/ToolboxCommandTestCase.php b/tests/Cli/Command/ToolboxCommandTestCase.php index b186549..0b1b24c 100644 --- a/tests/Cli/Command/ToolboxCommandTestCase.php +++ b/tests/Cli/Command/ToolboxCommandTestCase.php @@ -12,10 +12,7 @@ abstract class ToolboxCommandTestCase extends TestCase { protected const CLI_COMMAND_NAME = ''; - /** - * @var Application - */ - protected $app; + protected Application $app; protected function setUp(): void { @@ -48,7 +45,7 @@ protected function cliCommand(): Command private function createServiceContainer(): ServiceContainer { return new class($this->getContainerTestDoubles()) extends ServiceContainer { - private $services; + private array $services; public function __construct(array $services) { diff --git a/tests/Cli/Runner/DryRunnerTest.php b/tests/Cli/Runner/DryRunnerTest.php index 032ea60..719a873 100644 --- a/tests/Cli/Runner/DryRunnerTest.php +++ b/tests/Cli/Runner/DryRunnerTest.php @@ -11,15 +11,9 @@ class DryRunnerTest extends TestCase { - /** - * @var DryRunner - */ - private $runner; - - /** - * @var OutputInterface|MockObject - */ - private $out; + private DryRunner $runner; + + private OutputInterface|MockObject $out; protected function setUp(): void { diff --git a/tests/Cli/ServiceContainer/LazyRunnerTest.php b/tests/Cli/ServiceContainer/LazyRunnerTest.php index 4144b01..de7dd73 100644 --- a/tests/Cli/ServiceContainer/LazyRunnerTest.php +++ b/tests/Cli/ServiceContainer/LazyRunnerTest.php @@ -11,15 +11,9 @@ class LazyRunnerTest extends TestCase { - /** - * @var LazyRunner - */ - private $lazyRunner; - - /** - * @var RunnerFactory|MockObject - */ - private $factory; + private LazyRunner $lazyRunner; + + private RunnerFactory|MockObject $factory; protected function setUp(): void { diff --git a/tests/Cli/ServiceContainer/RunnerFactoryTest.php b/tests/Cli/ServiceContainer/RunnerFactoryTest.php index af3c75e..27e75d6 100644 --- a/tests/Cli/ServiceContainer/RunnerFactoryTest.php +++ b/tests/Cli/ServiceContainer/RunnerFactoryTest.php @@ -19,34 +19,20 @@ class RunnerFactoryTest extends TestCase { - /** - * @var ContainerInterface - */ - private $container; - - /** - * @var RunnerFactory - */ - private $runnerFactory; - - /** - * @var InputInterface - */ - private $input; - - /** - * @var OutputInterface|MockObject - */ - private $output; + private RunnerFactory $runnerFactory; + + private InputInterface $input; + + private OutputInterface|MockObject $output; protected function setUp(): void { $this->input = $this->givenInput([]); $this->output = $this->createMock(OutputInterface::class); - $this->container = new class([ InputInterface::class => &$this->input, OutputInterface::class => &$this->output, ]) implements ContainerInterface { + $container = new class([ InputInterface::class => &$this->input, OutputInterface::class => &$this->output, ]) implements ContainerInterface { - public function __construct(private array $services) + public function __construct(private readonly array $services) { } @@ -61,7 +47,7 @@ public function has(string $id): bool } }; - $this->runnerFactory = new RunnerFactory($this->container); + $this->runnerFactory = new RunnerFactory($container); } public function test_it_creates_the_passthru_runner_by_default() diff --git a/tests/Cli/ServiceContainerTest.php b/tests/Cli/ServiceContainerTest.php index 56260c5..0667fd2 100644 --- a/tests/Cli/ServiceContainerTest.php +++ b/tests/Cli/ServiceContainerTest.php @@ -18,10 +18,7 @@ class ServiceContainerTest extends TestCase { - /** - * @var ServiceContainer - */ - private $container; + private ServiceContainer $container; protected function setUp(): void { @@ -47,7 +44,7 @@ public function test_it_creates_application_services(string $serviceId, string $ $this->assertInstanceOf($expectedType, $this->container->get($serviceId)); } - public static function provideApplicationServices() + public static function provideApplicationServices(): \Generator { yield [InstallCommand::class, InstallCommand::class]; yield [ListCommand::class, ListCommand::class]; diff --git a/tests/Runner/ParametrisedRunnerTest.php b/tests/Runner/ParametrisedRunnerTest.php index c393454..17a1146 100644 --- a/tests/Runner/ParametrisedRunnerTest.php +++ b/tests/Runner/ParametrisedRunnerTest.php @@ -11,15 +11,9 @@ class ParametrisedRunnerTest extends TestCase { - /** - * @var ParametrisedRunner - */ - private $runner; - - /** - * @var Runner|Stub - */ - private $decoratedRunner; + private ParametrisedRunner $runner; + + private Runner|Stub $decoratedRunner; protected function setUp(): void { diff --git a/tests/Tool/CollectionTest.php b/tests/Tool/CollectionTest.php index c524b4a..48b24d3 100644 --- a/tests/Tool/CollectionTest.php +++ b/tests/Tool/CollectionTest.php @@ -1,8 +1,9 @@ assertIterates(['ab', 'c', 'aa', 'aaa'], $c, 'The original collection is not modified'); } - private function assertIterates(array $elements, Collection $c) + private function assertIterates(array $elements, Collection $c, string $message = ''): void { - $this->assertSame($elements, \iterator_to_array($c)); + $this->assertSame($elements, \iterator_to_array($c), $message); } } diff --git a/tests/Tool/Command/ComposerBinPluginCommandTest.php b/tests/Tool/Command/ComposerBinPluginCommandTest.php index 4566939..39d9094 100644 --- a/tests/Tool/Command/ComposerBinPluginCommandTest.php +++ b/tests/Tool/Command/ComposerBinPluginCommandTest.php @@ -13,10 +13,7 @@ class ComposerBinPluginCommandTest extends TestCase private const PACKAGE = 'phpstan/phpstan'; private const NAMESPACE = 'tools'; - /** - * @var ComposerBinPluginCommand - */ - private $command; + private ComposerBinPluginCommand $command; protected function setUp(): void { diff --git a/tests/Tool/Command/ComposerBinPluginLinkCommandTest.php b/tests/Tool/Command/ComposerBinPluginLinkCommandTest.php index d360d5c..9ded7fc 100644 --- a/tests/Tool/Command/ComposerBinPluginLinkCommandTest.php +++ b/tests/Tool/Command/ComposerBinPluginLinkCommandTest.php @@ -12,10 +12,7 @@ final class ComposerBinPluginLinkCommandTest extends TestCase private const TARGET = '/tools/churn'; private const NAMESPACE = 'tools'; - /** - * @var ComposerBinPluginLinkCommand - */ - private $command; + private ComposerBinPluginLinkCommand $command; protected function setUp(): void { diff --git a/tests/Tool/Command/ComposerGlobalInstallCommandTest.php b/tests/Tool/Command/ComposerGlobalInstallCommandTest.php index 748d17e..33d5ace 100644 --- a/tests/Tool/Command/ComposerGlobalInstallCommandTest.php +++ b/tests/Tool/Command/ComposerGlobalInstallCommandTest.php @@ -10,10 +10,7 @@ class ComposerGlobalInstallCommandTest extends TestCase { private const PACKAGE = 'phan/phan'; - /** - * @var ComposerGlobalInstallCommand - */ - private $command; + private ComposerGlobalInstallCommand $command; protected function setUp(): void { diff --git a/tests/Tool/Command/FileDownloadCommandTest.php b/tests/Tool/Command/FileDownloadCommandTest.php index a155f7d..25a2942 100644 --- a/tests/Tool/Command/FileDownloadCommandTest.php +++ b/tests/Tool/Command/FileDownloadCommandTest.php @@ -11,10 +11,7 @@ class FileDownloadCommandTest extends TestCase private const URL = 'https://example.com/file'; private const FILE = '/usr/local/bin/file.txt'; - /** - * @var FileDownloadCommand - */ - private $command; + private FileDownloadCommand $command; protected function setUp(): void { diff --git a/tests/Tool/Command/PharDownloadCommandTest.php b/tests/Tool/Command/PharDownloadCommandTest.php index f7c0451..ca4cd00 100644 --- a/tests/Tool/Command/PharDownloadCommandTest.php +++ b/tests/Tool/Command/PharDownloadCommandTest.php @@ -11,7 +11,7 @@ class PharDownloadCommandTest extends TestCase private const PHAR = 'https://example.com/foo.phar'; private const BIN = '/usr/local/bin/foo'; - private $command; + private PharDownloadCommand $command; protected function setUp(): void { diff --git a/tests/Tool/Command/PhiveInstallCommandTest.php b/tests/Tool/Command/PhiveInstallCommandTest.php index 7943152..7683f10 100644 --- a/tests/Tool/Command/PhiveInstallCommandTest.php +++ b/tests/Tool/Command/PhiveInstallCommandTest.php @@ -12,7 +12,7 @@ class PhiveInstallCommandTest extends TestCase private const BIN = '/usr/local/bin/foo'; private const SIG = '0000000000000000'; - private $command; + private PhiveInstallCommand $command; protected function setUp(): void { diff --git a/tests/UseCase/InstallToolsTest.php b/tests/UseCase/InstallToolsTest.php index 2cad1d2..5fe8c58 100644 --- a/tests/UseCase/InstallToolsTest.php +++ b/tests/UseCase/InstallToolsTest.php @@ -23,15 +23,9 @@ class InstallToolsTest extends TestCase { - /** - * @var InstallTools - */ - private $useCase; - - /** - * @var Tools|Stub - */ - private $tools; + private InstallTools $useCase; + + private Tools|Stub $tools; protected function setUp(): void { From 1fb1ed2c7e941a023b2b457a7d4fc8ca77974d4f Mon Sep 17 00:00:00 2001 From: Jakub Zalas Date: Thu, 13 Mar 2025 10:15:34 +0000 Subject: [PATCH 10/32] Update the key for composer-unused --- resources/composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/composer.json b/resources/composer.json index 0b41c8a..93fe87c 100644 --- a/resources/composer.json +++ b/resources/composer.json @@ -23,7 +23,7 @@ "phive-install": { "alias": "composer-unused", "bin": "%target-dir%/composer-unused", - "sig": "B1B5F6D21AB070E1" + "sig": "3135AA4CB4F1AB0B" } }, "test": "composer-unused -V", From 6663022ecd87615152188984e37322e37a14e9cf Mon Sep 17 00:00:00 2001 From: Jakub Zalas Date: Thu, 13 Mar 2025 10:22:41 +0000 Subject: [PATCH 11/32] Add davidrjonas/composer-lock-diff --- README.md | 1 + resources/composer.json | 15 +++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/README.md b/README.md index 6f470c9..39269db 100644 --- a/README.md +++ b/README.md @@ -23,6 +23,7 @@ It has been extracted as a separate project to make maintenance easier and enabl | codeception | [Codeception is a BDD-styled PHP testing framework](https://codeception.com/) | ✅ | ✅ | ✅ | | composer | [Dependency Manager for PHP](https://getcomposer.org/) | ✅ | ✅ | ✅ | | composer-bin-plugin | [Composer plugin to install bin vendors in isolated locations](https://github.com/bamarni/composer-bin-plugin) | ✅ | ✅ | ✅ | +| composer-lock-diff | [Composer plugin to check what has changed after a composer update](https://github.com/davidrjonas/composer-lock-diff) | ✅ | ✅ | ✅ | | composer-normalize | [Composer plugin to normalize composer.json files](https://github.com/ergebnis/composer-normalize) | ✅ | ✅ | ✅ | | composer-require-checker | [Verify that no unknown symbols are used in the sources of a package.](https://github.com/maglnet/ComposerRequireChecker) | ✅ | ✅ | ✅ | | composer-require-checker-3 | [Verify that no unknown symbols are used in the sources of a package.](https://github.com/maglnet/ComposerRequireChecker) | ✅ | ✅ | ✅ | diff --git a/resources/composer.json b/resources/composer.json index 93fe87c..6bf0cb7 100644 --- a/resources/composer.json +++ b/resources/composer.json @@ -71,6 +71,21 @@ }, "test": "composer global show cyclonedx/cyclonedx-php-composer", "tags": ["composer"] + }, + { + "name": "composer-lock-diff", + "summary": "Composer plugin to check what has changed after a composer update", + "website": "https://github.com/davidrjonas/composer-lock-diff", + "command": { + "sh": { + "command": "composer global config --no-plugins allow-plugins.davidrjonas/composer-lock-diff true" + }, + "composer-global-install": { + "package": "davidrjonas/composer-lock-diff" + } + }, + "test": "composer global show davidrjonas/composer-lock-diff", + "tags": ["composer"] } ] } From 6959dc453f79df0dc853aa8b3496d8123db8ca79 Mon Sep 17 00:00:00 2001 From: Jakub Zalas Date: Thu, 13 Mar 2025 14:49:17 +0000 Subject: [PATCH 12/32] Remove pepakriz/phpstan-exception-rules The package is becoming obsolete (see https://github.com/pepakriz/phpstan-exception-rules/issues/148). It seems to be the only phpstan extension we provide that does not support phpstan v2 (see https://github.com/jakzal/phpqa/issues/433). --- README.md | 2 +- resources/phpstan.json | 13 ------------- 2 files changed, 1 insertion(+), 14 deletions(-) diff --git a/README.md b/README.md index 39269db..d4edff9 100644 --- a/README.md +++ b/README.md @@ -73,7 +73,6 @@ It has been extracted as a separate project to make maintenance easier and enabl | phpstan-deprecation-rules | [PHPStan rules for detecting deprecated code](https://github.com/phpstan/phpstan-deprecation-rules) | ✅ | ✅ | ✅ | | phpstan-doctrine | [Doctrine extensions for PHPStan](https://github.com/phpstan/phpstan-doctrine) | ✅ | ✅ | ✅ | | phpstan-ergebnis-rules | [Additional rules for PHPstan](https://github.com/ergebnis/phpstan-rules) | ✅ | ✅ | ✅ | -| phpstan-exception-rules | [PHPStan rules for checked and unchecked exceptions](https://github.com/pepakriz/phpstan-exception-rules) | ✅ | ✅ | ✅ | | phpstan-larastan | [Separate installation of phpstan for larastan](https://github.com/phpstan/phpstan) | ✅ | ✅ | ✅ | | phpstan-phpunit | [PHPUnit extensions and rules for PHPStan](https://github.com/phpstan/phpstan-phpunit) | ✅ | ✅ | ✅ | | phpstan-strict-rules | [Extra strict and opinionated rules for PHPStan](https://github.com/phpstan/phpstan-strict-rules) | ✅ | ✅ | ✅ | @@ -113,6 +112,7 @@ It has been extracted as a separate project to make maintenance easier and enabl | phpcf | [Finds usage of deprecated features](http://wapmorgan.github.io/PhpCodeFixer/) | | phpda | [Generates dependency graphs](https://mamuz.github.io/PhpDependencyAnalysis/) | | phpdoc-to-typehint | [Automatically adds type hints and return types based on PHPDocs](https://github.com/dunglas/phpdoc-to-typehint) | +| phpstan-exception-rules | [PHPStan rules for checked and unchecked exceptions](https://github.com/pepakriz/phpstan-exception-rules) | | phpstan-localheinz-rules | [Additional rules for PHPstan](https://github.com/localheinz/phpstan-rules) | | phpunit-5 | [The PHP testing framework (5.x version)](https://phpunit.de/) | | phpunit-7 | [The PHP testing framework (7.x version)](https://phpunit.de/) | diff --git a/resources/phpstan.json b/resources/phpstan.json index 5dcf3c5..a8c3172 100644 --- a/resources/phpstan.json +++ b/resources/phpstan.json @@ -118,19 +118,6 @@ "test": "composer global bin phpstan show phpstan/phpstan-webmozart-assert", "tags": ["phpstan"] }, - { - "name": "phpstan-exception-rules", - "summary": "PHPStan rules for checked and unchecked exceptions", - "website": "https://github.com/pepakriz/phpstan-exception-rules", - "command": { - "composer-bin-plugin": { - "package": "pepakriz/phpstan-exception-rules", - "namespace": "phpstan" - } - }, - "test": "composer global bin phpstan show pepakriz/phpstan-exception-rules", - "tags": ["phpstan"] - }, { "name": "phpat", "summary": "Easy to use architecture testing tool", From 54406c6431d8092635f0f4d0a74522c94aaa2752 Mon Sep 17 00:00:00 2001 From: Jakub Zalas Date: Thu, 13 Mar 2025 14:57:51 +0000 Subject: [PATCH 13/32] Add dantleech/gherkin-lint-php Closes https://github.com/jakzal/toolbox/issues/442 --- README.md | 1 + resources/linting.json | 14 ++++++++++++++ 2 files changed, 15 insertions(+) diff --git a/README.md b/README.md index 39269db..2a17502 100644 --- a/README.md +++ b/README.md @@ -34,6 +34,7 @@ It has been extracted as a separate project to make maintenance easier and enabl | deptrac | [Enforces dependency rules between software layers](https://github.com/deptrac/deptrac) | ✅ | ✅ | ✅ | | diffFilter | [Applies QA tools to run on a single pull request](https://github.com/exussum12/coverageChecker) | ✅ | ✅ | ✅ | | ecs | [Sets up and runs coding standard checks](https://github.com/Symplify/EasyCodingStandard) | ✅ | ✅ | ✅ | +| gherkin-lint-php | [Gherkin linter for PHP](https://github.com/dantleech/gherkin-lint-php) | ✅ | ✅ | ✅ | | infection | [AST based PHP Mutation Testing Framework](https://infection.github.io/) | ✅ | ✅ | ✅ | | larastan | [PHPStan extension for Laravel](https://github.com/nunomaduro/larastan) | ✅ | ✅ | ✅ | | local-php-security-checker | [Checks composer dependencies for known security vulnerabilities](https://github.com/fabpot/local-php-security-checker) | ✅ | ✅ | ✅ | diff --git a/resources/linting.json b/resources/linting.json index 9a87b64..d0b3113 100644 --- a/resources/linting.json +++ b/resources/linting.json @@ -67,6 +67,20 @@ }, "test": "twig-linter --help", "tags": ["linting"] + }, + { + "name": "gherkin-lint-php", + "summary": "Gherkin linter for PHP", + "website": "https://github.com/dantleech/gherkin-lint-php", + "command": { + "composer-bin-plugin": { + "package": "dantleech/gherkin-lint", + "namespace": "gherkin-lint-php", + "links": {"%target-dir%/gherkinlint": "gherkinlint"} + } + }, + "test": "gherkinlint --help", + "tags": ["linting"] } ] } From f923714904423e35e66c97c6a9884f6f8257d625 Mon Sep 17 00:00:00 2001 From: Jakub Zalas Date: Thu, 13 Mar 2025 15:40:45 +0000 Subject: [PATCH 14/32] Add tomasvotruba/lines Closes https://github.com/jakzal/toolbox/issues/486 --- README.md | 1 + resources/metrics.json | 14 ++++++++++++++ 2 files changed, 15 insertions(+) diff --git a/README.md b/README.md index 7ca8102..d8a9349 100644 --- a/README.md +++ b/README.md @@ -37,6 +37,7 @@ It has been extracted as a separate project to make maintenance easier and enabl | gherkin-lint-php | [Gherkin linter for PHP](https://github.com/dantleech/gherkin-lint-php) | ✅ | ✅ | ✅ | | infection | [AST based PHP Mutation Testing Framework](https://infection.github.io/) | ✅ | ✅ | ✅ | | larastan | [PHPStan extension for Laravel](https://github.com/nunomaduro/larastan) | ✅ | ✅ | ✅ | +| lines | [CLI tool for quick metrics of PHP projects](https://github.com/tomasVotruba/lines) | ✅ | ✅ | ✅ | | local-php-security-checker | [Checks composer dependencies for known security vulnerabilities](https://github.com/fabpot/local-php-security-checker) | ✅ | ✅ | ✅ | | parallel-lint | [Checks PHP file syntax](https://github.com/php-parallel-lint/PHP-Parallel-Lint) | ✅ | ✅ | ✅ | | paratest | [Parallel testing for PHPUnit](https://github.com/paratestphp/paratest) | ✅ | ✅ | ✅ | diff --git a/resources/metrics.json b/resources/metrics.json index e19e5c1..07bc7bd 100644 --- a/resources/metrics.json +++ b/resources/metrics.json @@ -43,6 +43,20 @@ }, "test": "phpmetrics --version", "tags": ["featured", "metrics"] + }, + { + "name": "lines", + "summary": "CLI tool for quick metrics of PHP projects", + "website": "https://github.com/tomasVotruba/lines", + "command": { + "composer-bin-plugin": { + "package": "tomasvotruba/lines", + "namespace": "lines", + "links": {"%target-dir%/lines": "lines"} + } + }, + "test": "lines list -q", + "tags": ["metrics"] } ] } From daa111c1feecda44f4da830469eec187ec8a13c0 Mon Sep 17 00:00:00 2001 From: Jakub Zalas Date: Thu, 13 Mar 2025 15:35:19 +0000 Subject: [PATCH 15/32] Install davidrjonas/composer-lock-diff in its own namespace --- resources/composer.json | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/resources/composer.json b/resources/composer.json index 6bf0cb7..bee3b31 100644 --- a/resources/composer.json +++ b/resources/composer.json @@ -77,14 +77,13 @@ "summary": "Composer plugin to check what has changed after a composer update", "website": "https://github.com/davidrjonas/composer-lock-diff", "command": { - "sh": { - "command": "composer global config --no-plugins allow-plugins.davidrjonas/composer-lock-diff true" - }, - "composer-global-install": { - "package": "davidrjonas/composer-lock-diff" + "composer-bin-plugin": { + "package": "davidrjonas/composer-lock-diff", + "namespace": "composer-lock-diff", + "links": {"%target-dir%/composer-lock-diff": "composer-lock-diff"} } }, - "test": "composer global show davidrjonas/composer-lock-diff", + "test": "composer-lock-diff --help", "tags": ["composer"] } ] From b2ebfe292786d36c7573dbd61ef625227afaaf1c Mon Sep 17 00:00:00 2001 From: Jakub Zalas Date: Thu, 13 Mar 2025 15:59:17 +0000 Subject: [PATCH 16/32] Add kahlan --- README.md | 1 + resources/test.json | 14 ++++++++++++++ 2 files changed, 15 insertions(+) diff --git a/README.md b/README.md index d8a9349..23ba30f 100644 --- a/README.md +++ b/README.md @@ -36,6 +36,7 @@ It has been extracted as a separate project to make maintenance easier and enabl | ecs | [Sets up and runs coding standard checks](https://github.com/Symplify/EasyCodingStandard) | ✅ | ✅ | ✅ | | gherkin-lint-php | [Gherkin linter for PHP](https://github.com/dantleech/gherkin-lint-php) | ✅ | ✅ | ✅ | | infection | [AST based PHP Mutation Testing Framework](https://infection.github.io/) | ✅ | ✅ | ✅ | +| kahlan | [Kahlan is a full-featured Unit & BDD test framework a la RSpec/JSpec](https://kahlan.github.io/docs/) | ✅ | ✅ | ✅ | | larastan | [PHPStan extension for Laravel](https://github.com/nunomaduro/larastan) | ✅ | ✅ | ✅ | | lines | [CLI tool for quick metrics of PHP projects](https://github.com/tomasVotruba/lines) | ✅ | ✅ | ✅ | | local-php-security-checker | [Checks composer dependencies for known security vulnerabilities](https://github.com/fabpot/local-php-security-checker) | ✅ | ✅ | ✅ | diff --git a/resources/test.json b/resources/test.json index 9ee36f0..cb328d6 100644 --- a/resources/test.json +++ b/resources/test.json @@ -198,6 +198,20 @@ }, "test": "simple-phpunit --version", "tags": ["test"] + }, + { + "name": "kahlan", + "summary": "Kahlan is a full-featured Unit & BDD test framework a la RSpec/JSpec", + "website": "https://kahlan.github.io/docs/", + "command": { + "composer-bin-plugin": { + "package": "kahlan/kahlan", + "namespace": "kahlan", + "links": {"%target-dir%/kahlan": "kahlan"} + } + }, + "test": "kahlan --version", + "tags": ["test"] } ] } From 0b8a0cff8d2be6b51b18b7203310ec28a70efa95 Mon Sep 17 00:00:00 2001 From: Jakub Zalas Date: Mon, 14 Apr 2025 11:17:13 +0100 Subject: [PATCH 17/32] Disable php-smever-checker until it is available again --- README.md | 2 +- resources/compatibility.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 23ba30f..2d1a7aa 100644 --- a/README.md +++ b/README.md @@ -48,7 +48,7 @@ It has been extracted as a separate project to make maintenance easier and enabl | phive | [PHAR Installation and Verification Environment](https://phar.io/) | ✅ | ✅ | ✅ | | php-cs-fixer | [PHP Coding Standards Fixer](http://cs.symfony.com/) | ✅ | ✅ | ❌ | | php-fuzzer | [A fuzzer for PHP, which can be used to find bugs in libraries by feeding them 'random' inputs](https://github.com/nikic/PHP-Fuzzer) | ✅ | ✅ | ✅ | -| php-semver-checker | [Suggests a next version according to semantic versioning](https://github.com/tomzx/php-semver-checker) | ✅ | ✅ | ✅ | +| php-semver-checker | [Suggests a next version according to semantic versioning](https://github.com/tomzx/php-semver-checker) | ❌ | ❌ | ❌ | | phpa | [Checks for weak assumptions](https://github.com/rskuipers/php-assumptions) | ✅ | ✅ | ✅ | | phparkitect | [Helps to put architectural constraints in a PHP code base](https://github.com/phparkitect/arkitect) | ✅ | ✅ | ✅ | | phpat | [Easy to use architecture testing tool](https://github.com/carlosas/phpat) | ✅ | ✅ | ✅ | diff --git a/resources/compatibility.json b/resources/compatibility.json index 419a6ca..ce25466 100644 --- a/resources/compatibility.json +++ b/resources/compatibility.json @@ -11,7 +11,7 @@ } }, "test": "php-semver-checker list", - "tags": ["compatibility"] + "tags": ["compatibility", "exclude-php:8.2", "exclude-php:8.3", "exclude-php:8.4"] }, { "name": "roave-backward-compatibility-check", From 12caea32290ab14e83f87d9cb5fcbf66bde442c0 Mon Sep 17 00:00:00 2001 From: Jakub Zalas Date: Fri, 11 Apr 2025 03:51:46 +0000 Subject: [PATCH 18/32] Update tools --- resources/pre-installation.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/pre-installation.json b/resources/pre-installation.json index dc785a1..8fedc89 100644 --- a/resources/pre-installation.json +++ b/resources/pre-installation.json @@ -18,11 +18,11 @@ "website": "https://phar.io/", "command": { "file-download": { - "url": "https://github.com/phar-io/phive/releases/download/0.15.3/phive-0.15.3.phar.asc", + "url": "https://github.com/phar-io/phive/releases/download/0.16.0/phive-0.16.0.phar.asc", "file": "%target-dir%/phive.asc" }, "phar-download": { - "phar": "https://github.com/phar-io/phive/releases/download/0.15.3/phive-0.15.3.phar", + "phar": "https://github.com/phar-io/phive/releases/download/0.16.0/phive-0.16.0.phar", "bin": "%target-dir%/phive" }, "sh": { From 12db3f8e0963e2cc0435af82fae28bf167b98bcd Mon Sep 17 00:00:00 2001 From: Jakub Zalas Date: Mon, 14 Apr 2025 11:43:22 +0100 Subject: [PATCH 19/32] Remove the duplicated composer-normalize The tool has changed the ownership at some point, but was not abandoned. --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index 2d1a7aa..2ca92e6 100644 --- a/README.md +++ b/README.md @@ -107,7 +107,6 @@ It has been extracted as a separate project to make maintenance easier and enabl | :--- | :------ | | analyze | [Visualizes metrics and source code](https://github.com/Qafoo/QualityAnalyzer) | | box-legacy | [Legacy version of box](https://box-project.github.io/box2/) | -| composer-normalize | [Composer plugin to normalize composer.json files](https://github.com/localheinz/composer-normalize) | | design-pattern | [Detects design patterns](https://github.com/Halleck45/DesignPatternDetector) | | parallel-lint | [Checks PHP file syntax](https://github.com/JakubOnderka/PHP-Parallel-Lint) | | php-coupling-detector | [Detects code coupling issues](https://akeneo.github.io/php-coupling-detector/) | From 491e0326b9107b123e5a7193dd41dcd9e7f432a1 Mon Sep 17 00:00:00 2001 From: Jakub Zalas Date: Sun, 1 Jun 2025 22:21:15 +0100 Subject: [PATCH 20/32] Drop phpcov on PHP 8.2 --- README.md | 2 +- resources/test.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 2ca92e6..1cb0c7a 100644 --- a/README.md +++ b/README.md @@ -57,7 +57,7 @@ It has been extracted as a separate project to make maintenance easier and enabl | phpcb | [PHP Code Browser](https://github.com/mayflower/PHP_CodeBrowser) | ✅ | ✅ | ✅ | | phpcbf | [Automatically corrects coding standard violations](https://github.com/squizlabs/PHP_CodeSniffer) | ✅ | ✅ | ✅ | | phpcodesniffer-composer-install | [Easy installation of PHP_CodeSniffer coding standards (rulesets).](https://github.com/Dealerdirect/phpcodesniffer-composer-installer) | ✅ | ✅ | ✅ | -| phpcov | [a command-line frontend for the PHP_CodeCoverage library](https://github.com/sebastianbergmann/phpcov) | ✅ | ✅ | ✅ | +| phpcov | [a command-line frontend for the PHP_CodeCoverage library](https://github.com/sebastianbergmann/phpcov) | ❌ | ✅ | ✅ | | phpcpd | [Copy/Paste Detector](https://github.com/sebastianbergmann/phpcpd) | ✅ | ✅ | ✅ | | phpcs | [Detects coding standard violations](https://github.com/squizlabs/PHP_CodeSniffer) | ✅ | ✅ | ✅ | | phpcs-security-audit | [Finds vulnerabilities and weaknesses related to security in PHP code](https://github.com/FloeDesignTechnologies/phpcs-security-audit) | ✅ | ✅ | ✅ | diff --git a/resources/test.json b/resources/test.json index cb328d6..bc2be89 100644 --- a/resources/test.json +++ b/resources/test.json @@ -84,7 +84,7 @@ } }, "test": "phpcov -v", - "tags": ["test"] + "tags": ["test", "exclude-php:8.2"] }, { "name": "php-fuzzer", From 3ea9d36ffbdd3a71ea18f86fb9fa983ebffa7182 Mon Sep 17 00:00:00 2001 From: Jakub Zalas Date: Sun, 22 Jun 2025 22:00:42 +0100 Subject: [PATCH 21/32] Update the signature key for phpcbf --- resources/checkstyle.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/checkstyle.json b/resources/checkstyle.json index 9d03a46..0acf5a6 100644 --- a/resources/checkstyle.json +++ b/resources/checkstyle.json @@ -50,7 +50,7 @@ "phive-install": { "alias": "phpcbf", "bin": "%target-dir%/phpcbf", - "sig": "A978220305CD5C32" + "sig": "97B02DD8E5071466" } }, "test": "phpcbf --help", From 90eb3d37c55c45d53d110d2ac01ef65b70abc34d Mon Sep 17 00:00:00 2001 From: Jakub Zalas Date: Mon, 30 Jun 2025 16:30:10 +0100 Subject: [PATCH 22/32] Enable php-cs-fixer on PHP 8.4 Fixes #533 --- README.md | 2 +- resources/checkstyle.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 1cb0c7a..483cd9c 100644 --- a/README.md +++ b/README.md @@ -46,7 +46,7 @@ It has been extracted as a separate project to make maintenance easier and enabl | pest | [The elegant PHP Testing Framework](https://github.com/pestphp/pest) | ✅ | ✅ | ✅ | | phan | [Static Analysis Tool](https://github.com/phan/phan) | ✅ | ✅ | ✅ | | phive | [PHAR Installation and Verification Environment](https://phar.io/) | ✅ | ✅ | ✅ | -| php-cs-fixer | [PHP Coding Standards Fixer](http://cs.symfony.com/) | ✅ | ✅ | ❌ | +| php-cs-fixer | [PHP Coding Standards Fixer](http://cs.symfony.com/) | ✅ | ✅ | ✅ | | php-fuzzer | [A fuzzer for PHP, which can be used to find bugs in libraries by feeding them 'random' inputs](https://github.com/nikic/PHP-Fuzzer) | ✅ | ✅ | ✅ | | php-semver-checker | [Suggests a next version according to semantic versioning](https://github.com/tomzx/php-semver-checker) | ❌ | ❌ | ❌ | | phpa | [Checks for weak assumptions](https://github.com/rskuipers/php-assumptions) | ✅ | ✅ | ✅ | diff --git a/resources/checkstyle.json b/resources/checkstyle.json index 0acf5a6..0c92d62 100644 --- a/resources/checkstyle.json +++ b/resources/checkstyle.json @@ -40,7 +40,7 @@ } }, "test": "php-cs-fixer list", - "tags": ["featured", "checkstyle", "exclude-php:8.4"] + "tags": ["featured", "checkstyle"] }, { "name": "phpcbf", From 5c720106230a708f8e80f18e3dd5a7236faa03ad Mon Sep 17 00:00:00 2001 From: Jakub Zalas Date: Sun, 24 Aug 2025 22:08:01 +0100 Subject: [PATCH 23/32] Do not hide the output of test command on failure --- src/Tool/Command/TestCommand.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Tool/Command/TestCommand.php b/src/Tool/Command/TestCommand.php index 2b591cf..bc2fb1a 100644 --- a/src/Tool/Command/TestCommand.php +++ b/src/Tool/Command/TestCommand.php @@ -17,6 +17,6 @@ public function __construct(string $command, string $name) public function __toString(): string { - return \sprintf('((%s > /dev/null && echo -e "\e[0;32m✔\e[0m︎%s") || (echo -e "\e[1;31m✘\e[0m%s" && false))', $this->command, $this->name, $this->name); + return \sprintf('(output=$(%s 2>&1) && echo -e "\e[0;32m✔\e[0m︎%s" || (echo -e "\e[1;31m✘\e[0m%s\n$output" && false))', $this->command, $this->name, $this->name); } } From 079734bd7af3e72d1b7e16a3c59454fd16234e7a Mon Sep 17 00:00:00 2001 From: Jakub Zalas Date: Sun, 24 Aug 2025 22:38:32 +0100 Subject: [PATCH 24/32] Remove pest MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The latest pest version assumes it is installed in the project and expects the tests directory to be present. It is impossible to run it as an external tool anymore. Example failure when trying to use pest installed with the composer-bin plugin: Pest\Exceptions\FatalException The test directory [/home/runner/work/toolbox/toolbox/build/tools/.composer/vendor-bin/pest/tests/] does not exist. at build/tools/.composer/vendor-bin/pest/vendor/pestphp/pest/src/Bootstrappers/BootFiles.php:45 41▕ $rootPath = TestSuite::getInstance()->rootPath; 42▕ $testsPath = $rootPath.DIRECTORY_SEPARATOR.testDirectory(); 43▕ 44▕ if (! is_dir($testsPath)) { ➜ 45▕ throw new FatalException(sprintf('The test directory [%s] does not exist.', $testsPath)); 46▕ } 47▕ 48▕ foreach (self::STRUCTURE as $filename) { 49▕ $filename = sprintf('%s%s%s', $testsPath, DIRECTORY_SEPARATOR, $filename); --- README.md | 2 +- resources/test.json | 17 ----------------- 2 files changed, 1 insertion(+), 18 deletions(-) diff --git a/README.md b/README.md index 483cd9c..18061ee 100644 --- a/README.md +++ b/README.md @@ -43,7 +43,6 @@ It has been extracted as a separate project to make maintenance easier and enabl | parallel-lint | [Checks PHP file syntax](https://github.com/php-parallel-lint/PHP-Parallel-Lint) | ✅ | ✅ | ✅ | | paratest | [Parallel testing for PHPUnit](https://github.com/paratestphp/paratest) | ✅ | ✅ | ✅ | | pdepend | [Static Analysis Tool](https://pdepend.org/) | ✅ | ✅ | ✅ | -| pest | [The elegant PHP Testing Framework](https://github.com/pestphp/pest) | ✅ | ✅ | ✅ | | phan | [Static Analysis Tool](https://github.com/phan/phan) | ✅ | ✅ | ✅ | | phive | [PHAR Installation and Verification Environment](https://phar.io/) | ✅ | ✅ | ✅ | | php-cs-fixer | [PHP Coding Standards Fixer](http://cs.symfony.com/) | ✅ | ✅ | ✅ | @@ -109,6 +108,7 @@ It has been extracted as a separate project to make maintenance easier and enabl | box-legacy | [Legacy version of box](https://box-project.github.io/box2/) | | design-pattern | [Detects design patterns](https://github.com/Halleck45/DesignPatternDetector) | | parallel-lint | [Checks PHP file syntax](https://github.com/JakubOnderka/PHP-Parallel-Lint) | +| pest | [The elegant PHP Testing Framework](https://github.com/pestphp/pest) | | php-coupling-detector | [Detects code coupling issues](https://akeneo.github.io/php-coupling-detector/) | | php-formatter | [Custom coding standards fixer](https://github.com/mmoreram/php-formatter) | | phpcf | [Finds usage of deprecated features](http://wapmorgan.github.io/PhpCodeFixer/) | diff --git a/resources/test.json b/resources/test.json index bc2be89..ad84176 100644 --- a/resources/test.json +++ b/resources/test.json @@ -55,23 +55,6 @@ "test": "paratest --version", "tags": ["test"] }, - { - "name": "pest", - "summary": "The elegant PHP Testing Framework", - "website": "https://github.com/pestphp/pest", - "command": { - "sh": { - "command": "composer global bin pest config allow-plugins.pestphp/pest-plugin true" - }, - "composer-bin-plugin": { - "package": "pestphp/pest", - "namespace": "pest", - "links": {"%target-dir%/pest": "pest"} - } - }, - "test": "pest --version", - "tags": ["test"] - }, { "name": "phpcov", "summary": "a command-line frontend for the PHP_CodeCoverage library", From 9b16a1e829921f11ec1d119b4a4520c03647fc62 Mon Sep 17 00:00:00 2001 From: Jakub Zalas Date: Mon, 29 Sep 2025 20:50:35 +0300 Subject: [PATCH 25/32] Change the test command for lines since the previous one is no longer supported --- resources/metrics.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/metrics.json b/resources/metrics.json index 07bc7bd..491427c 100644 --- a/resources/metrics.json +++ b/resources/metrics.json @@ -55,7 +55,7 @@ "links": {"%target-dir%/lines": "lines"} } }, - "test": "lines list -q", + "test": "lines --version", "tags": ["metrics"] } ] From aa6dd5cf997308ef5dd52f62e4303e7e67174a97 Mon Sep 17 00:00:00 2001 From: Jakub Zalas Date: Mon, 27 Oct 2025 09:27:53 +0100 Subject: [PATCH 26/32] Update the yaml-lint signature --- resources/linting.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/linting.json b/resources/linting.json index d0b3113..78578f9 100644 --- a/resources/linting.json +++ b/resources/linting.json @@ -48,7 +48,7 @@ "phive-install": { "alias": "j13k/yaml-lint", "bin": "%target-dir%/yaml-lint", - "sig": "985E1E22802973B2" + "sig": "38A182AB413064D7" } }, "test": "yaml-lint --version", From e5da0c29ab5f4ff15fc7d6fadcd69894de5b03a1 Mon Sep 17 00:00:00 2001 From: Jakub Zalas Date: Mon, 27 Oct 2025 10:46:58 +0100 Subject: [PATCH 27/32] Replace the deprecated actions/upload-release-asset with a gh command --- .github/workflows/build.yml | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index be7baee..38259d8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -98,20 +98,11 @@ jobs: name: devkit.phar path: . - name: Upload toolbox.phar - uses: actions/upload-release-asset@v1 + run: gh release upload ${{ github.event.release.tag_name }} toolbox.phar --clobber env: GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }} - with: - upload_url: ${{ github.event.release.upload_url }} - asset_path: ./toolbox.phar - asset_name: toolbox.phar - asset_content_type: application/zip - name: Upload devkit.phar - uses: actions/upload-release-asset@v1 + run: gh release upload ${{ github.event.release.tag_name }} devkit.phar --clobber env: GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }} - with: - upload_url: ${{ github.event.release.upload_url }} - asset_path: ./devkit.phar - asset_name: devkit.phar - asset_content_type: application/zip + From b5107c05691969d23df021243c891f09d16fcd93 Mon Sep 17 00:00:00 2001 From: Jakub Zalas Date: Mon, 27 Oct 2025 10:54:47 +0100 Subject: [PATCH 28/32] Specify the repository to upload release assets to --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 38259d8..3660499 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -98,11 +98,11 @@ jobs: name: devkit.phar path: . - name: Upload toolbox.phar - run: gh release upload ${{ github.event.release.tag_name }} toolbox.phar --clobber + run: gh release upload ${{ github.event.release.tag_name }} toolbox.phar --clobber --repo github.com/jakzal/toolbox env: GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }} - name: Upload devkit.phar - run: gh release upload ${{ github.event.release.tag_name }} devkit.phar --clobber + run: gh release upload ${{ github.event.release.tag_name }} devkit.phar --clobber --repo github.com/jakzal/toolbox env: GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }} From efd7e88679100a1be5c2c3820c51ad50d2038932 Mon Sep 17 00:00:00 2001 From: Jakub Zalas Date: Thu, 30 Oct 2025 09:44:11 +0100 Subject: [PATCH 29/32] Re-enable php-semver-checker --- README.md | 2 +- resources/compatibility.json | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 18061ee..0d20feb 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ It has been extracted as a separate project to make maintenance easier and enabl | phive | [PHAR Installation and Verification Environment](https://phar.io/) | ✅ | ✅ | ✅ | | php-cs-fixer | [PHP Coding Standards Fixer](http://cs.symfony.com/) | ✅ | ✅ | ✅ | | php-fuzzer | [A fuzzer for PHP, which can be used to find bugs in libraries by feeding them 'random' inputs](https://github.com/nikic/PHP-Fuzzer) | ✅ | ✅ | ✅ | -| php-semver-checker | [Suggests a next version according to semantic versioning](https://github.com/tomzx/php-semver-checker) | ❌ | ❌ | ❌ | +| php-semver-checker | [Suggests a next version according to semantic versioning](https://github.com/tomzx/php-semver-checker) | ✅ | ✅ | ✅ | | phpa | [Checks for weak assumptions](https://github.com/rskuipers/php-assumptions) | ✅ | ✅ | ✅ | | phparkitect | [Helps to put architectural constraints in a PHP code base](https://github.com/phparkitect/arkitect) | ✅ | ✅ | ✅ | | phpat | [Easy to use architecture testing tool](https://github.com/carlosas/phpat) | ✅ | ✅ | ✅ | diff --git a/resources/compatibility.json b/resources/compatibility.json index ce25466..a97024b 100644 --- a/resources/compatibility.json +++ b/resources/compatibility.json @@ -6,12 +6,12 @@ "website": "https://github.com/tomzx/php-semver-checker", "command": { "phar-download": { - "phar": "http://psvc.coreteks.org/php-semver-checker.phar", + "phar": "https://github.com/tomzx/php-semver-checker/releases/latest/download/php-semver-checker.phar", "bin": "%target-dir%/php-semver-checker" } }, "test": "php-semver-checker list", - "tags": ["compatibility", "exclude-php:8.2", "exclude-php:8.3", "exclude-php:8.4"] + "tags": ["compatibility"] }, { "name": "roave-backward-compatibility-check", From e2517c68568e9b67219d839ee6a19b7669844d60 Mon Sep 17 00:00:00 2001 From: Jakub Zalas Date: Fri, 31 Oct 2025 10:17:29 +0100 Subject: [PATCH 30/32] Enable PHPSpec on PHP 8.4 --- resources/test.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/test.json b/resources/test.json index ad84176..10268fc 100644 --- a/resources/test.json +++ b/resources/test.json @@ -93,7 +93,7 @@ } }, "test": "phpspec --version", - "tags": ["exclude-php:8.4", "featured", "test"] + "tags": ["featured", "test"] }, { "name": "phpunit", From b7d6e938b3d496e3f68f60cf4db30a865d05b3ec Mon Sep 17 00:00:00 2001 From: Jakub Zalas Date: Fri, 31 Oct 2025 10:29:32 +0100 Subject: [PATCH 31/32] Enable PHPSpec on PHP 8.4 (update the readme) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 0d20feb..a6b6bf1 100644 --- a/README.md +++ b/README.md @@ -68,7 +68,7 @@ It has been extracted as a separate project to make maintenance easier and enabl | phpmd | [A tool for finding problems in PHP code](https://phpmd.org/) | ✅ | ✅ | ✅ | | phpmetrics | [Static Analysis Tool](http://www.phpmetrics.org/) | ✅ | ✅ | ✅ | | phpmnd | [Helps to detect magic numbers](https://github.com/povils/phpmnd) | ✅ | ✅ | ✅ | -| phpspec | [SpecBDD Framework](http://www.phpspec.net/) | ✅ | ✅ | ❌ | +| phpspec | [SpecBDD Framework](http://www.phpspec.net/) | ✅ | ✅ | ✅ | | phpstan | [Static Analysis Tool](https://github.com/phpstan/phpstan) | ✅ | ✅ | ✅ | | phpstan-banned-code | [PHPStan rules for detecting calls to specific functions you don't want in your project](https://github.com/ekino/phpstan-banned-code) | ✅ | ✅ | ✅ | | phpstan-beberlei-assert | [PHPStan extension for beberlei/assert](https://github.com/phpstan/phpstan-beberlei-assert) | ✅ | ✅ | ✅ | From 5c729412305fa8e8d1c781720f1859c362cdc1cb Mon Sep 17 00:00:00 2001 From: Jakub Zalas Date: Mon, 3 Nov 2025 11:50:13 +0000 Subject: [PATCH 32/32] Switch to a specific php-semver-checker version as the latest is not available --- resources/compatibility.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/compatibility.json b/resources/compatibility.json index a97024b..a6310d3 100644 --- a/resources/compatibility.json +++ b/resources/compatibility.json @@ -6,7 +6,7 @@ "website": "https://github.com/tomzx/php-semver-checker", "command": { "phar-download": { - "phar": "https://github.com/tomzx/php-semver-checker/releases/latest/download/php-semver-checker.phar", + "phar": "https://github.com/tomzx/php-semver-checker/releases/download/v0.17.0/php-semver-checker.phar", "bin": "%target-dir%/php-semver-checker" } },