branch: externals/phpinspect
commit b7d493610ce333538a996ccc7756933764420ace
Author: Hugo Thunnissen <de...@hugot.nl>
Commit: Hugo Thunnissen <de...@hugot.nl>

    Use when-let to prevent attempting to fetch nil type
---
 phpinspect-eldoc.el | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/phpinspect-eldoc.el b/phpinspect-eldoc.el
index 52146f4723..7b2a773e9f 100644
--- a/phpinspect-eldoc.el
+++ b/phpinspect-eldoc.el
@@ -186,14 +186,14 @@ be implemented for return values of 
`phpinspect-eld-strategy-execute'")
         (setf (phpinspect--resolvecontext-subject rctx)
               (mapcar #'phpinspect-meta-token (butlast statement 2)))
 
-        (let* ((type-of-previous-statement
+        (when-let* ((type-of-previous-statement
                      (phpinspect-resolve-type-from-context rctx))
-               (method-name (cadadr (phpinspect-meta-token (car 
match-result))))
-               (class (phpinspect-rctx-get-or-create-cached-project-class
-                       rctx type-of-previous-statement 'no-enqueue))
-               (method (if static
-                           (phpinspect--class-get-static-method class 
method-name)
-                         (phpinspect--class-get-method class method-name))))
+                    (method-name (cadadr (phpinspect-meta-token (car 
match-result))))
+                    (class (phpinspect-rctx-get-or-create-cached-project-class
+                            rctx type-of-previous-statement 'no-enqueue))
+                    (method (if static
+                                (phpinspect--class-get-static-method class 
method-name)
+                              (phpinspect--class-get-method class 
method-name))))
 
           (when method
             (phpinspect-make-function-doc :fn method :arg-pos arg-pos))))

Reply via email to