emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/phpinspect 5528aff2a2 01/18: Handle cases where the fil


From: ELPA Syncer
Subject: [elpa] externals/phpinspect 5528aff2a2 01/18: Handle cases where the filepath of a type cannot be determined
Date: Fri, 16 Aug 2024 06:58:55 -0400 (EDT)

branch: externals/phpinspect
commit 5528aff2a21f71eac37c5c378e8e5be0accab872
Author: Hugo Thunnissen <devel@hugot.nl>
Commit: Hugo Thunnissen <devel@hugot.nl>

    Handle cases where the filepath of a type cannot be determined
---
 phpinspect-autoload.el | 5 +++++
 phpinspect-project.el  | 9 +++++++--
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/phpinspect-autoload.el b/phpinspect-autoload.el
index 95043bf7d1..d556c9c395 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 f3cae30dec..d30b078a15 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)))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]