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.
This commit is contained in:
Kevin Quinn
2025-02-07 04:12:54 -05:00
committed by GitHub
parent 305e1c2fb1
commit 62af9f2650
2 changed files with 2 additions and 2 deletions

View File

@@ -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 = ale#Var(a:buffer, 'php_phpstan_memory_limit')
let l:memory_limit_option = !empty(l: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') let l:level = ale#Var(a:buffer, 'php_phpstan_level')

View File

@@ -125,7 +125,7 @@ Execute(Memory limit parameter is added to the command):
let g:ale_php_phpstan_memory_limit = '500M' let g:ale_php_phpstan_memory_limit = '500M'
AssertLinter 'phpstan', 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): Execute(Directory is changed to that of the configuration file):
call writefile([], '../phpstan.neon') call writefile([], '../phpstan.neon')