Weird problems with typehinting / autocomplete

Hi,

I'm using phpstorm 2016.2 and recently I got this really weird behaviour in most of my projects. For some reason almost all autocomplete / typehinting (or generated phpdocs) will link to one or more semi random classes. The ones occuring most seem to be the Symfony Domcrawler.

As you can see in the attached screenshot, I have an object called `$domain` which obviously is a `Mockery::mock` object (and it's phpdoc is correct), but for some weird reason phpstorm thinks it's something completely different, unless I do another explicit `/** @var Mock $domain */` line above the definition.

This behaviour is really driving me nuts :(

 

1
12 comments
Avatar
Permanently deleted user

And for the record, the first object type it tries to autocomplete in this example does not even exist in this project, it's an object from a completely different project.

Also "invalidate caches/restart" does not help.

0

Any chance to share the project so we could try to reproduce?

0
Avatar
Permanently deleted user

No, it's proprietary code, but I think I solved this now by installing the PHP toolkit plugin. 

0

Ok, thanks for the update. Let us know if the issue reoccurs.

0
Avatar
Permanently deleted user

Will do. Thnx.

0

Exactly the same problem here, also proprietary code. Today, even regular completion doesn't work anymore (shows random methods on a class) and in some cases, red scribbled errors lines occur where PhpStorm laments that an argument is of the wrong type (where is not). I will try the suggestion of installing the PHP toolkit plugin.

0

Is PHP Toolkit actually PHP Toolbox ? I can't find toolkit. After installeing PHP Toolbox, autocomplete works again.

0
Avatar
Permanently deleted user

It is the PHP Toolbox, my mistake. And that did seem to fix all autocomplete problems.

0

Not exactly all in my case, if you are editing a class that implements \Serializable and you type serialize inside the serialize class method and press Tab or Enter to accept the expected `serialize()` suggestion, it completes into `$this->serialize`, while that is not what you wanted. 

0

btw, I suppect that one of the plugin might be causing the trouble with the autocomplete. What about the Symfony plugin? This might be needed to reproduce the issue. 

0
Avatar
Permanently deleted user

I think so as well. I only found out about the toolbox by reading the contents of the symfony plugin. And as I use symfony a lot I also have that enabled.

Currently everything is up and running again so I won't be starting a wild goose chase here to find out which plugin causes the problem.  The symfony plugin would be my first guess though.

0

Latest EAP build includes several fixes that should address the issue. You can get it from https://confluence.jetbrains.com/display/PhpStorm/PhpStorm+Early+Access+Program and check if it helps

0

Please sign in to leave a comment.