Hi.
AFAIUI, a 'system' hook is simply given all staged file names as arguments.
Now, php -l interprets the first argument as the file to inspect, any other subsequent arguments are just arguments and thus ignored. (I was once bitten by this, thinking I could just check my PHP files with find -name '*.php' | xargs -r php -l but that does not work for the same reason)
So, running pre-commit run php-lint --all-files does always return success if the first file happens to be syntactically correct, but misses any errors in all other files.
Hi.
AFAIUI, a 'system' hook is simply given all staged file names as arguments.
Now,
php -linterprets the first argument as the file to inspect, any other subsequent arguments are just arguments and thus ignored. (I was once bitten by this, thinking I could just check my PHP files withfind -name '*.php' | xargs -r php -lbut that does not work for the same reason)So, running
pre-commit run php-lint --all-filesdoes always return success if the first file happens to be syntactically correct, but misses any errors in all other files.