emacs-php/phpstan.el

Fails when open a phpfile not in a project

Closed this issue · 1 comments

phpstan-get-config-file will try to call expand-file-name with a nil directory if a project directory is not found.

Debugger entered--Lisp error: (wrong-type-argument stringp nil)
  expand-file-name(nil)
  locate-dominating-file(nil "phpstan.neon")
  phpstan-get-config-file()
  flycheck-phpstan--enabled-and-set-variable()
  #[0 "\300 \207" [flycheck-phpstan--enabled-and-set-variable] 1]()
  #[0 "\302\300!\205��\303\300!\205��\301?\206��\301 \207" [phpstan #[0 "\300 \207" [flycheck-phpstan--enabled-and-set-variable] 1] flycheck-find-checker-executable flycheck-temp-files-writable-p] 2]()
  #[0 "\303\300!\203��\301?\206��\304\300!�\301 )\207\305\306\307\310\300$\210\311\207" [phpstan #[0 "\302\300!\205��\303\300!\205��\301?\206��\301 \207" [phpstan #[0 "\300 \207" [flycheck-phpstan--enabled-and-set-variable] 1] flycheck-find-checker-executable flycheck-temp-files-writable-p] 2] default-directory flycheck-valid-checker-p flycheck-compute-working-directory lwarn flycheck :warning "%S is no valid Flycheck syntax checker.\nTry to reinstall the package defining this syntax checker." nil] 5]()
  flycheck-may-enable-checker(phpstan)
  flycheck-may-use-checker(phpstan)
  flycheck-may-use-next-checker(phpstan)
  #[257 "\300�!\205\n�\301\302�\"\207" [flycheck-may-use-next-checker throw seq--break] 4 "\n\n(fn ELT)"](phpstan)
  mapc(#[257 "\300�!\205\n�\301\302�\"\207" [flycheck-may-use-next-checker throw seq--break] 4 "\n\n(fn ELT)"] (phpstan phpstan (warning . php-phpmd) (warning . php-phpcs)))
  seq-do(#[257 "\300�!\205\n�\301\302�\"\207" [flycheck-may-use-next-checker throw seq--break] 4 "\n\n(fn ELT)"] (phpstan phpstan (warning . php-phpmd) (warning . php-phpcs)))
  seq-find(flycheck-may-use-next-checker (phpstan phpstan (warning . php-phpmd) (warning . php-phpcs)))
  flycheck-get-next-checker-for-buffer(php)
  flycheck-finish-current-syntax-check(nil "~/")
  flycheck-report-buffer-checker-status([cl-struct-flycheck-syntax-check #<buffer test.php> php #<process flycheck-php> "~/"] finished nil)
  apply(flycheck-report-buffer-checker-status [cl-struct-flycheck-syntax-check #<buffer test.php> php #<process flycheck-php> "~/"] (finished nil))
  #[128 "\301\302\300�#\207" [[cl-struct-flycheck-syntax-check #<buffer test.php> php #<process flycheck-php> "~/"] apply flycheck-report-buffer-checker-status] 5 "\n\n(fn &rest ARGS)"](finished nil)
  flycheck-finish-checker-process(php 0 ("/tmp/flycheck27758vYe/test.php" "/tmp/flycheck27758vYe") "No syntax errors detected in /tmp/flycheck27758vYe/test.php\n" #[128 "\301\302\300�#\207" [[cl-struct-flycheck-syntax-check #<buffer test.php> php #<process flycheck-php> "~/"] apply flycheck-report-buffer-checker-status] 5 "\n\n(fn &rest ARGS)"] "~/")
  flycheck-handle-signal(#<process flycheck-php> "finished\n")

@yisraeldov Thank you.