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.
See That code: DataBase.php: <?php class DataBase { private $link; public function __construct($host, $username, $password, $dbName){ $this->link = mysql_connect($host, $username, $password); mysql_select_db($dbName, $this->link); } public function exec($query){ $result = mysql_query($query, $this->link); if(is_bool($result)){ return $result; }else{ $all = array(); while($all[] = mysql_fetch_array($result, MYSQL_ASSOC)){} mysql_free_result($result); return $all; } } public function close(){ mysql_close($this->link); } } ?> Model.php: <?php include 'DataBase.php'; class Model { protected $db; public function __construct(){ $this->db = new DataBase("localhost", "root", "root", "MyDB"); } } ?> IndexModel.php: <?php include 'Model.php'; class IndexModel extends Model{ function __construct() { parent::__construct(); } public function get(){ $this->db->exec("SELECT * FROM users"); } } ?> ------------------------------------------------------------------------------ Parser don't see any methods of $this->db in class 'IndexModel' that extends 'Model', test it and fix this bug. This code works fine.
Unfortunately we are not able to recognized that the $db has type Database, because is defined in constructor. You have to use phpdoc to help NetBeans to know abou the type. So write: class Model { /** * * @var DataBase */ protected $db; and it will work correctly. I'm switching this issue to the enhancement, to remember that it can be resolve typing extended to the constructors.
I have looked at issue #194300. The constructor scanning for resolving type was already implemented, but was broken. Now this case should as well. Fixed in webmain clone.