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 - referenced values in foreach loop (PHP) avoid class recognition
Summary: referenced values in foreach loop (PHP) avoid class recognition
Status: NEW
Alias: None
Product: php
Classification: Unclassified
Component: Editor (show other bugs)
Version: 8.1
Hardware: PC Windows 7
: P3 normal (vote)
Assignee: Tomas Mysik
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-09-26 21:38 UTC by titum
Modified: 2016-09-27 07:28 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 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.