Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PhpStorm: {Model} and HasTimestamps define the same property timestamps (Laravel)

PhpStorm version 2020.3 shows an error on $timestamps property in my Laravel model:

{Model} and HasTimestamps define the same property timestamps

enter image description here

like image 736
Clerk Zhang Avatar asked Dec 05 '20 03:12

Clerk Zhang


3 Answers

This is a bug and it's introduced in the new version of PhpStorm.

It's not possible to disable the warning since it's an annotator inspection. I also don't recommend changing your code for the sole purpose of fixing this warning since it's an IDE bug and will be addressed in their next patch. If it's not really causing any breaking side effects, just wait until the patch is released!


Update

This bug has been fixed in PhpStorm 2020.3.1.

like image 124
hatef Avatar answered Nov 08 '22 05:11

hatef


It seems like a PHPStorm bug.

If it bothers you, you can change public $timestamps = false; to

public function usesTimestamps() : bool{
    return false;
}
like image 10
Alberto Garcia Avatar answered Nov 08 '22 05:11

Alberto Garcia


This is a PhpStorm bug, I fixed with define as property on class phpdoc.

Like this:

Php storm bug fix

Also you can update your PhpStorm.

like image 2
Ömer Kamçılı Avatar answered Nov 08 '22 06:11

Ömer Kamçılı