From e4e4cfa98e42708d00ba1f929bf0ae46e6616ec8 Mon Sep 17 00:00:00 2001 From: Roardom Date: Sun, 20 Oct 2024 10:52:48 +0000 Subject: [PATCH] refactor: simplify yearly overview year range generation --- app/Http/Controllers/YearlyOverviewController.php | 9 +-------- phpstan-baseline.neon | 5 ----- 2 files changed, 1 insertion(+), 13 deletions(-) diff --git a/app/Http/Controllers/YearlyOverviewController.php b/app/Http/Controllers/YearlyOverviewController.php index 25abdd2fed..9e952b5536 100644 --- a/app/Http/Controllers/YearlyOverviewController.php +++ b/app/Http/Controllers/YearlyOverviewController.php @@ -34,15 +34,8 @@ class YearlyOverviewController extends Controller */ public function index(): \Illuminate\Contracts\View\View|\Illuminate\Contracts\View\Factory { - // Site Years - $siteYears = collect(); - - for ($currentYear = (int) date('Y', strtotime('-1 year')); $currentYear >= date('Y', strtotime(config('other.birthdate'))); $currentYear--) { - $siteYears->push($currentYear); - } - return view('stats.yearly_overviews.index', [ - 'siteYears' => $siteYears, + 'siteYears' => range(now()->subYear()->year, Carbon::parse(config('other.birthdate'))->year), ]); } diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 60eb6b81a2..070a0405f0 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -415,11 +415,6 @@ parameters: count: 2 path: app/Http/Controllers/User/UserController.php - - - message: "#^Parameter \\#2 \\$timestamp of function date expects int\\|null, int\\|false given\\.$#" - count: 1 - path: app/Http/Controllers/YearlyOverviewController.php - - message: "#^Property App\\\\Http\\\\Livewire\\\\AttachmentUpload\\:\\:\\$attachment has no type specified\\.$#" count: 1