This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 271690 - Editor does not code complete on objects returned by implicitly-called __invoke() method
Summary: Editor does not code complete on objects returned by implicitly-called __invo...
Status: NEW
Alias: None
Product: php
Classification: Unclassified
Component: Editor (show other bugs)
Version: 8.2
Hardware: PC Linux
: P3 normal (vote)
Assignee: issues@php
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-10-24 17:39 UTC by alex.howansky
Modified: 2017-10-24 17:39 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description alex.howansky 2017-10-24 17:39:38 UTC
When an class has an __invoke() magic method that returns an object instance, the returned object is code completed only when explicitly calling $obj->__invoke() and not when implicitly calling via $obj(). Consider the following code:

class Foo
{
	public function someMethod() {}
	public function otherMethod() {}
}

class Bar
{
	public function __invoke()
	{
		return new Foo();
	}
}

$bar = new Bar();

$foo1 = $bar->__invoke();
$foo1-> // this completes correctly, offering someMethod() and otherMethod()

$foo2 = $bar();
$foo2-> // this does not complete