[Bug]:
ChrisToxz opened this issue · comments
What happened?
If there is no experience record yet and you run getPoints()
it returns the following:
App\Models\User::getPoints(): Return value must be of type int, null returned
How to reproduce the bug
try to run getPoints()
while there are no points
Package Version
1.1.0
PHP Version
8.2.14
Laravel Version
10.41
Which operating systems does with happen with?
Linux
Notes
Fix could be:
public function getPoints(): int
{
return $this->experience->experience_points ?? 0;
}
Where it will always return 0 if there are no XP points yet.
If you are fine with it I can shoot a PR including a test
Hi,
I'm open to a PR, sure.
Please make sure a Test is added alongside it.
Thanks!
Hi,
I'm open to a PR, sure.
Please make sure a Test is added alongside it.
Thanks!
Hello, I have opened a pr fixing this issue and one migration error I faced during recent installation