summaryrefslogtreecommitdiff
path: root/ale_linters/php
diff options
context:
space:
mode:
authorhaginaga <haginaga@unetworks.jp>2018-05-08 23:25:11 +0900
committerhaginaga <haginaga@unetworks.jp>2018-05-08 23:25:11 +0900
commiteb3ab87569c6a6f40c98aa4de0ab710914421fbd (patch)
treeb3e7b07cf56612475c98fad676b0996cf9fd0d90 /ale_linters/php
parent8cee39c614ec741f8f58cb3d8375b8431f990c2a (diff)
downloadale-eb3ab87569c6a6f40c98aa4de0ab710914421fbd.zip
Modify to be able to use phan_client without g:ale_php_phan_executable
Diffstat (limited to 'ale_linters/php')
-rw-r--r--ale_linters/php/phan.vim18
1 files changed, 10 insertions, 8 deletions
diff --git a/ale_linters/php/phan.vim b/ale_linters/php/phan.vim
index de1335fe..2723e7a1 100644
--- a/ale_linters/php/phan.vim
+++ b/ale_linters/php/phan.vim
@@ -1,4 +1,4 @@
-" Author: diegoholiveira <https://github.com/diegoholiveira>, haginaga
+" Author: diegoholiveira <https://github.com/diegoholiveira>, haginaga <https://github.com/haginaga>
" Description: static analyzer for PHP
" Define the minimum severity
@@ -8,12 +8,16 @@ let g:ale_php_phan_executable = get(g:, 'ale_php_phan_executable', 'phan')
let g:ale_php_phan_use_client = get(g:, 'ale_php_phan_use_client', 0)
function! ale_linters#php#phan#GetExecutable(buffer) abort
- return ale#Var(a:buffer, 'php_phan_executable')
+ let l:executable = ale#Var(a:buffer, 'php_phan_executable')
+ if g:ale_php_phan_use_client == 1 && l:executable == 'phan'
+ let l:executable = 'phan_client'
+ endif
+
+ return l:executable
endfunction
function! ale_linters#php#phan#GetCommand(buffer) abort
- let l:use_client = ale#Var(a:buffer, 'php_phan_use_client')
- if l:use_client == 1
+ if g:ale_php_phan_use_client == 1
let l:args = '-l '
\ . ' %s'
else
@@ -28,10 +32,8 @@ function! ale_linters#php#phan#GetCommand(buffer) abort
endfunction
function! ale_linters#php#phan#Handle(buffer, lines) abort
- let l:use_client = ale#Var(a:buffer, 'php_phan_use_client')
-
" Matches against lines like the following:
- if l:use_client == 1
+ if g:ale_php_phan_use_client == 1
" Phan error: ERRORTYPE: message in /path/to/some-filename.php on line nnn
let l:pattern = '^Phan error: \(\w\+\): \(.\+\) in \(.\+\) on line \(\d\+\)$'
else
@@ -41,7 +43,7 @@ function! ale_linters#php#phan#Handle(buffer, lines) abort
let l:output = []
for l:match in ale#util#GetMatches(a:lines, l:pattern)
- if l:use_client == 1
+ if g:ale_php_phan_use_client == 1
let l:dict = {
\ 'lnum': l:match[4] + 0,
\ 'text': l:match[2],