Skip to content

Commit f8a071b

Browse files
committed
Make 'php-project feature an optional dependency
1 parent b9713a1 commit f8a071b

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

phpactor.el

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
(require 'cl-lib)
4949
(require 'f)
5050
(require 'json)
51-
(require 'php-project)
51+
(require 'php-project nil t)
5252
(require 'php-runtime)
5353
(require 'ring)
5454
(require 'subr-x)
@@ -57,6 +57,7 @@
5757
(require 'xref)
5858
(require 'smart-jump nil t)
5959

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

6263
;; Custom variables
@@ -202,7 +203,11 @@ have to ensure a compatible version of phpactor is used."
202203
"Return working directory of Phpactor."
203204
(directory-file-name
204205
(expand-file-name
205-
(or (php-project-get-root-dir) default-directory))))
206+
(or (if (fboundp 'php-project-get-root-dir)
207+
(php-project-get-root-dir)
208+
(or (locate-dominating-file default-directory ".phpactor.yml")
209+
(locate-dominating-file default-directory "composer.json")))
210+
default-directory))))
206211

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

0 commit comments

Comments
 (0)