diff options
-rw-r--r-- | ale_linters/php/php.vim | 6 | ||||
-rw-r--r-- | doc/ale-php.txt | 10 | ||||
-rw-r--r-- | doc/ale.txt | 1 | ||||
-rw-r--r-- | test/command_callback/test_php_command_callback.vader | 14 |
4 files changed, 29 insertions, 2 deletions
diff --git a/ale_linters/php/php.vim b/ale_linters/php/php.vim index 6470383b..5d87196c 100644 --- a/ale_linters/php/php.vim +++ b/ale_linters/php/php.vim @@ -1,6 +1,8 @@ " Author: Spencer Wood <https://github.com/scwood>, Adriaan Zonnenberg <amz@adriaan.xyz> " Description: This file adds support for checking PHP with php-cli +call ale#Set('php_php_executable', 'php') + function! ale_linters#php#php#Handle(buffer, lines) abort " Matches patterns like the following: " @@ -30,8 +32,8 @@ endfunction call ale#linter#Define('php', { \ 'name': 'php', -\ 'executable': 'php', +\ 'executable_callback': ale#VarFunc('php_php_executable'), \ 'output_stream': 'stdout', -\ 'command': 'php -l -d error_reporting=E_ALL -d display_errors=1 -d log_errors=0 --', +\ 'command': '%e -l -d error_reporting=E_ALL -d display_errors=1 -d log_errors=0 --', \ 'callback': 'ale_linters#php#php#Handle', \}) diff --git a/doc/ale-php.txt b/doc/ale-php.txt index 2eed838e..83bc0fd5 100644 --- a/doc/ale-php.txt +++ b/doc/ale-php.txt @@ -204,4 +204,14 @@ g:ale_php_cs_fixer_options *g:ale_php_cs_fixer_options* This variable can be set to pass additional options to php-cs-fixer. =============================================================================== +php *ale-php-php* + +g:ale_php_php_executable *g:ale_php_php_executable* + *b:ale_php_php_executable* + Type: |String| + Default: `'php'` + + This variable sets the executable used for php. + +=============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/doc/ale.txt b/doc/ale.txt index 59b9f352..e4fc0e3c 100644 --- a/doc/ale.txt +++ b/doc/ale.txt @@ -224,6 +224,7 @@ CONTENTS *ale-contents* phpstan.............................|ale-php-phpstan| psalm...............................|ale-php-psalm| php-cs-fixer........................|ale-php-php-cs-fixer| + php.................................|ale-php-php| po....................................|ale-po-options| write-good..........................|ale-po-write-good| pod...................................|ale-pod-options| diff --git a/test/command_callback/test_php_command_callback.vader b/test/command_callback/test_php_command_callback.vader new file mode 100644 index 00000000..81e13f93 --- /dev/null +++ b/test/command_callback/test_php_command_callback.vader @@ -0,0 +1,14 @@ +Before: + call ale#assert#SetUpLinterTest('php', 'php') + let b:command_tail = ' -l -d error_reporting=E_ALL -d display_errors=1' + \ . ' -d log_errors=0 --' + +After: + call ale#assert#TearDownLinterTest() + +Execute(The executable should be configurable): + AssertLinter 'php', ale#Escape('php') . b:command_tail + + let b:ale_php_php_executable = '/path/to/php' + + AssertLinter '/path/to/php', ale#Escape('/path/to/php') . b:command_tail |