File tree Expand file tree Collapse file tree 2 files changed +5
-5
lines changed
Expand file tree Collapse file tree 2 files changed +5
-5
lines changed Original file line number Diff line number Diff line change 11#! /usr/bin/env sh
22
33# Get list of staged PHP files
4- STAGED_PHP_FILES=$( git diff --cached --name-only --diff-filter=ACM | grep ' \.php$' )
4+ STAGED_PHP_FILES=$( git diff --cached --name-only --diff-filter=ACM | grep ' \.php$' || true )
55
66if [ -n " $STAGED_PHP_FILES " ]; then
77 echo " Running PHPStan on staged PHP files..."
Original file line number Diff line number Diff line change @@ -378,10 +378,10 @@ composer phpcbf -- src/Gateways/PaymentMethods/WCGatewayMoneiCC.php
378378
379379Automatically runs PHPStan on staged PHP files before each commit. This prevents committing code with type errors.
380380
381- ** To bypass ** (not recommended):
382- ``` bash
383- git commit --no-verify -m " message "
384- ```
381+ ** CRITICAL ** : NEVER use ` --no-verify ` to bypass pre-commit hooks!
382+ - Pre-commit hooks are there to catch errors before they reach the repository
383+ - If the hook fails, fix the actual errors instead of bypassing the check
384+ - Using ` --no-verify ` can introduce bugs and break the build
385385
386386### Common PHPStan Errors & Fixes
387387
You can’t perform that action at this time.
0 commit comments