SHELL=bash -o pipefail
SOURCE_DIR = $(shell pwd)
BIN_DIR = ${SOURCE_DIR}/bin

define printSection
	@printf "\033[36m\n==================================================\n\033[0m"
	@printf "\033[36m $1 \033[0m"
	@printf "\033[36m\n==================================================\n\033[0m"
endef

.PHONY: cs
cs:
	$(call printSection,PHP-CS)
	${BIN_DIR}/php-cs-fixer fix --dry-run --stop-on-violation --diff

.PHONY: cs-fix
cs-fix:
	$(call printSection,PHP-CS-FIXER)
	${BIN_DIR}/php-cs-fixer fix

.PHONY: phpstan
phpstan:
	$(call printSection,PHPSTAN)
	${BIN_DIR}/phpstan.phar analyse --memory-limit=1G --level max src
