This pre-commit hook utilises PHP's command-line -l (lint) option, which checks for syntax errors. In case of an error the commit is rejected and the error displayed. Testing is welcome.