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

    Fix bugs in phpinspect-fix-imports
---
 phpinspect-imports.el | 2 +-
 phpinspect-index.el   | 7 ++++---
 test/test-index.el    | 5 +++--
 3 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/phpinspect-imports.el b/phpinspect-imports.el
index c6c7d0957d..cff07ef3f5 100644
--- a/phpinspect-imports.el
+++ b/phpinspect-imports.el
@@ -94,7 +94,7 @@ buffer position to insert the use statement at."
       (cond ((= 1 (length fqns))
              (phpinspect-add-use (symbol-name (car fqns)) buffer 
namespace-token))
             ((> (length fqns) 1)
-             (phpinspect-add-use (symbol-name (completing-read "Class: " fqns))
+             (phpinspect-add-use (completing-read "Class: " fqns)
                                  buffer namespace-token))
             (t (message "No import found for type %s" typename))))))
 
diff --git a/phpinspect-index.el b/phpinspect-index.el
index f45a5b4900..31e802f529 100644
--- a/phpinspect-index.el
+++ b/phpinspect-index.el
@@ -217,11 +217,13 @@ function (think \"new\" statements, return types etc.)."
                    (cond (enc-extends
                           (push (funcall type-resolver (phpinspect--make-type
                                                         :name (cadr word)))
-                                extends))
+                                extends)
+                          (push (cadr word) used-types))
                          (enc-implements
                           (push (funcall type-resolver (phpinspect--make-type
                                                         :name (cadr word)))
-                                implements))))))))
+                                implements)
+                          (push (cadr word) used-types))))))))
 
     (dolist (token (caddr class))
       (cond ((phpinspect-scope-p token)
@@ -319,7 +321,6 @@ function (think \"new\" statements, return types etc.)."
       (setq methods
             (nconc methods (phpinspect--index-method-annotations type-resolver 
doc-block))))
 
-
     (let ((class-name (funcall type-resolver (phpinspect--make-type :name 
class-name))))
       `(,class-name .
                     (phpinspect--indexed-class
diff --git a/test/test-index.el b/test/test-index.el
index 3fdfb0044d..12d5af73d4 100644
--- a/test/test-index.el
+++ b/test/test-index.el
@@ -70,7 +70,7 @@
 (ert-deftest phpinspect-index-used-types-in-class ()
   (let* ((result (phpinspect--index-tokens
                   (phpinspect-parse-string
-                   "<?php namespace Field; class Potato {
+                   "<?php namespace Field; class Potato extends Cheese, Bacon 
implements Ham, Bagel {
 public function makeThing(): Thing
 {
 if ((new Monkey())->tree() === true) {
@@ -82,7 +82,8 @@ return StaticThing::create(new 
ThingFactory())->makeThing((((new Potato())->anti
     (should (equal
              (mapcar #'phpinspect-intern-name
                      (sort
-                      '("Monkey" "ExtendedThing" "StaticThing" "Thing" 
"ThingFactory" "Potato" "OtherThing")
+                      '("Cheese" "Bacon" "Ham" "Bagel" "Monkey" "ExtendedThing"
+                        "StaticThing" "Thing" "ThingFactory" "Potato" 
"OtherThing")
                       #'string<))
              (sort used-types (lambda (s1 s2) (string< (symbol-name s1) 
(symbol-name s2))))))))
 

Reply via email to