Skip to content

Commit

Permalink
Add verbose option to phpstan-get-command-args
Browse files Browse the repository at this point in the history
  • Loading branch information
zonuexe committed May 27, 2024
1 parent 44924b6 commit daa30e3
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions phpstan.el
Original file line number Diff line number Diff line change
Expand Up @@ -359,14 +359,14 @@ it returns the value of `SOURCE' as it is."
(let ((file (phpstan--expand-file-name (or buffer-file-name
(read-file-name "Choose a PHP script: ")))))
(compile (mapconcat #'shell-quote-argument
(phpstan-get-command-args :include-executable t :args (list file)) " "))))
(phpstan-get-command-args :include-executable t :args (list file) :verbose 1) " "))))

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

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

(cl-defun phpstan-get-command-args (&key include-executable use-pro args format options config)
(cl-defun phpstan-get-command-args (&key include-executable use-pro args format options config verbose)
"Return command line argument for PHPStan."
(let ((executable-and-args (phpstan-get-executable-and-args))
(config (or config (phpstan-normalize-path (phpstan-get-config-file))))
Expand All @@ -457,6 +457,12 @@ it returns the value of `SOURCE' as it is."
(and autoload (list "-a" autoload))
(and memory-limit (list "--memory-limit" memory-limit))
(and level (list "-l" level))
(cond
((null verbose) nil)
((memq verbose '(1 t)) (list "-v"))
((eq verbose 2) (list "-vv"))
((eq verbose 3) (list "-vvv"))
(error ":verbose option should be 1, 2, 3 or `t'"))
(cond
(phpstan--use-xdebug-option (list phpstan--use-xdebug-option))
((eq phpstan-use-xdebug-option 'auto)
Expand Down

0 comments on commit daa30e3

Please sign in to comment.