Skip to content

Commit

Permalink
fix: ignore phpstan errors due to inferring wrong
Browse files Browse the repository at this point in the history
  • Loading branch information
iBotPeaches committed Dec 25, 2021
1 parent f455b67 commit 1e25a5d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app/Models/ServiceRecord.php
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ public function getHydratedMedalsAttribute(): Collection
$medal['count'] = $medals[$medal->id] ?? 0;
return $medal;
})->reject(function (Medal $medal) {
// @phpstan-ignore-next-line
return $medal->count === 0;
})->sortByDesc('count')->chunk(5);
}
Expand Down Expand Up @@ -217,7 +218,7 @@ public static function fromHaloDotApi(array $payload): ?self
return [
$medal['id'] => $medal['count']
];
});
})->toArray();

// If we get no time played or score. We are going to assume account is private.
if ($serviceRecord->total_seconds_played === 0 && $serviceRecord->total_score === 0) {
Expand Down
1 change: 1 addition & 0 deletions database/factories/ServiceRecordFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ public function withMedals(): self
$medals = Medal::factory()->count(2)->create();

return [
// @phpstan-ignore-next-line
'medals' => $medals->mapWithKeys(function (Medal $medal) {
return [
$medal->id => $this->faker->numberBetween(1, 25)
Expand Down

0 comments on commit 1e25a5d

Please sign in to comment.