Skip to content

Commit 8928206

Browse files
committed
Make flycheck analyze the original directly instead of temporary
1 parent a9eb3e4 commit 8928206

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,7 @@ 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+
12+
### Changed
13+
14+
* Make flycheck analyze the original file directly instead of temporary files when there are no changes to the file.

flycheck-phpstan.el

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,10 @@
6363
(flycheck-define-checker phpstan
6464
"PHP static analyzer based on PHPStan."
6565
:command ("php" (eval (phpstan-get-command-args))
66-
(eval (phpstan-normalize-path
67-
(flycheck-save-buffer-to-temp #'flycheck-temp-file-inplace)
68-
(flycheck-save-buffer-to-temp #'flycheck-temp-file-system))))
66+
(eval (if (or (buffer-modified-p) (not buffer-file-name))
67+
(phpstan-normalize-path
68+
(flycheck-save-buffer-to-temp #'flycheck-temp-file-inplace))
69+
buffer-file-name)))
6970
:working-directory (lambda (_) (phpstan-get-working-dir))
7071
:enabled (lambda () (flycheck-phpstan--enabled-and-set-variable))
7172
:error-patterns

0 commit comments

Comments
 (0)