Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Wrap logic in intval #84

Merged
merged 2 commits into from
Jun 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/Concerns/HasStreaks.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ public function recordStreak(Activity $activity): void
return;
}

$diffInDays = $this->getStreakLastActivity($activity)
$diffInDays = intval($this->getStreakLastActivity($activity)
->activity_at
->startOfDay()
->diffInDays(now()->startOfDay());
->diffInDays(now()->startOfDay()));

// Checking to see if the streak is frozen
if ($this->getStreakLastActivity($activity)->frozen_until && now()->lessThan($this->getStreakLastActivity($activity)->frozen_until)) {
Expand Down
3 changes: 1 addition & 2 deletions src/Events/AchievementAwarded.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,5 @@ class AchievementAwarded
public function __construct(
public Achievement $achievement,
public Model $user,
) {
}
) {}
}
3 changes: 1 addition & 2 deletions src/Events/AchievementProgressionIncreased.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,5 @@ public function __construct(
public Achievement $achievement,
public Model $user,
public int $amount,
) {
}
) {}
}
3 changes: 1 addition & 2 deletions src/Events/PointsDecreased.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,5 @@ public function __construct(
public int $totalPoints,
public ?string $reason,
public Model $user,
) {
}
) {}
}
3 changes: 1 addition & 2 deletions src/Events/PointsIncreased.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,5 @@ public function __construct(
public string $type,
public ?string $reason,
public Model $user,
) {
}
) {}
}
3 changes: 1 addition & 2 deletions src/Events/StreakBroken.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,5 @@ public function __construct(
public Model $user,
public Activity $activity,
public Streak $streak,
) {
}
) {}
}
3 changes: 1 addition & 2 deletions src/Events/StreakFrozen.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,5 @@ class StreakFrozen
public function __construct(
public int $frozenStreakLength,
public Carbon $frozenUntil,
) {
}
) {}
}
3 changes: 1 addition & 2 deletions src/Events/StreakIncreased.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,5 @@ public function __construct(
public Model $user,
public Activity $activity,
public Streak $streak,
) {
}
) {}
}
3 changes: 1 addition & 2 deletions src/Events/StreakStarted.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,5 @@ public function __construct(
public Model $user,
public Activity $activity,
public Streak $streak,
) {
}
) {}
}
4 changes: 1 addition & 3 deletions src/Events/StreakUnfroze.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,5 @@

class StreakUnfroze
{
public function __construct()
{
}
public function __construct() {}
}
3 changes: 1 addition & 2 deletions src/Events/UserLevelledUp.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,5 @@ class UserLevelledUp
public function __construct(
public Model $user,
public int $level
) {
}
) {}
}
4 changes: 1 addition & 3 deletions src/Providers/MultiplierServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,5 @@ public function register(): void
);
}

public function boot(): void
{
}
public function boot(): void {}
}
3 changes: 1 addition & 2 deletions src/Services/MultiplierService.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ class MultiplierService
public function __construct(
private readonly Collection $multipliers,
private readonly array $data = [],
) {
}
) {}

public function __invoke(int $points): int
{
Expand Down