Skip to content

Commit 74a26d0

Browse files
committed
Support tools/php-cs-fixer path
Typically when using Phive you install tools in tools/ as opposed to installing into vendor/bin, e.g., via Composer. The pre-commit hook will now first check if php-cs-fixer exists at the path tools/php-cs-fixer, then vendor/bin/php-cs-fixer, etc.
1 parent 9e449ed commit 74a26d0

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

pre-commit

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,15 @@ get_config() {
4444
}
4545

4646
run_php_cs_fixer() {
47-
php_cs_fixer_bin=./vendor/bin/php-cs-fixer
48-
if test ! -f "$php_cs_fixer_bin"; then
47+
php_cs_fixer_bin=
48+
for candidate in tools/php-cs-fixer vendor/bin/php-cs-fixer; do
49+
if test -f "$candidate"; then
50+
php_cs_fixer_bin="$candidate"
51+
break
52+
fi
53+
done
54+
55+
if test -z "$php_cs_fixer_bin"; then
4956
return # Noop, php-cs-fixer not found.
5057
fi
5158

0 commit comments

Comments
 (0)