4

我有一个类,它是ArrayObject类的简单扩展:

/**
 * what to put here? :)
 */
class Collection extends \ArrayObject
{
    /**
     * @param Item
     */
    public function add(Item $item)
    {
        $this->append($item);
    }
}

是否可以让我的 IDE 对我的 ArrayObject 扩展类的元素使用代码完成?

foreach ($collection as $item)
{
    $item->getPrice(); //my IDE doesn't not know the object here
}
4

0 回答 0