Skip to content

Commit daa30e3

Browse files
committed
Add verbose option to phpstan-get-command-args
1 parent 44924b6 commit daa30e3

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

phpstan.el

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -359,14 +359,14 @@ it returns the value of `SOURCE' as it is."
359359
(let ((file (phpstan--expand-file-name (or buffer-file-name
360360
(read-file-name "Choose a PHP script: ")))))
361361
(compile (mapconcat #'shell-quote-argument
362-
(phpstan-get-command-args :include-executable t :args (list file)) " "))))
362+
(phpstan-get-command-args :include-executable t :args (list file) :verbose 1) " "))))
363363

364364
;;;###autoload
365365
(defun phpstan-analyze-file (file)
366366
"Analyze a PHP script FILE using PHPStan."
367367
(interactive (list (phpstan--expand-file-name (read-file-name "Choose a PHP script: "))))
368368
(compile (mapconcat #'shell-quote-argument
369-
(phpstan-get-command-args :include-executable t :args (list file)) " ")))
369+
(phpstan-get-command-args :include-executable t :args (list file) :verbose 1) " ")))
370370

371371
;;;###autoload
372372
(defun phpstan-analyze-project ()
@@ -440,7 +440,7 @@ it returns the value of `SOURCE' as it is."
440440
((executable-find "phpstan") (list (executable-find "phpstan")))
441441
(t (error "PHPStan executable not found")))))))
442442

443-
(cl-defun phpstan-get-command-args (&key include-executable use-pro args format options config)
443+
(cl-defun phpstan-get-command-args (&key include-executable use-pro args format options config verbose)
444444
"Return command line argument for PHPStan."
445445
(let ((executable-and-args (phpstan-get-executable-and-args))
446446
(config (or config (phpstan-normalize-path (phpstan-get-config-file))))
@@ -457,6 +457,12 @@ it returns the value of `SOURCE' as it is."
457457
(and autoload (list "-a" autoload))
458458
(and memory-limit (list "--memory-limit" memory-limit))
459459
(and level (list "-l" level))
460+
(cond
461+
((null verbose) nil)
462+
((memq verbose '(1 t)) (list "-v"))
463+
((eq verbose 2) (list "-vv"))
464+
((eq verbose 3) (list "-vvv"))
465+
(error ":verbose option should be 1, 2, 3 or `t'"))
460466
(cond
461467
(phpstan--use-xdebug-option (list phpstan--use-xdebug-option))
462468
((eq phpstan-use-xdebug-option 'auto)

0 commit comments

Comments
 (0)