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 268212

Summary: referenced values in foreach loop (PHP) avoid class recognition
Product: php Reporter: titum
Component: EditorAssignee: Tomas Mysik <tmysik>
Status: NEW ---    
Severity: normal    
Priority: P3    
Version: 8.1   
Hardware: PC   
OS: Windows 7   
Issue Type: DEFECT Exception Reporter:

Description titum 2016-09-26 21:38:43 UTC
In editor, for PHP file.

In a foreach loop, if the value is passed through reference with '&', the completion is not able to find the class of the object.

Example:

class Data {
	public $property='prop';
}

$tab = array(new Data(), new Data(), new Data());

foreach ($tab as $data) {
	// direct access to $data->property in auto-completion
}

foreach ($tab as &$data) {
	// unable to find the class of $data and to propose Data property
}
Comment 1 titum 2016-09-26 21:42:07 UTC
I add that in foreach loops, the value class can be found only if a comment give the information:

/* @var $tab Data[] */

but this not works when '&' is added to the value.