Skip to content

Commit 495e22f

Browse files
authored
Merge pull request #45 from herbertjones/flymake-command-arg-updates
Update flymake for command arg changes
2 parents ef092a2 + 1f4f78a commit 495e22f

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

flymake-phpstan.el

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,15 +90,19 @@
9090

9191
(defun flymake-phpstan (report-fn &rest _ignored-args)
9292
"Flymake backend for PHPStan report using REPORT-FN."
93-
(let ((command-args (phpstan-get-command-args t)))
93+
(let ((command-args (phpstan-get-command-args :include-executable t)))
9494
(unless (car command-args)
9595
(user-error "Cannot find a phpstan executable command"))
9696
(when (process-live-p flymake-phpstan--proc)
9797
(kill-process flymake-phpstan--proc))
98-
(let ((source (current-buffer)))
98+
(let ((source (current-buffer))
99+
(target-path (if (or (buffer-modified-p) (not buffer-file-name))
100+
(phpstan-normalize-path
101+
(flycheck-save-buffer-to-temp #'flycheck-temp-file-inplace))
102+
buffer-file-name)))
99103
(save-restriction
100104
(widen)
101-
(setq flymake-phpstan--proc (flymake-phpstan-make-process (php-project-get-root-dir) command-args report-fn source))
105+
(setq flymake-phpstan--proc (flymake-phpstan-make-process (php-project-get-root-dir) (append command-args (list "--" target-path)) report-fn source))
102106
(process-send-region flymake-phpstan--proc (point-min) (point-max))
103107
(process-send-eof flymake-phpstan--proc)))))
104108

0 commit comments

Comments
 (0)