File tree Expand file tree Collapse file tree 3 files changed +12
-25
lines changed Expand file tree Collapse file tree 3 files changed +12
-25
lines changed Original file line number Diff line number Diff line change @@ -77,11 +77,6 @@ passed to `flycheck-finish-checker-process'."
77
77
(string-match-p flycheck-phpstan--nofiles-message output))
78
78
(funcall next checker exit-status files output callback cwd)))
79
79
80
- (defcustom flycheck-phpstan-fallback-to-original-analysis-if-editor-mode-unavailable t
81
- " If non-NIL, analyze the original file when PHPStan editor mode is unavailable."
82
- :type 'boolean
83
- :safe #'booleanp )
84
-
85
80
(defun flycheck-phpstan--enabled-and-set-variable ()
86
81
" Return path to phpstan configure file, and set buffer execute in side effect."
87
82
(let ((enabled (phpstan-enabled)))
@@ -145,10 +140,8 @@ passed to `flycheck-finish-checker-process'."
145
140
:filename file))))
146
141
147
142
(defun flycheck-phpstan-analyze-original (original )
148
- " Return non-NIL if ORIGINAL is NIL, fallback is enabled, and buffer is modified."
149
- (and (null original)
150
- flycheck-phpstan-fallback-to-original-analysis-if-editor-mode-unavailable
151
- (buffer-modified-p )))
143
+ " Return non-NIL if ORIGINAL is non-NIL and buffer is not modified."
144
+ (and original (not (buffer-modified-p ))))
152
145
153
146
(flycheck-define-checker phpstan
154
147
" PHP static analyzer based on PHPStan."
Original file line number Diff line number Diff line change 52
52
:type 'boolean
53
53
:group 'flymake-phpstan )
54
54
55
- (defcustom flycheck-phpstan-fallback-to-original-analysis-if-editor-mode-unavailable t
56
- " If non-NIL, analyze the original file when PHPStan editor mode is unavailable."
57
- :type 'boolean
58
- :safe #'booleanp )
59
-
60
55
(defvar-local flymake-phpstan--proc nil )
61
56
62
57
(defun flymake-phpstan-make-process (root command-args report-fn source )
94
89
(code (user-error " PHPStan error (exit status: %s)" code)))))))
95
90
96
91
(defun flymake-phpstan-analyze-original (original )
97
- " Return non-NIL if ORIGINAL is NIL, fallback is enabled, and buffer is modified."
98
- (and (null original)
99
- flymake-phpstan-fallback-to-original-analysis-if-editor-mode-unavailable
100
- (buffer-modified-p )))
92
+ " Return non-NIL if ORIGINAL is non-NIL and buffer is not modified."
93
+ (and original (not (buffer-modified-p ))))
101
94
102
95
(defun flymake-phpstan--create-temp-file ()
103
96
" Create temp file and return the path."
Original file line number Diff line number Diff line change @@ -521,13 +521,14 @@ it returns the value of `SOURCE' as it is."
521
521
(phpstan-use-xdebug-option (list " --xdebug" )))
522
522
(when editor
523
523
(let ((original-file (plist-get editor :original-file )))
524
- (if (phpstan-editor-mode-available-p (car (phpstan-get-executable-and-args)))
525
- (list " --tmp-file" (funcall (plist-get editor :temp-file ))
526
- " --instead-of" original-file
527
- " --" original-file)
528
- (if (funcall (plist-get editor :analyze-original ) original-file)
529
- (list " --" original-file)
530
- (list " --" (funcall (plist-get editor :inplace )))))))
524
+ (cond
525
+ ((funcall (plist-get editor :analyze-original ) original-file)
526
+ (list " --" original-file))
527
+ ((phpstan-editor-mode-available-p (car (phpstan-get-executable-and-args)))
528
+ (list " --tmp-file" (funcall (plist-get editor :temp-file ))
529
+ " --instead-of" original-file
530
+ " --" original-file))
531
+ ((list " --" (funcall (plist-get editor :inplace )))))))
531
532
options
532
533
(and args (cons " --" args)))))
533
534
You can’t perform that action at this time.
0 commit comments