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 199474 - Code Completion. Wrong propertie
Summary: Code Completion. Wrong propertie
Status: RESOLVED WORKSFORME
Alias: None
Product: php
Classification: Unclassified
Component: Editor (show other bugs)
Version: 7.1
Hardware: All All
: P3 normal with 1 vote (vote)
Assignee: Ondrej Brejla
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-06-16 19:35 UTC by RiaD
Modified: 2012-04-13 16:10 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 RiaD 2011-06-16 19:35:15 UTC
User.php
<?php
class User {
	/**
	 * @var int $id
	 */
	public $id;
	/**
	 *
	 * @var string
	 */
	public $login;
	public function __construct (stdClass $a){
		foreach($a as $k=>$v){
			$this -> $k = $v;
		}
	}
}
?>

index.php
<?php
include 'User.php';
$a = new User(new stdClass());
$a->
?>

Expected: 
int id
string login

Actual:
int id
? k
string login


When I add source of index.php to user.php works well
Comment 1 Petr Pisl 2011-06-21 15:45:44 UTC
There are two problems. 

1) When User.php file is added, the index doesn't scan method. When you switch to another file, then the lazy indexing scan methods as well, so offers also the property, that are "defined" in methods.

2) The dolared properties shouldn't be considered as fields. 

The second problem  will be easy to fix. The first issue with different content of index during editing file is really problem. If we will remove the lazy scanning, then we downgrade performance of editing, which will be very visible for bigger files.
Comment 2 Ondrej Brejla 2012-04-13 16:10:38 UTC
Works for me properly in 7.2 dev. No $k property.

Product Version: NetBeans IDE Dev (Build 20120413-edba28b83bfc)
Java: 1.6.0_26; Java HotSpot(TM) Client VM 20.1-b02
System: Linux version 3.0.0-17-generic-pae running on i386; UTF-8; cs_CZ (nb)
User directory: /home/warden/userdir
Cache directory: /home/warden/userdir/var/cache