diff options
-rw-r--r-- | ale_linters/php/phpstan.vim | 3 | ||||
-rw-r--r-- | test/linter/test_phpstan.vader | 10 |
2 files changed, 12 insertions, 1 deletions
diff --git a/ale_linters/php/phpstan.vim b/ale_linters/php/phpstan.vim index 78f7dd10..5e231a3b 100644 --- a/ale_linters/php/phpstan.vim +++ b/ale_linters/php/phpstan.vim @@ -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 diff --git a/test/linter/test_phpstan.vader b/test/linter/test_phpstan.vader index 813fe448..9f73c18a 100644 --- a/test/linter/test_phpstan.vader +++ b/test/linter/test_phpstan.vader @@ -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 = '' |