2
为什么在引入属性类型提示时突然出现“初始化前不能访问类型化属性”错误?
我已经更新了类定义,以利用新引入的属性类型提示,如下所示: class Foo { private int $id; private ?string $val; private DateTimeInterface $createdAt; private ?DateTimeInterface $updatedAt; public function __construct(int $id) { $this->id = $id; } public function getId(): int { return $this->id; } public function getVal(): ?string { return $this->val; } public function getCreatedAt(): ?DateTimeInterface { return $this->createdAt; } public …