I have the following code:
class Orders{
/**
*
* @var Supplier
*/
private $suppliers; //Array of Supplier
function loopAllSuppliers(){
foreach($this->suppliers as $supplier){
$supplier->/*no suggestion*/ //Can't get the method's to show here
$this->suppliers->getSupplierName(); //methods in class Supplier show normally here
}
}
}
The problem is easy. I just want to be able to declare a type for my variable $supplier like how I did it with $suppliers.
Notes:
- Supplier is a class which has a public method getSupplierName().
- I’m using Netbeans IDE.
1 Answer