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

Summary: Code Completion. Wrong propertie
Product: php Reporter: RiaD
Component: EditorAssignee: Ondrej Brejla <obrejla>
Status: RESOLVED WORKSFORME    
Severity: normal    
Priority: P3    
Version: 7.1   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter:

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