PhpStorm:{Model}和HasTimestamps定义了相同的属性时间戳(Laravel)
PhpStorm 2020.3 版$timestamps在我的 Laravel 模型中显示属性错误:
{Model} 和 HasTimestamps 定义了相同的属性时间戳
回答
这是一个错误,它是在新版本的 PhpStorm 中引入的。
由于它是注释器检查,因此无法禁用警告。我也不建议仅仅为了修复这个警告而改变你的代码,因为它是一个 IDE 错误,将在他们的下一个补丁中解决。如果它真的没有造成任何破坏性的副作用,那就等到补丁发布吧!
更新
此错误已在 PhpStorm 2020.3.1 中修复。
- first time I manage to solve a problem by doing nothing, without spending hours looking for an answer! Thanks
回答
这似乎是一个 PHPStorm 错误。
如果它打扰您,您可以更改public $timestamps = false;为
public function usesTimestamps() : bool{
return false;
}
THE END
二维码