From b739961ba19be6a7a534977f0aa6044ca894cb55 Mon Sep 17 00:00:00 2001 From: AntonioCS Date: Fri, 11 Sep 2026 20:07:50 +0100 Subject: [PATCH] php/phpstan, php/phpcs: propagate the tool's exit code in send-to-file mode Both targets appended '|| true' after the output redirect, so 'make php/phpstan/analyse' and 'make php/phpcs/check' exited 0 whether the tool passed or found errors; the output file was the only signal. Keep the redirect, drop the swallow, so the exit code matches the non-file path. Fixes #52. --- CHANGELOG.md | 7 +++++++ modules/php/phpcs/phpcs.mk | 2 +- modules/php/phpstan/phpstan.mk | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4980f78..76d0f65 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ ## [3.0.1] - Unreleased +### Fixed +- **`php/phpstan/analyse` and `php/phpcs/check` now fail when the tool finds errors in send-to-file mode** (#52) + - Both targets appended `|| true` after the output redirect, so the exit code was 0 whether the tool + passed or failed and the only signal was the output file + - The redirect is kept (output still lands in `phpstan_output_file` / `phpcs_output_file`); the exit + code now propagates, matching the non-file path + ### Added - **Claude Code skill**: AI-focused skill for MakeBind guidance - New `.claude/skills/makebind/SKILL.md` with comprehensive MakeBind documentation diff --git a/modules/php/phpcs/phpcs.mk b/modules/php/phpcs/phpcs.mk index bf8e374..0861fb4 100644 --- a/modules/php/phpcs/phpcs.mk +++ b/modules/php/phpcs/phpcs.mk @@ -35,7 +35,7 @@ $(if $(value php_invoke),,$(error phpcs module requires php module - please add php/phpcs/check: ## Run PHP CodeSniffer (phpcs_files= for paths, phpcs_args= for extra options) $(eval $@_cmd := $(phpcs_bin) -s $(call phpcs_build_args)) $(if $(call mb_is_true,$(phpcs_send_to_file)),\ - $(eval $@_cmd += > $(phpcs_output_file) 2>&1 || true)\ + $(eval $@_cmd += > $(phpcs_output_file) 2>&1)\ $(call mb_printf_info,Running phpcs and sending output to $(phpcs_output_file))\ ) $(call php_invoke,$($@_cmd)) diff --git a/modules/php/phpstan/phpstan.mk b/modules/php/phpstan/phpstan.mk index 250f817..7bab85f 100644 --- a/modules/php/phpstan/phpstan.mk +++ b/modules/php/phpstan/phpstan.mk @@ -33,7 +33,7 @@ $(if $(value php_invoke),,$(error phpstan module requires php module - please ad php/phpstan/analyse: ## Run PHPStan analysis (phpstan_files= for paths, phpstan_args= for extra options) $(eval $@_cmd := $(phpstan_bin) analyse $(call phpstan_build_args)) $(if $(call mb_is_true,$(phpstan_send_to_file)),\ - $(eval $@_cmd += > $(phpstan_output_file) 2>&1 || true)\ + $(eval $@_cmd += > $(phpstan_output_file) 2>&1)\ $(call mb_printf_info,Running phpstan and sending output to $(phpstan_output_file))\ ) $(call php_invoke,$($@_cmd))