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'."
7777 (string-match-p flycheck-phpstan--nofiles-message output))
7878 (funcall next checker exit-status files output callback cwd)))
7979
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-
8580(defun flycheck-phpstan--enabled-and-set-variable ()
8681 " Return path to phpstan configure file, and set buffer execute in side effect."
8782 (let ((enabled (phpstan-enabled)))
@@ -145,10 +140,8 @@ passed to `flycheck-finish-checker-process'."
145140 :filename file))))
146141
147142(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 ))))
152145
153146(flycheck-define-checker phpstan
154147 " PHP static analyzer based on PHPStan."
Original file line number Diff line number Diff line change 5252 :type 'boolean
5353 :group 'flymake-phpstan )
5454
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-
6055(defvar-local flymake-phpstan--proc nil )
6156
6257(defun flymake-phpstan-make-process (root command-args report-fn source )
9489 (code (user-error " PHPStan error (exit status: %s)" code)))))))
9590
9691(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 ))))
10194
10295(defun flymake-phpstan--create-temp-file ()
10396 " 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."
521521 (phpstan-use-xdebug-option (list " --xdebug" )))
522522 (when editor
523523 (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 )))))))
531532 options
532533 (and args (cons " --" args)))))
533534
You can’t perform that action at this time.
0 commit comments