From e5c349c7ff95127d53ad5fa8fb712d33f57b44de Mon Sep 17 00:00:00 2001 From: Jesse Rushlow Date: Tue, 11 Jun 2024 10:04:56 -0400 Subject: [PATCH 1/2] [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 79ff874..2fdca7d 100644 --- a/composer.json +++ b/composer.json @@ -16,8 +16,7 @@ "require-dev": { "symfony/filesystem": "^6.3|^7.0", "symfony/framework-bundle": "^6.3|^7.0", - "symfony/phpunit-bridge": "^6.3|^7.0", - "phpstan/phpstan": "^1.10.39" + "symfony/phpunit-bridge": "^6.3|^7.0" }, "minimum-stability": "dev", "autoload": { @@ -29,5 +28,19 @@ "psr-4": { "Symfonycasts\\MicroMapper\\Tests\\": "tests/" } + }, + "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" + } +} From e813bb183e40fce2252a58dcf3046e8c02fa1200 Mon Sep 17 00:00:00 2001 From: Jesse Rushlow Date: Wed, 12 Jun 2024 07:39:42 -0400 Subject: [PATCH 2/2] revert removing phpstan from base require-dev --- composer.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 2fdca7d..b0a2ed7 100644 --- a/composer.json +++ b/composer.json @@ -16,7 +16,8 @@ "require-dev": { "symfony/filesystem": "^6.3|^7.0", "symfony/framework-bundle": "^6.3|^7.0", - "symfony/phpunit-bridge": "^6.3|^7.0" + "symfony/phpunit-bridge": "^6.3|^7.0", + "phpstan/phpstan": "^1.10.39" }, "minimum-stability": "dev", "autoload": {