From c4db708a2649c90c63c26b2dc7b52bb55dd19998 Mon Sep 17 00:00:00 2001 From: Jesse Rushlow Date: Tue, 11 Jun 2024 09:46:28 -0400 Subject: [PATCH] [dx] keep tooling in one place - `composer tools:run` runs `php-cs-fixer` & `phpstan` - `composer tools:run:php-cs-fixer` run only `php-cs-fixer` (works for `phpstan` as well). - `composer tools:upgrade` upgrades / installs all of the `tools/*` - `composer tools:upgrade:php-cs-fixer` Upgrades / installs only `php-cs-fixer` (works for `phpstan` as well) --- composer.json | 17 +++++++++++++++-- tools/.gitignore | 2 ++ tools/php-cs-fixer/composer.json | 5 +++++ tools/phpstan/composer.json | 5 +++++ 4 files changed, 27 insertions(+), 2 deletions(-) create mode 100644 tools/.gitignore create mode 100644 tools/php-cs-fixer/composer.json create mode 100644 tools/phpstan/composer.json diff --git a/composer.json b/composer.json index c432d40..e8f8187 100644 --- a/composer.json +++ b/composer.json @@ -22,7 +22,6 @@ "doctrine/doctrine-bundle": "^2.0", "doctrine/orm": "^2.10", "php-cs-fixer/shim": "^3.17", - "phpstan/phpstan": "^1.11.x-dev", "symfony/browser-kit": "^5.4|^6.0", "symfony/css-selector": "^5.4|^6.0", "symfony/doctrine-messenger": "^6.0", @@ -56,5 +55,19 @@ "name": "Nicolas PHILIPPE", "email": "nikophil@gmail.com" } - ] + ], + "scripts": { + "tools:upgrade": [ + "@tools:upgrade:php-cs-fixer", + "@tools:upgrade:phpstan" + ], + "tools:upgrade:php-cs-fixer": "composer upgrade -W -d tools/php-cs-fixer", + "tools:upgrade:phpstan": "composer upgrade -W -d tools/phpstan", + "tools:run": [ + "@tools:run:php-cs-fixer", + "@tools:run:phpstan" + ], + "tools:run:php-cs-fixer": "tools/php-cs-fixer/vendor/bin/php-cs-fixer fix", + "tools:run:phpstan": "tools/phpstan/vendor/bin/phpstan --memory-limit=1G" + } } diff --git a/tools/.gitignore b/tools/.gitignore new file mode 100644 index 0000000..af5e68f --- /dev/null +++ b/tools/.gitignore @@ -0,0 +1,2 @@ +**/vendor +**/composer.lock diff --git a/tools/php-cs-fixer/composer.json b/tools/php-cs-fixer/composer.json new file mode 100644 index 0000000..2d76bbe --- /dev/null +++ b/tools/php-cs-fixer/composer.json @@ -0,0 +1,5 @@ +{ + "require": { + "friendsofphp/php-cs-fixer": "^3" + } +} diff --git a/tools/phpstan/composer.json b/tools/phpstan/composer.json new file mode 100644 index 0000000..f53376b --- /dev/null +++ b/tools/phpstan/composer.json @@ -0,0 +1,5 @@ +{ + "require": { + "phpstan/phpstan": "^1" + } +}