PHP 7.1原则代理问题,类型为空

PHP 7.1原则代理问题,类型为空,php,doctrine,php-7.1,Php,Doctrine,Php 7.1,我正在使用php7.1的新功能,该功能允许在项目Symfony 3上返回可为null的类型,但在实体中使用该功能时,我遇到了一个问题: <?php // .... public function getCreatedBy(): ?string { return $this->createdBy; } 我查看了使用Symfony自动创建的类的代码,发现: <?php // ... public function getCreatedBy(): string {

我正在使用php7.1的新功能,该功能允许在项目Symfony 3上返回可为null的类型,但在实体中使用该功能时,我遇到了一个问题:

<?php
// ....
public function getCreatedBy(): ?string
{
    return $this->createdBy;
}
我查看了使用Symfony自动创建的类的代码,发现:

<?php
// ...
public function getCreatedBy(): string
{

    $this->__initializer__ && $this->__initializer__->__invoke($this, 'getCreatedBy', []);

    return parent::getCreatedBy();
}

我通过将条令/条令公共库从2.6版升级到2.8版解决了问题

您清除了缓存吗?是的,我清除了缓存这是条令相关问题,而不是Symfony本身。是的,我通过将条令/条令公共库升级到2.8版解决了问题
<?php
// ...
public function getCreatedBy(): string
{

    $this->__initializer__ && $this->__initializer__->__invoke($this, 'getCreatedBy', []);

    return parent::getCreatedBy();
}