我有以下代码:
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 } } }@H_502_2@问题很简单.我只是想能够为我的变量$供应商声明一个类型,就像我用$供应商做的那样.
笔记:
> Supplier是一个具有公共方法getSupplierName()的类.
>我正在使用Netbeans IDE.
class Orders{ /** * * @var Supplier */ private $suppliers; function loopAllSuppliers(){ foreach($this->suppliers as $supplier){ /* @var $supplier Supplier */ //Must declare the type again inside the foreach as Netbeans doesn't support // defining variable as arrays in doc blocks,yet. } } }@H_502_2@