Skip to content

Commit 59c6b4f

Browse files
authored
phpstan: support config phpstan.dist.neon (#5052)
phpstan will load config from (in order) phpstan.neon, phpstan.neon.dist, or phpstan.dist.neon.
1 parent 21d5de1 commit 59c6b4f

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

ale_linters/php/phpstan.vim

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,10 @@ function! ale_linters#php#phpstan#FindConfigFile(buffer) abort
8787
let l:result = ale#path#FindNearestFile(a:buffer, 'phpstan.neon.dist')
8888
endif
8989

90+
if empty(l:result)
91+
let l:result = ale#path#FindNearestFile(a:buffer, 'phpstan.dist.neon')
92+
endif
93+
9094
return l:result
9195
endfunction
9296

test/linter/test_phpstan.vader

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,17 @@ Execute(Configuration dist file exists in current directory):
102102
\ ]
103103
AssertLinterCwd g:dir
104104

105+
Execute(Configuration alternative dist file exists in current directory):
106+
call writefile(['parameters:', ' level: 7'], './phpstan.dist.neon')
107+
let g:ale_php_phpstan_level = ''
108+
let g:ale_php_phpstan_configuration = ''
109+
110+
AssertLinter 'phpstan', [
111+
\ ale#Escape('phpstan') . ' --version',
112+
\ ale#Escape('phpstan') . ' analyze --no-progress --errorFormat json %s'
113+
\ ]
114+
AssertLinterCwd g:dir
115+
105116
Execute(Configuration file exists in current directory, but force phpstan level):
106117
call writefile(['parameters:', ' level: 7'], './phpstan.neon')
107118
let g:ale_php_phpstan_configuration = ''

0 commit comments

Comments
 (0)