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

Fix hover on namespaced function #13

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/LanguageServerHover/Handler/HoverHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ private function renderMember(SymbolContext $symbolContext): string

private function renderFunction(SymbolContext $symbolContext): string
{
$name = $symbolContext->symbol()->name();
$name = $symbolContext->name();
$function = $this->reflector->reflectFunction($name);

return $this->renderer->render(new HoverInformation($name, $function->docblock()->formatted(), $function));
Expand Down
11 changes: 9 additions & 2 deletions tests/LanguageServerCompletion/Unit/Handler/HoverHandlerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class HoverHandlerTest extends IntegrationTestCase
/**
* @dataProvider provideHover
*/
public function testHover(string $test)
public function testHover(string $test): void
{
[ $text, $offset ] = ExtractOffset::fromSource($test);

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

yield 'class' => [
'<?php cl<>ass A { } }',
'A'
];

yield 'function' => [
'<?php function foo() {} f<>oo();',
];

yield 'namespaced function' => [
'<?php namespace Barf {function foo() {}} Barf\f<>oo();',
];
}
}