Skip to content

Commit 7ab85a4

Browse files
committed
Add phpstan-baseline-file command
1 parent b4baa1b commit 7ab85a4

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

phpstan.el

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,12 @@
108108
(const :tag "No --xdebug option" nil))
109109
:group 'phpstan)
110110

111+
(defcustom phpstan-baseline-file "phpstan-baseline.neon"
112+
"File name of PHPStan baseline file."
113+
:type 'string
114+
:safe #'stringp
115+
:group 'phpstan)
116+
111117
(defvar-local phpstan--use-xdebug-option nil)
112118

113119
;;;###autoload
@@ -336,6 +342,14 @@ it returns the value of `SOURCE' as it is."
336342
(compile (mapconcat #'shell-quote-argument
337343
(phpstan-get-command-args :include-executable t :options '("--generate-baseline")) " ")))
338344

345+
;;;###autoload
346+
(defun phpstan-find-baseline-file ()
347+
"Find PHPStan baseline file of current project."
348+
(interactive)
349+
(if-let ((path (locate-dominating-file default-directory phpstan-baseline-file)))
350+
(find-file (expand-file-name phpstan-baseline-file path))
351+
(user-error "Baseline file not found. Try running M-x phpstan-generate-baseline")))
352+
339353
;;;###autoload
340354
(defun phpstan-pro ()
341355
"Analyze current PHP project using PHPStan Pro."

0 commit comments

Comments
 (0)