From 59c6b4f7b013d527da43782d5e073e6f03bb5ba9 Mon Sep 17 00:00:00 2001 From: Bill Ruddock Date: Sun, 26 Oct 2025 06:55:40 +0000 Subject: [PATCH] phpstan: support config phpstan.dist.neon (#5052) phpstan will load config from (in order) phpstan.neon, phpstan.neon.dist, or phpstan.dist.neon. --- ale_linters/php/phpstan.vim | 4 ++++ test/linter/test_phpstan.vader | 11 +++++++++++ 2 files changed, 15 insertions(+) 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 = ''