Skip to content

Commit 48e278d

Browse files
committed
Fix phpstan-get-config-file for directory-variable
refs #18 fix #19 The reason "or" rather than "and" is to use a directory variable to specify the location of phpstan.neon. That is, this variable allows phpstan.neon to be placed outside of the parent directory.
1 parent dd3a1db commit 48e278d

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

flycheck-phpstan.el

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646

4747
(defun flycheck-phpstan--enabled-and-set-variable ()
4848
"Return path to phpstan configure file, and set buffer execute in side effect."
49-
(let ((enabled (and (phpstan-get-working-dir) (phpstan-get-config-file))))
49+
(let ((enabled (or (phpstan-get-working-dir) (phpstan-get-config-file))))
5050
(prog1 enabled
5151
(when (and phpstan-flycheck-auto-set-executable
5252
(not (and (boundp 'flycheck-phpstan-executable)

phpstan.el

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -181,10 +181,12 @@ NIL
181181
(expand-file-name (cdr phpstan-config-file) (php-project-get-root-dir))
182182
phpstan-config-file)
183183
(let ((working-directory (phpstan-get-working-dir)))
184-
(cl-loop for name in '("phpstan.neon" "phpstan.neon.dist")
185-
for dir = (locate-dominating-file working-directory name)
186-
if dir
187-
return (expand-file-name name dir)))))
184+
(if working-directory
185+
nil
186+
(cl-loop for name in '("phpstan.neon" "phpstan.neon.dist")
187+
for dir = (locate-dominating-file working-directory name)
188+
if dir
189+
return (expand-file-name name dir))))))
188190

189191
(defun phpstan-normalize-path (source-original &optional source)
190192
"Return normalized source file path to pass by `SOURCE-ORIGINAL' OR `SOURCE'.

0 commit comments

Comments
 (0)