diff --git a/phpinspect-autoload.el b/phpinspect-autoload.el index 95043bf..d556c9c 100644 --- a/phpinspect-autoload.el +++ b/phpinspect-autoload.el @@ -114,6 +114,11 @@ bareword typenames.")) (string-remove-prefix ,dir ,filename)))))))) (defun phpinspect-find-composer-json-files (fs project-root) + "Find all composer.json files that are relevant for a project. + +Usually, the relevant files are the current project's +composer.json and the composer.json files of all dependencies in +the vendor directory." (let ((cj-path (concat project-root "/composer.json")) (vendor-dir (concat project-root "/vendor")) files) diff --git a/phpinspect-project.el b/phpinspect-project.el index f3cae30..d30b078 100644 --- a/phpinspect-project.el +++ b/phpinspect-project.el @@ -126,6 +126,10 @@ serious performance hits. Enable at your own risk (:") (dolist (func (alist-get 'functions (cdr index))) (phpinspect-project-set-function project func)))) +(cl-defmethod phpinspect-project-add-index ((_project phpinspect-project) index) + (cl-assert (not index)) + (phpinspect--log "phpinspect-project-add-index: ignoring added nil index")) + (cl-defmethod phpinspect-project-set-function ((project phpinspect-project) (func phpinspect--function)) (phpinspect-project-edit project @@ -305,10 +309,11 @@ before the search is executed." (condition-case error (let* ((file (phpinspect-project-get-type-filepath project type)) (visited-buffer (when file (find-buffer-visiting file)))) - (when file + (if file (if visited-buffer (with-current-buffer visited-buffer (phpinspect-index-current-buffer)) - (with-temp-buffer (phpinspect-project-index-file project file))))) + (with-temp-buffer (phpinspect-project-index-file project file))) + (phpinspect--log "Failed to determine filepath for type %s" (phpinspect--type-name type)))) (file-missing (phpinspect--log "Failed to find file for type %s: %s" type error) nil)))