hve*_*ous 5 symfony doctrine-orm php-7 php-7.1
我经常遇到这个奇怪的错误
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
Run Code Online (Sandbox Code Playgroud)
为什么发生这种情况?为什么我没有
public function setName(?string $name): self
{
$this->name = $name;
return $this;
}
Run Code Online (Sandbox Code Playgroud)
作为我的二传手?如果我删除'?',它可以工作,但我确实需要它用于其他目的