Skip to content

Commit 9efff49

Browse files
committed
Prefer g:php_cs_fixer_path if set, even if php-cs-fixer is executable
Fixes #32
1 parent cc55fc1 commit 9efff49

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

autoload/php_cs_fixer.vim

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,17 @@
66
let g:php_cs_fixer_path = get(g:, 'php_cs_fixer_path', '~/php-cs-fixer.phar')
77
let g:php_cs_fixer_php_path = get(g:, 'php_cs_fixer_php_path', 'php')
88

9-
if executable('php-cs-fixer')
10-
let g:php_cs_fixer_command = 'php-cs-fixer fix'
11-
let g:php_cs_fixer_version_command = 'php-cs-fixer --version'
12-
else
9+
if exists('g:php_cs_fixer_path')
1310
let g:php_cs_fixer_command = g:php_cs_fixer_php_path.' '.g:php_cs_fixer_path.' fix'
1411
let g:php_cs_fixer_version_command = g:php_cs_fixer_php_path.' '.g:php_cs_fixer_path.' --version'
12+
else
13+
if executable('php-cs-fixer')
14+
let g:php_cs_fixer_command = 'php-cs-fixer fix'
15+
let g:php_cs_fixer_version_command = 'php-cs-fixer --version'
16+
else
17+
echoerr('php-cs-fixer not found and g:php_cs_fixer_path not set')
18+
finish
19+
end
1520
end
1621

1722
" Check the php-cs-fixer version

0 commit comments

Comments
 (0)