File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -17,19 +17,10 @@ public function __construct(ClassNameCompleter $completer)
1717 }
1818 public function getEntries (Project $ project , Context $ context )
1919 {
20- list ($ type , $ isThis , $ types ) = $ context ->getData ();
21- if (is_array ($ types )) {
22- $ fqcn = array_pop ($ types );
23- if ($ fqcn instanceof FQCN
24- && $ fqcn ->toString () === 'DI \\Container '
25- ) {
26- return array_map (
27- [$ this , 'wrapEntry ' ],
28- $ this ->classNameCompleter ->getEntries ($ project , $ context )
29- );
30- }
31- }
32- return [];
20+ return array_map (
21+ [$ this , 'wrapEntry ' ],
22+ $ this ->classNameCompleter ->getEntries ($ project , $ context )
23+ );
3324 }
3425
3526 public function wrapEntry ($ entry )
Original file line number Diff line number Diff line change 44
55use Symfony \Component \EventDispatcher \EventDispatcher ;
66use Complete \Resolver \NodeTypeResolver ;
7- use Complete \Completer \ CompleterFactory ;
7+ use Complete \CompleteEngine ;
88use Parser \UseParser ;
9+ use Entity \FQCN ;
910
1011class Plugin
1112{
@@ -30,7 +31,7 @@ public function init()
3031 [$ this ->resolver , 'handleTypeResolveEvent ' ]
3132 );
3233 $ this ->dispatcher ->addListener (
33- CompleterFactory ::CUSTOM_COMPLETER ,
34+ CompleteEngine ::CUSTOM_COMPLETER ,
3435 [$ this , 'handleCompleteEvent ' ]
3536 );
3637 }
@@ -39,7 +40,14 @@ public function handleCompleteEvent($e)
3940 {
4041 $ context = $ e ->context ;
4142 if ($ context ->isMethodCall ()) {
42- $ e ->completer = $ this ->completer ;
43+ list ($ type , $ isThis , $ types , $ workingNode ) = $ context ->getData ();
44+ $ fqcn = array_pop ($ types );
45+ if ($ fqcn instanceof FQCN
46+ && $ fqcn ->toString () === 'DI \\Container '
47+ && $ workingNode ->name === 'get '
48+ ) {
49+ $ e ->completer = $ this ->completer ;
50+ }
4351 }
4452 }
4553
You can’t perform that action at this time.
0 commit comments