3
的,我经常收到这种奇怪的错误主义PHP7 +类型提示,声明代理错误
Warning: Declaration of Proxies\__CG__\AppBundle\Entity\MyEntity::setName(string $name):
AppBundle\Entity\MyEntity should be compatible with AppBundle\Entity\MyEntity::setName(?string $name):
AppBundle\Entity\MyEntity
地球上
这究竟是为什么?为什么我没有
public function setName(?string $name): self
{
$this->name = $name;
return $this;
}
作为我的二传手?如果我删除'?',但我确实需要它用于其他用途
通常这可以通过清除symfony缓存来解决。你已经这样做了吗? –
您是否尝试过使用'public function setName(string $ name = null):self'? – yceruto
@TobiasXy,是的,我尝试使用symfony命令并删除缓存目录。它不利于这种情况。 – user7808407