Index used traits (juste use of type, no actual functionality outside of that)

master
Hugo Thunnissen 1 month ago
parent 130e2c06c5
commit 93b815d71a

@ -349,6 +349,10 @@ SCOPE should be a scope token (`phpinspect-scope-p')."
(setq comment-before token)) (setq comment-before token))
;; Prevent comments from sticking around too long ;; Prevent comments from sticking around too long
((and (phpinspect-use-p token) (phpinspect-word-p (cadr token)))
;; FIXME: Actually implement indexation of trait usage. This just
;; marks the type as used for now.
(push (cadadr token) used-types))
(t (t
(phpinspect--log "Unsetting comment-before") (phpinspect--log "Unsetting comment-before")
(setq comment-before nil)))) (setq comment-before nil))))

@ -89,6 +89,8 @@
(phpinspect-parse-string (phpinspect-parse-string
"<?php namespace Field; class Potato extends Cheese, Bacon implements Ham, Bagel { "<?php namespace Field; class Potato extends Cheese, Bacon implements Ham, Bagel {
use UsedTrait;
private PropertyType $property; private PropertyType $property;
public function makeThing(): Thing public function makeThing(): Thing
@ -110,7 +112,7 @@ if ($param instanceof InstanceOffed) {
(copy-sequence (copy-sequence
'("Cheese" "Bacon" "Ham" "Bagel" "Monkey" "ExtendedThing" '("Cheese" "Bacon" "Ham" "Bagel" "Monkey" "ExtendedThing"
"StaticThing" "Thing" "ThingFactory" "Potato" "OtherThing" "StaticThing" "Thing" "ThingFactory" "Potato" "OtherThing"
"InnerFunctionParam" "PropertyType" "InstanceOffed" "NestedArray")) "InnerFunctionParam" "PropertyType" "InstanceOffed" "NestedArray" "UsedTrait"))
#'string<)) #'string<))
(sort used-types (lambda (s1 s2) (string< (phpinspect-name-string s1) (phpinspect-name-string s2)))))))) (sort used-types (lambda (s1 s2) (string< (phpinspect-name-string s1) (phpinspect-name-string s2))))))))

Loading…
Cancel
Save