diff --git a/ale_linters/php/phpstan.vim b/ale_linters/php/phpstan.vim index 8986912b..ffe32beb 100644 --- a/ale_linters/php/phpstan.vim +++ b/ale_linters/php/phpstan.vim @@ -87,6 +87,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 diff --git a/test/linter/test_phpstan.vader b/test/linter/test_phpstan.vader index 610388dd..61eeb27f 100644 --- a/test/linter/test_phpstan.vader +++ b/test/linter/test_phpstan.vader @@ -102,6 +102,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 = ''