I’m using Komodo IDE 10, and for the most part, it’s pretty good at drawing contextual information from the PHPDoc syntax. However, it seems to completely ignore __invoke
methods.
For example:
<?php
class Foo
{
public function Bar()
{
return "Test";
}
}
class Test
{
/**
* @return Foo
*/
public function __invoke()
{
return new Foo();
}
}
$t = new Test();
Trying to do an auto-complete on $t()->
will only yield the __invoke
method of the Test
class, which, of course, does not exist, as at that point we have a Foo
instance with the method Bar
. It’s understanding the call, or it wouldn’t try to auto-complete at all, but for some reason it assumes the call will always return the instance itself (which is a weird assumption to make, imagine if it did that for every function call).
I’ve tried adding the @return
hint to the class definition as well, but that makes no difference.
Right now, if I want auto-completion or parameter hinting, my only option is calling $t->__invoke()
explicitly. That at least works, if defeating the entire reason for using the magic method in the first place…