Peekmo / atom-autocomplete-php

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

Enhancement - Allow autocompletion outside functions and improve support for type override annotations. #139

Closed ghost closed 9 years ago

ghost commented 9 years ago

Hello

This pull request contains the following improvements:

I also added some tests for these cases [1].

[1] https://github.com/hotoiledgoblinsack/php-autocomplete-test/blob/24664493aeb7af113994dd1e067f290977f5eb9d/src/TestNamespace/SomeClass.php#L411

Peekmo commented 9 years ago

Hello,

I'm testing it today ;)

ghost commented 9 years ago

:+1:

Peekmo commented 9 years ago
/** @var XXXX */
$x = 5;

(just before the variable assignment) seems to not work anymore. Is it wanted ?

ghost commented 9 years ago

Strange, I can't reproduce this, neither outside functions nor inside functions, I tried placing the following under function main in my test repository:

/** @var SomeClass */
$test = 5;
$test->works();

As well as the test method I linked to in the OP testVariableTypeOverrides:

/** @var FooClass */
$var1 = 'Should be a FooClass';
$var1->fooFunc();

Do you have any more information on how I could reproduce it?

Peekmo commented 9 years ago

I don't really know..

/** @var ManagerRegistry */
$user = $this->tokenStorage->getToken()->getUser();
$user->{fail}
/** @var ManagerRegistry $user */
$user = $this->tokenStorage->getToken()->getUser();
$user->{success}

(yep, the code does not have any sense, that was just an other test) I'll try it on an other project tonight

ghost commented 9 years ago

That's it, I can reproduce it using:

/** @var SomeClass */
$x = $this->a->b()->c();
$x->{fail}

I'll take a look at it as soon as possible.

ghost commented 9 years ago

Good that you spotted this bug. I pushed a fix, is the issue now solved for you as well?

Peekmo commented 9 years ago

It works, thank you :+1: