From 7f77efde290512679f3def6c4851898d18664f60 Mon Sep 17 00:00:00 2001 From: Rico van Zelst Date: Mon, 5 May 2025 18:47:12 +0200 Subject: [PATCH] style: update code style and phpcs rules --- .phpcs.xml.dist | 197 +++++++++++++----- app/Helpers/HelperFunctions.php | 8 +- .../Controllers/StreamerPanelController.php | 3 +- 3 files changed, 149 insertions(+), 59 deletions(-) diff --git a/.phpcs.xml.dist b/.phpcs.xml.dist index 3ed86e9..7b3ca62 100644 --- a/.phpcs.xml.dist +++ b/.phpcs.xml.dist @@ -1,7 +1,134 @@ - - Heimerdinger PHP CS rules for Laravel + + + PSR-2 The Laravel conventions + + + + + + + + + + + /app/Http/Resources/*\.php + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + *.php + - + database/* + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + app + config + public + resources + routes + tests + + */.phpstorm.meta.php + */_ide_helper.php + */database/* */cache/* */*.js */*.css @@ -12,56 +139,16 @@ */docs/* */vendor/* */migrations/* + */config/* + */public/index.php + */*.blade.php + */Console/Kernel.php + */Exceptions/Handler.php + */Http/Kernel.php + */Providers/* + */resources/lang/* - - - - - - - - /public/index.php - - - - - - - - */database/* - */tests/* - - - - - - - - - - - */tests/* - - - - - - - - - - - - - - - - - - /config/* - - - - - - \ No newline at end of file + + + + diff --git a/app/Helpers/HelperFunctions.php b/app/Helpers/HelperFunctions.php index 00d8dc0..0f39042 100644 --- a/app/Helpers/HelperFunctions.php +++ b/app/Helpers/HelperFunctions.php @@ -15,7 +15,7 @@ function getRoleIcon($roleName): string 'Support' => 'gm-support.png', ]; - return asset('img/'.$roleIcons[$roleName]); + return asset('img/' . $roleIcons[$roleName]); } function getAverageColorFromImageUrl($imageUrl): string @@ -89,8 +89,10 @@ function getChampionImage($full_id, $type): string */ function getCommitHash(): string { - /** @var string $commit */ - $commit = Cache::remember('commit_hash', 60 * 72, fn () => trim(exec('git log --pretty="%h" -n1 HEAD'))); + /** + * @var string $commit + */ + $commit = Cache::remember('commit_hash', 60 * 72, fn() => trim(exec('git log --pretty="%h" -n1 HEAD'))); return $commit; } diff --git a/app/Http/Controllers/StreamerPanelController.php b/app/Http/Controllers/StreamerPanelController.php index 1d64fa8..ec576fe 100644 --- a/app/Http/Controllers/StreamerPanelController.php +++ b/app/Http/Controllers/StreamerPanelController.php @@ -34,7 +34,8 @@ class StreamerPanelController extends Controller */ public function store(Request $request) { - $request->validate(['champion_id' => 'required|exists:champions,champion_id', + $request->validate([ + 'champion_id' => 'required|exists:champions,champion_id', 'platform' => 'required|in:twitch,youtube,kick,douyu,huya', 'username' => 'required|string', 'displayname' => 'required|string',