I have found a way to say netbeans type of variable in such way:
/* @var $variablename Type */
However in this case there are no hints (Database is my class):
//model.php
abstract class Model {
/* @var $db Database */
protected $db;
(...)
}
//Mymodel.php
class MyModel extends Model {
(...)
$this->db-> //no hints
(...)
}
Is it Netbeans limit or rather my mistake?
NetBeans can make use of two similar yet different comment annotations:
Good old phpdoc block comments, that start with /**
and are placed right before the item definition:
/**
* @var Database $db Database connection instance
*/
protected $db;
Variable type inline comments, that start with /*
and are placed somewhere before the item use:
$foo = $this->db;
/* @var $foo Database*/
$foo->...
The second type comes in handy when docblock comments are either not available or not helpful, e.g. you are using a third-party library that isn't documented or your variable type cannot be tracked automatically.
You were basically using syntax for #2 in the context for #1 ;-)
First of all, define the variable type first, like this:
/* @var Database $db This is my Database object */
And secondly I would suggest to use phpdoc commenting, like:
class Model {
/**
* @var Database $db This is my Database object
*/
protected $db;
Should have no issues then...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With