" Author: richard marmorstein <https://github.com/twitchard>
" Description: plugin for Psalm, static analyzer for PHP

call ale#Set('php_psalm_executable', 'psalm')

function! ale_linters#php#psalm#Handle(buffer, lines) abort
    " Matches patterns like the following:
    let l:pattern = '^.*:\(\d\+\):\(\d\+\):\(\w\+\) - \(.*\)$'
    let l:output = []

    for l:match in ale#util#GetMatches(a:lines, l:pattern)
        call add(l:output, {
        \   'lnum': l:match[1] + 0,
        \   'text': l:match[4],
        \   'type': l:match[3][:0] is# 'e' ? 'E' : 'W',
        \})
    endfor

    return l:output
endfunction

call ale#linter#Define('php', {
\   'name': 'psalm',
\   'command': '%e --diff --output-format=emacs %s',
\   'executable_callback': ale#VarFunc('php_psalm_executable'),
\   'callback': 'ale_linters#php#psalm#Handle',
\   'lint_file': 1,
\})

" Author: Matt Brown <https://github.com/muglug>
" Description: plugin for Psalm, static analyzer for PHP

call ale#Set('psalm_langserver_executable', 'psalm-language-server')
call ale#Set('psalm_langserver_use_global', get(g:, 'ale_use_global_executables', 0))

function! ale_linters#php#psalm#GetProjectRoot(buffer) abort
    let l:git_path = ale#path#FindNearestDirectory(a:buffer, '.git')

    return !empty(l:git_path) ? fnamemodify(l:git_path, ':h:h') : ''
endfunction

call ale#linter#Define('php', {
\   'name': 'psalm',
\   'lsp': 'stdio',
\   'executable_callback': ale#node#FindExecutableFunc('psalm_langserver', [
\       'vendor/bin/psalm-language-server',
\   ]),
\   'command': '%e',
\   'project_root_callback': 'ale_linters#php#psalm#GetProjectRoot',
\})

Update Psalm plugin to use LSP mode
Update Psalm plugin to use LSP mode
neersighted/ale,neersighted/ale,IngoHeimbach/ale,w0rp/ale,IngoHeimbach/ale,hernot/ale,neersighted/ale,IngoHeimbach/ale,w0rp/ale,hernot/ale,hernot/ale,w0rp/ale