|
77 | 77 | :type 'boolean
|
78 | 78 | :group 'phpstan)
|
79 | 79 |
|
| 80 | +(defcustom phpstan-memory-limit nil |
| 81 | + "Set --memory-limit option." |
| 82 | + :type '(choice (string :tag "Specifies the memory limit in the same format php.ini accepts.") |
| 83 | + (const :tag "Not set --memory-limit option" nil)) |
| 84 | + :safe (lambda (v) (or (null v) (stringp v))) |
| 85 | + :group 'phpstan) |
| 86 | + |
80 | 87 | ;;;###autoload
|
81 | 88 | (progn
|
82 | 89 | (defvar phpstan-working-dir nil
|
@@ -259,6 +266,10 @@ it returns the value of `SOURCE' as it is."
|
259 | 266 | ((symbolp phpstan-level) (symbol-name phpstan-level))
|
260 | 267 | (t phpstan-level)))
|
261 | 268 |
|
| 269 | +(defun phpstan-get-memory-limit () |
| 270 | + "Return --memory-limit value." |
| 271 | + phpstan-memory-limit) |
| 272 | + |
262 | 273 | (defun phpstan-analyze-file (file)
|
263 | 274 | "Analyze a PHPScript FILE using PHPStan."
|
264 | 275 | (interactive "fChoose a PHP script: ")
|
@@ -295,11 +306,13 @@ it returns the value of `SOURCE' as it is."
|
295 | 306 | (let ((executable (phpstan-get-executable))
|
296 | 307 | (path (phpstan-normalize-path (phpstan-get-config-file)))
|
297 | 308 | (autoload (phpstan-get-autoload-file))
|
| 309 | + (memory-limit (phpstan-get-memory-limit)) |
298 | 310 | (level (phpstan-get-level)))
|
299 | 311 | (append executable
|
300 | 312 | (list "analyze" "--error-format=raw" "--no-progress" "--no-interaction")
|
301 | 313 | (and path (list "-c" path))
|
302 | 314 | (and autoload (list "-a" autoload))
|
| 315 | + (and memory-limit (list "--memory-limit" memory-limit)) |
303 | 316 | (and level (list "-l" level))
|
304 | 317 | (list "--"))))
|
305 | 318 |
|
|
0 commit comments