diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d25c2d2..f958946 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -3,12 +3,16 @@ Contributions are very welcome. If you would like to add functionality, before starting your work, please open an issue to discuss the feature you would like to work on. +All development tools can be executed via `make` commands. +All those commands ensure, you use the correct PHP version and the dependencies. +To achieve this, the commands use the [Symfony CLI](https://github.com/symfony-cli/symfony-cli), so please make sure you have it installed. + #### Coding standards Check coding standards with [PHP CS Fixer](https://github.com/FriendsOfPHP/PHP-CS-Fixer). ``` -php-cs-fixer fix src +make cs ``` #### Code Documentation @@ -17,10 +21,10 @@ Document your code with [phpDocumentor](https://github.com/phpDocumentor/phpDocu #### Static Analysis -Analyze your code with [PHPStan](https://github.com/phpstan/phpstan) and make sure there are no errors except for `buildCurlPostFields` method. +Analyze your code with [PHPStan](https://github.com/phpstan/phpstan). ``` -phpstan analyse src --level 5 +make static-code-analysis ``` #### Test diff --git a/Makefile b/Makefile index 925817a..38d86d9 100644 --- a/Makefile +++ b/Makefile @@ -3,16 +3,28 @@ help: ## Displays this list of targets with descriptions @grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[32m%-30s\033[0m %s\n", $$1, $$2}' +.PHONY: check-symfony +check-symfony: ## Checks if the symfony binary is installed + @command -v symfony >/dev/null 2>&1 || { echo >&2 "Symfony binary is not installed. Please install it first. https://github.com/symfony-cli/symfony-cli"; exit 1; } + .PHONY: cs -cs: vendor ## Normalizes composer.json with ergebnis/composer-normalize and fixes code style issues with friendsofphp/php-cs-fixer - composer normalize +cs: check-symfony vendor ## Normalizes composer.json with ergebnis/composer-normalize and fixes code style issues with friendsofphp/php-cs-fixer + symfony composer normalize mkdir -p .build/php-cs-fixer - php vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.dist.php --diff --verbose + symfony php vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.dist.php --diff --verbose .PHONY: static-code-analysis -static-code-analysis: vendor ## Runs a static code analysis with phpstan/phpstan - php vendor/bin/phpstan analyse --configuration=phpstan-default.neon.dist --memory-limit=-1 +static-code-analysis: check-symfony vendor ## Runs a static code analysis with phpstan/phpstan + symfony php vendor/bin/phpstan analyse --configuration=phpstan-default.neon.dist --memory-limit=-1 .PHONY: static-code-analysis-baseline -static-code-analysis-baseline: vendor ## Generates a baseline for static code analysis with phpstan/phpstan - php vendor/bin/phpstan analyze --configuration=phpstan-default.neon.dist --generate-baseline=phpstan-default-baseline.neon --memory-limit=-1 +static-code-analysis-baseline: check-symfony vendor ## Generates a baseline for static code analysis with phpstan/phpstan + symfony php vendor/bin/phpstan analyze --configuration=phpstan-default.neon.dist --generate-baseline=phpstan-default-baseline.neon --memory-limit=-1 + +.PHONY: tests +tests: check-symfony vendor + symfony php vendor/bin/phpunit tests + +.PHONY: vendor +vendor: composer.json composer.lock ## Installs composer dependencies + symfony composer install