PHP = docker compose run --rm php

.PHONY: install update test phpstan cs-fix cs-check audit shell build

build:
	docker compose build

install:
	$(PHP) composer install

update:
	$(PHP) composer update

vendor:
	$(MAKE) install

test: vendor
	$(PHP) vendor/bin/phpunit --testsuite Unit --colors=always

phpstan: vendor
	$(PHP) vendor/bin/phpstan analyse --no-progress --ansi --memory-limit=512M

cs-fix: vendor
	$(PHP) vendor/bin/php-cs-fixer fix --ansi

cs-check: vendor
	$(PHP) vendor/bin/php-cs-fixer fix --dry-run --diff --ansi

audit: vendor
	$(PHP) composer audit

ci: audit phpstan cs-check test

shell:
	docker compose run --rm php sh
