此代码产生错误:
/**
* @var EntityManagerInterface
*/
private EntityManagerInterface $entityManager;
public function __construct(EntityManagerInterface $entityManager)
{
$this->entityManager = $entityManager;
parent::__construct();
}
我的 composer.json 使用
"php": ">=7.1.3",
我使用 Symfony 4.4,这是我工作的必要条件。
我在互联网上的某个地方发现这种类型的错误是由过时的 php 版本引起的,但我不确定在这种特定情况下是否是这种情况。我的问题是我是否可以以不同的方式编写代码,或者我唯一的选择是转到更高的 php 版本?