From 62af9f2650e0d2bc85f9790844610bfcc6d99847 Mon Sep 17 00:00:00 2001 From: Kevin Quinn Date: Fri, 7 Feb 2025 04:12:54 -0500 Subject: [PATCH] fix: memory-limit option for phpstan (#4900) This might only be a problem for newer phpstan versions (2.1.1 here). If you try to run `phpstan` the way ale will when it builds the option, you will get something like: ``` The "--memory-limit" option requires a value. ``` It wants you to use `--memory-limit=-1` instead. --- ale_linters/php/phpstan.vim | 2 +- test/linter/test_phpstan.vader | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ale_linters/php/phpstan.vim b/ale_linters/php/phpstan.vim index a0942530..d3c80393 100644 --- a/ale_linters/php/phpstan.vim +++ b/ale_linters/php/phpstan.vim @@ -22,7 +22,7 @@ function! ale_linters#php#phpstan#GetCommand(buffer, version) abort let l:memory_limit = ale#Var(a:buffer, 'php_phpstan_memory_limit') let l:memory_limit_option = !empty(l:memory_limit) - \ ? ' --memory-limit ' . ale#Escape(l:memory_limit) + \ ? ' --memory-limit=' . ale#Escape(l:memory_limit) \ : '' let l:level = ale#Var(a:buffer, 'php_phpstan_level') diff --git a/test/linter/test_phpstan.vader b/test/linter/test_phpstan.vader index bb494319..908a186d 100644 --- a/test/linter/test_phpstan.vader +++ b/test/linter/test_phpstan.vader @@ -125,7 +125,7 @@ Execute(Memory limit parameter is added to the command): let g:ale_php_phpstan_memory_limit = '500M' AssertLinter 'phpstan', - \ ale#Escape('phpstan') . ' analyze --no-progress --errorFormat json -l ' . ale#Escape('4') . ' --memory-limit ' . ale#Escape('500M') . ' %s' + \ ale#Escape('phpstan') . ' analyze --no-progress --errorFormat json -l ' . ale#Escape('4') . ' --memory-limit=' . ale#Escape('500M') . ' %s' Execute(Directory is changed to that of the configuration file): call writefile([], '../phpstan.neon')