Skip to content

Commit

Permalink
Make 'php-project feature an optional dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
zonuexe committed Apr 7, 2024
1 parent b9713a1 commit f8a071b
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions phpactor.el
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
(require 'cl-lib)
(require 'f)
(require 'json)
(require 'php-project)
(require 'php-project nil t)
(require 'php-runtime)
(require 'ring)
(require 'subr-x)
Expand All @@ -57,6 +57,7 @@
(require 'xref)
(require 'smart-jump nil t)

(declare-function php-project-get-root-dir "ext:php-project")
(declare-function smart-jump-register "ext:smart-jump")

;; Custom variables
Expand Down Expand Up @@ -202,7 +203,11 @@ have to ensure a compatible version of phpactor is used."
"Return working directory of Phpactor."
(directory-file-name
(expand-file-name
(or (php-project-get-root-dir) default-directory))))
(or (if (fboundp 'php-project-get-root-dir)
(php-project-get-root-dir)
(or (locate-dominating-file default-directory ".phpactor.yml")
(locate-dominating-file default-directory "composer.json")))
default-directory))))

(defun phpactor--expand-local-file-name (name)
"Expand file name by NAME."
Expand Down

0 comments on commit f8a071b

Please sign in to comment.