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 270345

Summary: Wrong autocomplete on property named "type"
Product: php Reporter: Alex27
Component: PHPDocAssignee: issues@php <issues>
Status: NEW ---    
Severity: normal    
Priority: P3    
Version: 8.2   
Hardware: PC   
OS: Windows 7 x64   
Issue Type: DEFECT Exception Reporter:
Attachments: IDE log

Description Alex27 2017-04-10 12:24:12 UTC
Created attachment 164063 [details]
IDE log

When property of some class is named "type" its type is detected incorrectly.
It seems that property with name "type" is always considered being of
type it belongs to.

Example 1 (magic property "type"):

/**
 * @property ClassB $type
 */
class ClassA
{
	public $aProp;
}

class ClassB
{
	public $bProp;
}

$aObject = new ClassA;
$aObject->type->; //suggestions here do not include ClassA properties (instead of ClassB)


Example 2 (simple property "type"):

class ClassA
{
	public $aProp;
	
	/**
	 *
	 * @var ClassB
	 */
	public $type;
}

class ClassB
{
	public $bProp;
}

$aObject = new ClassA;
$aObject->type-> //suggestions here do not include ClassA properties (instead of ClassB)
Comment 1 Alex27 2017-04-10 12:31:13 UTC
Excuse me, I made a mistake in the comment:
//suggestions here do not include ClassA properties (instead of ClassB)

I meant:
//suggestions here include ClassA properties (instead of ClassB)