This repository was archived by the owner on Mar 6, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed
lib/LanguageServerCodeTransform/CodeAction Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change 88use Phpactor \Extension \LanguageServerBridge \Converter \PositionConverter ;
99use Phpactor \Extension \LanguageServerCodeTransform \LspCommand \ImportNameCommand ;
1010use Phpactor \Indexer \Model \Query \Criteria ;
11+ use Phpactor \Indexer \Model \Record ;
12+ use Phpactor \Indexer \Model \Record \ConstantRecord ;
1113use Phpactor \Indexer \Model \Record \HasFullyQualifiedName ;
1214use Phpactor \Indexer \Model \SearchClient ;
1315use Phpactor \LanguageServerProtocol \CodeAction ;
@@ -150,6 +152,15 @@ private function diagnosticsFromUnresolvedName(NameWithByteOffset $unresolvedNam
150152 ];
151153 }
152154
155+ // Remove constants for now
156+ $ candidates = array_filter ($ candidates , function (Record $ record ) {
157+ return !$ record instanceof ConstantRecord;
158+ });
159+
160+ if (count ($ candidates ) === 0 ) {
161+ return [];
162+ }
163+
153164 return [
154165 new Diagnostic (
155166 $ range ,
@@ -170,6 +181,7 @@ private function findCandidates(NameWithByteOffset $unresolvedName): array
170181 $ candidates = [];
171182 foreach ($ this ->client ->search (Criteria::and (
172183 Criteria::or (
184+ Criteria::isConstant (),
173185 Criteria::isClass (),
174186 Criteria::isFunction ()
175187 ),
You can’t perform that action at this time.
0 commit comments