Skip to content

Commit e229e99

Browse files
committed
Add phpstan-pro command to launch PHPStan Pro
1 parent fb5a489 commit e229e99

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ All notable changes of the phpactor.el are documented in this file using the [Ke
88

99
* Add `phpstan-analyze-this-file` command
1010
* Add `phpstan.dist.neon` to `phpstan-get-config-file` as PHPStan config files.
11+
* Add `phpstan-pro` command to launch [PHPStan Pro].
12+
13+
[PHPStan Pro]: https://phpstan.org/blog/introducing-phpstan-pro
1114

1215
### Changed
1316

phpstan.el

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,15 @@ it returns the value of `SOURCE' as it is."
300300
(compile (mapconcat #'shell-quote-argument
301301
(append (phpstan-get-command-args :include-executable t) (list file)) " ")))
302302

303+
;;;###autoload
304+
(defun phpstan-pro ()
305+
"Analyze current PHP project using PHPStan Pro."
306+
(interactive)
307+
(let ((compilation-buffer-name-function (lambda (_) "*PHPStan Pro*"))
308+
(command (mapconcat #'shell-quote-argument
309+
(phpstan-get-command-args :include-executable t :use-pro t) " ")))
310+
(compile command t)))
311+
303312
(defun phpstan-get-executable-and-args ()
304313
"Return PHPStan excutable file and arguments."
305314
(cond
@@ -347,6 +356,7 @@ it returns the value of `SOURCE' as it is."
347356
(append (if include-executable (list (car executable-and-args)) nil)
348357
(cdr executable-and-args)
349358
(list "analyze" "--error-format=raw" "--no-progress" "--no-interaction")
359+
(and use-pro (list "--pro" "--no-ansi"))
350360
(and path (list "-c" path))
351361
(and autoload (list "-a" autoload))
352362
(and memory-limit (list "--memory-limit" memory-limit))

0 commit comments

Comments
 (0)