在我的域模型中,有一个属性month
,它是ObjectStorage
元素的bill
。这是域模型的外观:
/**
* establishment
*
* @var ObjectStorage<Bill>
* @TYPO3\CMS\Extbase\Annotation\ORM\Cascade("remove")
*/
protected ObjectStorage $month;
public function __construct()
{
$this->setMonth(new ObjectStorage());
}
这是二传手:
/**
* month setter
*
* @param ObjectStorage<Bill> $month
* @return void
*/
public function setMonth(ObjectStorage $month) : void
{
$this->month = $month;
}
phpstan
严重地显示以下错误:
参数#1 $方法VIC \ Ext \ Domain \ Model \ StorageRoom :: setMonth()的建立需要iterable&TYPO3 \ CMS \ Extbase \ Persistence \ ObjectStorage,
给出TYPO3 \ CMS \ Extbase \ Persistence \ ObjectStorage。
有什么想法吗?
答案 0 :(得分:0)
如何为 phpstan 构建构造:
/** * establishment * * @var ObjectStorage<Bill> * @TYPO3\CMS\Extbase\Annotation\ORM\Cascade("remove") */ protected $month; public function __construct() { /** @var ObjectStorage<Bill> $objectStorageBill */ $objectStorageBill = new ObjectStorage(); $this->setMonth($objectStorageBill); }