summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ale_linters/php/phpstan.vim4
-rw-r--r--doc/ale-php.txt8
-rw-r--r--test/command_callback/test_phpstan_command_callbacks.vader12
3 files changed, 13 insertions, 11 deletions
diff --git a/ale_linters/php/phpstan.vim b/ale_linters/php/phpstan.vim
index ca12211c..b621f855 100644
--- a/ale_linters/php/phpstan.vim
+++ b/ale_linters/php/phpstan.vim
@@ -9,7 +9,7 @@ let g:ale_php_phpstan_configuration = get(g:, 'ale_php_phpstan_configuration', '
function! ale_linters#php#phpstan#GetCommand(buffer, version) abort
let l:configuration = ale#Var(a:buffer, 'php_phpstan_configuration')
let l:configuration_option = !empty(l:configuration)
- \ ? ' -c ' . l:configuration
+ \ ? ' -c ' . ale#Escape(l:configuration)
\ : ''
let l:level = ale#Var(a:buffer, 'php_phpstan_level')
@@ -21,7 +21,7 @@ function! ale_linters#php#phpstan#GetCommand(buffer, version) abort
endif
let l:level_option = !empty(l:level)
- \ ? ' -l ' . l:level
+ \ ? ' -l ' . ale#Escape(l:level)
\ : ''
let l:error_format = ale#semver#GTE(a:version, [0, 10, 3])
diff --git a/doc/ale-php.txt b/doc/ale-php.txt
index 83bc0fd5..6f53cead 100644
--- a/doc/ale-php.txt
+++ b/doc/ale-php.txt
@@ -154,11 +154,13 @@ g:ale_php_phpstan_executable *g:ale_php_phpstan_executable*
g:ale_php_phpstan_level *g:ale_php_phpstan_level*
*b:ale_php_phpstan_level*
- Type: |Number|
- Default: `4`
+ Type: |String|
+ Default: `''`
This variable controls the rule levels. 0 is the loosest and 4 is the
- strictest.
+ strictest. If this option isn't set, the rule level will be controlled by
+ the configuration file. If no configuration file can be detected, `'4'` will
+ be used instead.
g:ale_php_phpstan_configuration *g:ale_php_phpstan_configuration*
diff --git a/test/command_callback/test_phpstan_command_callbacks.vader b/test/command_callback/test_phpstan_command_callbacks.vader
index 72524c55..3714fc64 100644
--- a/test/command_callback/test_phpstan_command_callbacks.vader
+++ b/test/command_callback/test_phpstan_command_callbacks.vader
@@ -12,27 +12,27 @@ Execute(Custom executables should be used for the executable and command):
let g:ale_php_phpstan_executable = 'phpstan_test'
AssertLinter 'phpstan_test',
- \ ale#Escape('phpstan_test') . ' analyze --no-progress --errorFormat raw -l 4 %s'
+ \ ale#Escape('phpstan_test') . ' analyze --no-progress --errorFormat raw -l ' . ale#Escape('4') . ' %s'
Execute(project with level set to 3):
call ale#test#SetFilename('phpstan-test-files/foo/test.php')
let g:ale_php_phpstan_level = 3
AssertLinter 'phpstan',
- \ ale#Escape('phpstan') . ' analyze --no-progress --errorFormat raw -l 3 %s'
+ \ ale#Escape('phpstan') . ' analyze --no-progress --errorFormat raw -l ' . ale#Escape('3') . ' %s'
Execute(Custom phpstan configuration file):
let g:ale_php_phpstan_configuration = 'phpstan_config'
AssertLinter 'phpstan',
- \ ale#Escape('phpstan') . ' analyze --no-progress --errorFormat raw -c phpstan_config -l 4 %s'
+ \ ale#Escape('phpstan') . ' analyze --no-progress --errorFormat raw -c ' . ale#Escape('phpstan_config') . ' -l ' . ale#Escape('4') . ' %s'
Execute(Choose the right format for error format param):
GivenCommandOutput ['0.10.3']
AssertLinter 'phpstan', [
\ ale#Escape('phpstan') . ' --version',
- \ ale#Escape('phpstan') . ' analyze --no-progress --error-format raw -l 4 %s'
+ \ ale#Escape('phpstan') . ' analyze --no-progress --error-format raw -l ' . ale#Escape('4') . ' %s'
\ ]
Execute(Configuration file exists in current directory):
@@ -52,7 +52,7 @@ Execute(Configuration file exists in current directory, but force phpstan level)
AssertLinter 'phpstan', [
\ ale#Escape('phpstan') . ' --version',
- \ ale#Escape('phpstan') . ' analyze --no-progress --errorFormat raw -l 7 %s'
+ \ ale#Escape('phpstan') . ' analyze --no-progress --errorFormat raw -l ' . ale#Escape('7') . ' %s'
\ ]
Execute(Configuration file exists in current directory, but force phpstan configuration):
@@ -62,5 +62,5 @@ Execute(Configuration file exists in current directory, but force phpstan config
AssertLinter 'phpstan', [
\ ale#Escape('phpstan') . ' --version',
- \ ale#Escape('phpstan') . ' analyze --no-progress --errorFormat raw -c phpstan.custom.neon %s'
+ \ ale#Escape('phpstan') . ' analyze --no-progress --errorFormat raw -c ' . ale#Escape('phpstan.custom.neon') . ' %s'
\ ]