Answer the question
In order to leave comments, you need to log in
How to tell phpDoc that a variable is just a class?
There is this code:
class app\models\Product{
public static getSomeClass($modelType){
if ($modelType=='MyClass1'){
return 'app\models\MyClass1';
} else{
return 'app\models\MyClass2';
}
}
}
class app\models\MyClass1{
public static function sayHello(){
echo 'Hello';
}
}
$instClass = Product::getSomeClass('MyClass1');
$instClass::sayHello();
Answer the question
In order to leave comments, you need to log in
/** @var MyClass1 $instClass */
$instClass = Product::getSomeClass('MyClass1');
/**
* @return MyClass1 | MyClass2
*/
public static getSomeClass($modelType){
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question