Peekmo / atom-autocomplete-php

Autocomplete for PHP in atom editor
MIT License
136 stars 34 forks source link

Bugfix - Fixed relative class names in docblocks not being treated entirely correctly. #130

Closed ghost closed 9 years ago

ghost commented 9 years ago

Hello

This fixes an issue where class names in docblocks such as Foo\Bar, if they were relative, would not be detected correctly. This was because getCompleteNamespace assumed that if a class name contained multiple slashes, it must be absolute. It turned out this was a little more tricky to fix than it seemed at first sight as there are the following cases:

This pull request does the following things to AutocompleteProvider::execute:

For an example, see also testParentImports in my test repository [1].

Feedback is appreciated.

[1] https://github.com/hotoiledgoblinsack/php-autocomplete-test/blob/17f181a4ec2474680c118fc8f7b5536f2270edeb/src/TestNamespace/SomeClass.php#L218