forked from github-mirrors/ale
[PHP] PhpStan also looks for .dist config file (#3765)
* [PHP] PhpStan also looks for .dist config file * Add tests
This commit is contained in:
parent
52563f9181
commit
12d8803015
|
@ -20,8 +20,9 @@ function! ale_linters#php#phpstan#GetCommand(buffer, version) abort
|
|||
|
||||
let l:level = ale#Var(a:buffer, 'php_phpstan_level')
|
||||
let l:config_file_exists = ale#path#FindNearestFile(a:buffer, 'phpstan.neon')
|
||||
let l:dist_config_file_exists = ale#path#FindNearestFile(a:buffer, 'phpstan.neon.dist')
|
||||
|
||||
if empty(l:level) && empty(l:config_file_exists)
|
||||
if empty(l:level) && empty(l:config_file_exists) && empty(l:dist_config_file_exists)
|
||||
" if no configuration file is found, then use 4 as a default level
|
||||
let l:level = '4'
|
||||
endif
|
||||
|
|
|
@ -58,6 +58,16 @@ Execute(Configuration file exists in current directory):
|
|||
\ ale#Escape('phpstan') . ' analyze --no-progress --errorFormat raw %s'
|
||||
\ ]
|
||||
|
||||
Execute(Configuration dist file exists in current directory):
|
||||
call writefile(['parameters:', ' level: 7'], './phpstan.neon.dist')
|
||||
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 raw %s'
|
||||
\ ]
|
||||
|
||||
Execute(Configuration file exists in current directory, but force phpstan level):
|
||||
call writefile(['parameters:', ' level: 7'], './phpstan.neon')
|
||||
let g:ale_php_phpstan_configuration = ''
|
||||
|
|
Loading…
Reference in New Issue