@@ -4,6 +4,7 @@ include .env
44SHELL ?= /bin/bash
55DOCKER ?= docker
66DOCKER_COMPOSE ?= $(DOCKER ) compose
7+ export CONTAINER_USER ?= $(shell id -u) :$(shell id -g)
78INSIDE_CONTAINER ?= $(shell test -f /.dockerenv && echo 1)
89
910RUN ?= $(if $(INSIDE_CONTAINER ) ,,$(DOCKER_COMPOSE ) run --rm php)
@@ -34,51 +35,65 @@ run: ## Run a command inside the Docker container, e.g. `make run CMD=pwd`
3435 $(RUN ) $(CMD )
3536.PHONY : run
3637
38+ t : terminal
3739terminal : var # # Start a terminal inside the Docker container
3840 @$(if $(INSIDE_CONTAINER ) ,echo 'Already inside docker container.'; exit 1,)
3941 $(DOCKER_COMPOSE ) run --rm php bash
40- .PHONY : terminal
42+ .PHONY : t terminal
4143
4244# #
4345# # Tools
4446# # -----
4547
46- lint : var # # Check code style
47- $(RUN ) php-cs-fixer fix --diff --verbose --dry-run
48- $(RUN ) rector process --dry-run
49- .PHONY : lint
48+ fixer : var # # Fix code style using PHP-CS-Fixer
49+ $(RUN ) php-cs-fixer fix --diff --verbose $(ARGS )
50+ .PHONY : fixer
5051
51- fixcs : var # # Fix code style
52- $(RUN ) php-cs-fixer fix --diff --verbose
53- $(RUN ) rector process
54- .PHONY : fixcs
52+ fixer-check : var # # Check code style using PHP-CS-Fixer
53+ $(RUN ) php-cs-fixer fix --diff --verbose --dry-run $(ARGS )
54+ .PHONY : fixer-check
5555
56- phpstan : var vendor # # Analyze with PHPStan
57- $(RUN ) phpstan analyze
56+ rector : var # # Fix code style using Rector
57+ $(RUN ) rector process $(ARGS )
58+ .PHONY : rector
59+
60+ rector-check : var # # Check code style using Rector
61+ $(RUN ) rector process --dry-run $(ARGS )
62+ .PHONY : rector-check
63+
64+ phpstan : var vendor # # Analyze code using PHPStan
65+ $(RUN ) phpstan analyze $(ARGS )
5866.PHONY : phpstan
5967
60- test : var vendor # # Run tests
61- $(RUN ) vendor/bin/phpunit
68+ test : var vendor # # Run tests using PHPUnit
69+ $(RUN ) vendor/bin/phpunit $( ARGS )
6270.PHONY : test
6371
64- infect : var vendor # # Run mutation tests
65- $(RUN ) infection --show-mutations
72+ infect : var vendor # # Run mutation tests using Infection
73+ $(RUN ) infection --show-mutations $( ARGS )
6674.PHONY : infect
6775
76+ deps-analyze : vendor # # Analyze project dependencies using Composer dependency analyser
77+ $(RUN ) composer-dependency-analyser $(ARGS )
78+ .PHONY : deps-analyze
79+
6880composer-validate : # # Validate composer.json
69- $(COMPOSER ) validate
70- $(COMPOSER ) normalize --diff --dry-run
81+ $(COMPOSER ) validate $(ARGS )
7182.PHONY : composer-validate
7283
7384composer-normalize : # # Normalize composer.json
74- $(COMPOSER ) normalize --diff
85+ $(COMPOSER ) normalize --diff $( ARGS )
7586.PHONY : composer-normalize
7687
77- deps-analyze : vendor # # Analyze project dependencies
78- $(RUN ) composer-dependency-analyser
79- .PHONY : deps-analyze
88+ composer-normalize-check : # # Check that composer.json is normalized
89+ $(COMPOSER ) normalize --diff --dry-run $(ARGS )
90+ .PHONY : composer-normalize-check
91+
92+ fix : fixer rector composer-normalize # # Run all fixing recipes
93+ .PHONY : fix
8094
81- check : lint phpstan test composer-validate deps-analyze # # Run all project checks
95+ check : fixer-check rector-check composer-validate composer-normalize-check phpstan test deps-analyze # # Run all project checks
96+ .PHONY : check
8297
8398# -----------------------
8499
0 commit comments