Komodo does not properly parse PHP's __invoke magic method

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:


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…

Hi, thanks for bringing this up. Feel free to file an enhancement request on our bug tracker: https://github.com/Komodo/KomodoEdit/issues

Cross posted there: https://github.com/Komodo/KomodoEdit/issues/2356

I suppose this can be closed now.