I am writing some Object Oriented PHP code in PhpStorm and I've run into a problem.
I see that you need to define these PHPDoc comments and I'm trying to do the same. QuestionList is my "active" class, the MySQLAdapter is my other class which handles the database and SQL queries.
I am trying to define the constructors $sql_adapter parameter as a MySQLAdapter so that when I hit Ctrl + Space I can see my object's available functions but without any luck.
The first time I use my connect() method the IDE will autocomplete the method name, but after I initialize my sql field as $sql_adapter the IDE won't recognize my $sql object's methods.
What is the problem, am I not using the PHPDoc currently?
/**
* @param QuestionList MySQLAdapter $sql_adapter
*/
public function __construct($sql_adapter){
$this->questions = array();
$this->sql = new MySQLAdapter();
/* autocompletes this one */
$this->sql->connect();
$this->sql = $sql_adapter;
/* won't autocomplete this one */
$this->sql->connect();
}
@param-- it is wrong - LazyOne* @param MySQLAdapter $sql_adapterand if$sql_adaptermust be of typeMySQLAdapterthen typehint it in the constructor definition - Mark Baker