From c95467a62a3e69da66bb5e1e6b217a04a0eaf884 Mon Sep 17 00:00:00 2001 From: Chris Mellor Date: Sat, 22 Jun 2024 18:32:55 +0100 Subject: [PATCH 1/2] fix: Wrap logic in intval --- src/Concerns/HasStreaks.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Concerns/HasStreaks.php b/src/Concerns/HasStreaks.php index 0b3fea9..5ecab6f 100644 --- a/src/Concerns/HasStreaks.php +++ b/src/Concerns/HasStreaks.php @@ -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)) { From 2ef8b180520c88e373dd1ce061a241f1fefae092 Mon Sep 17 00:00:00 2001 From: cjmellor Date: Sat, 22 Jun 2024 17:37:18 +0000 Subject: [PATCH 2/2] fix: Files linted with Pint --- src/Events/AchievementAwarded.php | 3 +-- src/Events/AchievementProgressionIncreased.php | 3 +-- src/Events/PointsDecreased.php | 3 +-- src/Events/PointsIncreased.php | 3 +-- src/Events/StreakBroken.php | 3 +-- src/Events/StreakFrozen.php | 3 +-- src/Events/StreakIncreased.php | 3 +-- src/Events/StreakStarted.php | 3 +-- src/Events/StreakUnfroze.php | 4 +--- src/Events/UserLevelledUp.php | 3 +-- src/Providers/MultiplierServiceProvider.php | 4 +--- src/Services/MultiplierService.php | 3 +-- 12 files changed, 12 insertions(+), 26 deletions(-) diff --git a/src/Events/AchievementAwarded.php b/src/Events/AchievementAwarded.php index 4573f49..24838e5 100644 --- a/src/Events/AchievementAwarded.php +++ b/src/Events/AchievementAwarded.php @@ -13,6 +13,5 @@ class AchievementAwarded public function __construct( public Achievement $achievement, public Model $user, - ) { - } + ) {} } diff --git a/src/Events/AchievementProgressionIncreased.php b/src/Events/AchievementProgressionIncreased.php index 9aeac24..3219049 100644 --- a/src/Events/AchievementProgressionIncreased.php +++ b/src/Events/AchievementProgressionIncreased.php @@ -14,6 +14,5 @@ public function __construct( public Achievement $achievement, public Model $user, public int $amount, - ) { - } + ) {} } diff --git a/src/Events/PointsDecreased.php b/src/Events/PointsDecreased.php index 64ffe38..d044375 100644 --- a/src/Events/PointsDecreased.php +++ b/src/Events/PointsDecreased.php @@ -14,6 +14,5 @@ public function __construct( public int $totalPoints, public ?string $reason, public Model $user, - ) { - } + ) {} } diff --git a/src/Events/PointsIncreased.php b/src/Events/PointsIncreased.php index a6f5c28..b5753a4 100644 --- a/src/Events/PointsIncreased.php +++ b/src/Events/PointsIncreased.php @@ -15,6 +15,5 @@ public function __construct( public string $type, public ?string $reason, public Model $user, - ) { - } + ) {} } diff --git a/src/Events/StreakBroken.php b/src/Events/StreakBroken.php index f4e19c6..7ba5a5d 100644 --- a/src/Events/StreakBroken.php +++ b/src/Events/StreakBroken.php @@ -15,6 +15,5 @@ public function __construct( public Model $user, public Activity $activity, public Streak $streak, - ) { - } + ) {} } diff --git a/src/Events/StreakFrozen.php b/src/Events/StreakFrozen.php index aa22cc5..974a6ec 100644 --- a/src/Events/StreakFrozen.php +++ b/src/Events/StreakFrozen.php @@ -9,6 +9,5 @@ class StreakFrozen public function __construct( public int $frozenStreakLength, public Carbon $frozenUntil, - ) { - } + ) {} } diff --git a/src/Events/StreakIncreased.php b/src/Events/StreakIncreased.php index 8a424ca..c4303cd 100644 --- a/src/Events/StreakIncreased.php +++ b/src/Events/StreakIncreased.php @@ -15,6 +15,5 @@ public function __construct( public Model $user, public Activity $activity, public Streak $streak, - ) { - } + ) {} } diff --git a/src/Events/StreakStarted.php b/src/Events/StreakStarted.php index 2484cb1..64116ba 100644 --- a/src/Events/StreakStarted.php +++ b/src/Events/StreakStarted.php @@ -15,6 +15,5 @@ public function __construct( public Model $user, public Activity $activity, public Streak $streak, - ) { - } + ) {} } diff --git a/src/Events/StreakUnfroze.php b/src/Events/StreakUnfroze.php index e5a531b..9e4fb2f 100644 --- a/src/Events/StreakUnfroze.php +++ b/src/Events/StreakUnfroze.php @@ -4,7 +4,5 @@ class StreakUnfroze { - public function __construct() - { - } + public function __construct() {} } diff --git a/src/Events/UserLevelledUp.php b/src/Events/UserLevelledUp.php index 5b36678..c4ae63b 100644 --- a/src/Events/UserLevelledUp.php +++ b/src/Events/UserLevelledUp.php @@ -12,6 +12,5 @@ class UserLevelledUp public function __construct( public Model $user, public int $level - ) { - } + ) {} } diff --git a/src/Providers/MultiplierServiceProvider.php b/src/Providers/MultiplierServiceProvider.php index 7888ca8..e3a9ead 100644 --- a/src/Providers/MultiplierServiceProvider.php +++ b/src/Providers/MultiplierServiceProvider.php @@ -24,7 +24,5 @@ public function register(): void ); } - public function boot(): void - { - } + public function boot(): void {} } diff --git a/src/Services/MultiplierService.php b/src/Services/MultiplierService.php index 414123f..84c6be6 100644 --- a/src/Services/MultiplierService.php +++ b/src/Services/MultiplierService.php @@ -9,8 +9,7 @@ class MultiplierService public function __construct( private readonly Collection $multipliers, private readonly array $data = [], - ) { - } + ) {} public function __invoke(int $points): int {