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 :(
Please sign in to leave a comment.
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.
Any chance to share the project so we could try to reproduce?
No, it's proprietary code, but I think I solved this now by installing the PHP toolkit plugin.
Ok, thanks for the update. Let us know if the issue reoccurs.
Will do. Thnx.
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.
Is PHP Toolkit actually PHP Toolbox ? I can't find toolkit. After installeing PHP Toolbox, autocomplete works again.
It is the PHP Toolbox, my mistake. And that did seem to fix all autocomplete problems.
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.
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.
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.
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