Skip to content
This repository was archived by the owner on Mar 6, 2022. It is now read-only.

Commit 45b9288

Browse files
committed
Fix hover on namespaced function
1 parent 3265e50 commit 45b9288

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

lib/LanguageServerHover/Handler/HoverHandler.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ private function renderMember(SymbolContext $symbolContext): string
175175

176176
private function renderFunction(SymbolContext $symbolContext): string
177177
{
178-
$name = $symbolContext->symbol()->name();
178+
$name = $symbolContext->name();
179179
$function = $this->reflector->reflectFunction($name);
180180

181181
return $this->renderer->render(new HoverInformation($name, $function->docblock()->formatted(), $function));

tests/LanguageServerCompletion/Unit/Handler/HoverHandlerTest.php

+9-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class HoverHandlerTest extends IntegrationTestCase
1616
/**
1717
* @dataProvider provideHover
1818
*/
19-
public function testHover(string $test)
19+
public function testHover(string $test): void
2020
{
2121
[ $text, $offset ] = ExtractOffset::fromSource($test);
2222

@@ -82,7 +82,14 @@ private function f<>oo():string {}
8282

8383
yield 'class' => [
8484
'<?php cl<>ass A { } }',
85-
'A'
85+
];
86+
87+
yield 'function' => [
88+
'<?php function foo() {} f<>oo();',
89+
];
90+
91+
yield 'namespaced function' => [
92+
'<?php namespace Barf {function foo() {}} Barf\f<>oo();',
8693
];
8794
}
8895
}

0 commit comments

Comments
 (0)