Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions ale_linters/php/phpstan.vim
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ function! ale_linters#php#phpstan#FindConfigFile(buffer) abort
let l:result = ale#path#FindNearestFile(a:buffer, 'phpstan.neon.dist')
endif

if empty(l:result)
let l:result = ale#path#FindNearestFile(a:buffer, 'phpstan.dist.neon')
endif

return l:result
endfunction

Expand Down
11 changes: 11 additions & 0 deletions test/linter/test_phpstan.vader
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,17 @@ Execute(Configuration dist file exists in current directory):
\ ]
AssertLinterCwd g:dir

Execute(Configuration alternative dist file exists in current directory):
call writefile(['parameters:', ' level: 7'], './phpstan.dist.neon')
let g:ale_php_phpstan_level = ''
let g:ale_php_phpstan_configuration = ''

AssertLinter 'phpstan', [
\ ale#Escape('phpstan') . ' --version',
\ ale#Escape('phpstan') . ' analyze --no-progress --errorFormat json %s'
\ ]
AssertLinterCwd g:dir

Execute(Configuration file exists in current directory, but force phpstan level):
call writefile(['parameters:', ' level: 7'], './phpstan.neon')
let g:ale_php_phpstan_configuration = ''
Expand Down