Our blog
Netbeans Autocomplete on Class Properties Using PHPDoc
If you are using netbeans for PHP classes and you have some of your class properties are instances of other objects and you want to get autocomplete working for them, then you might struggle to figure out which PHPDoc syntax to use to get autocomplete working.
Here is the answer:
-
/**
-
* @property MyObject $myObject
-
* @property AnotherObject $anotherObject
-
*/
-
class MyClass{
-
-
protected $myObject;
-
protected $anotherObject;
-
-
public function __construct($myObject, $anotherObject){
-
$this->myObject=$myObject;
-
$this->anotherObject=$anotherObject;
-
}
-
-
public function autocomplete(){
-
$this->myObject->//autocomplete works here
-
}
-
-
}
More Reading:
3 Comments
|
Or using: /** @var MyObject */ |
|
Matthew T. March 30th, 2011 |
What about classes that are more than one level deep. For instance, I use Code Igniter and there are times where you run into this. /** __construct() public function validate_something($s,$s_rule_name) |
|
[...] the right hints in your code, you can jump between classes with Ctrl+Click pretty [...] |
RSS Feed
Nox
June 8th, 2010