Merge pull request #2044 from Steap/bug/1388
PHP linter: make the path to the executable configurable
This commit is contained in:
commit
6aab3fe209
@ -1,6 +1,8 @@
|
|||||||
" Author: Spencer Wood <https://github.com/scwood>, Adriaan Zonnenberg <amz@adriaan.xyz>
|
" Author: Spencer Wood <https://github.com/scwood>, Adriaan Zonnenberg <amz@adriaan.xyz>
|
||||||
" Description: This file adds support for checking PHP with php-cli
|
" 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
|
function! ale_linters#php#php#Handle(buffer, lines) abort
|
||||||
" Matches patterns like the following:
|
" Matches patterns like the following:
|
||||||
"
|
"
|
||||||
@ -30,8 +32,8 @@ endfunction
|
|||||||
|
|
||||||
call ale#linter#Define('php', {
|
call ale#linter#Define('php', {
|
||||||
\ 'name': 'php',
|
\ 'name': 'php',
|
||||||
\ 'executable': 'php',
|
\ 'executable_callback': ale#VarFunc('php_php_executable'),
|
||||||
\ 'output_stream': 'stdout',
|
\ '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',
|
\ 'callback': 'ale_linters#php#php#Handle',
|
||||||
\})
|
\})
|
||||||
|
@ -203,5 +203,15 @@ 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.
|
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:
|
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:
|
||||||
|
@ -224,6 +224,7 @@ CONTENTS *ale-contents*
|
|||||||
phpstan.............................|ale-php-phpstan|
|
phpstan.............................|ale-php-phpstan|
|
||||||
psalm...............................|ale-php-psalm|
|
psalm...............................|ale-php-psalm|
|
||||||
php-cs-fixer........................|ale-php-php-cs-fixer|
|
php-cs-fixer........................|ale-php-php-cs-fixer|
|
||||||
|
php.................................|ale-php-php|
|
||||||
po....................................|ale-po-options|
|
po....................................|ale-po-options|
|
||||||
write-good..........................|ale-po-write-good|
|
write-good..........................|ale-po-write-good|
|
||||||
pod...................................|ale-pod-options|
|
pod...................................|ale-pod-options|
|
||||||
|
14
test/command_callback/test_php_command_callback.vader
Normal file
14
test/command_callback/test_php_command_callback.vader
Normal file
@ -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
|
Loading…
Reference in New Issue
Block a user