From bc59fd91cabe192dc8da4ed0d0866647267ed23e Mon Sep 17 00:00:00 2001 From: ErickSkrauch Date: Fri, 14 Feb 2025 16:26:14 +0100 Subject: [PATCH] Fix PHPStan errors --- .../functional/mojang/UsernameToUuidCest.php | 20 +++++++++++++------ phpstan-baseline.neon | 10 ---------- 2 files changed, 14 insertions(+), 16 deletions(-) diff --git a/api/tests/functional/mojang/UsernameToUuidCest.php b/api/tests/functional/mojang/UsernameToUuidCest.php index 99aacb7..19e76fe 100644 --- a/api/tests/functional/mojang/UsernameToUuidCest.php +++ b/api/tests/functional/mojang/UsernameToUuidCest.php @@ -4,16 +4,18 @@ namespace api\tests\functional\mojang; use api\tests\FunctionalTester; use Codeception\Example; -class UsernameToUuidCest { +final class UsernameToUuidCest { - public static function endpoints(): array { - return [ - ['/api/mojang/profiles'], - ['/api/mojang/services/minecraft/profile/lookup/name'], - ]; + /** + * @return iterable + */ + public static function endpoints(): iterable { + yield ['/api/mojang/profiles']; + yield ['/api/mojang/services/minecraft/profile/lookup/name']; } /** + * @param Example $url * @dataProvider endpoints */ public function getUuidByUsername(FunctionalTester $I, Example $url): void { @@ -28,6 +30,7 @@ class UsernameToUuidCest { } /** + * @param Example $url * @dataProvider endpoints */ public function getUuidByUsernameAtMoment(FunctionalTester $I, Example $url): void { @@ -42,6 +45,7 @@ class UsernameToUuidCest { } /** + * @param Example $url * @dataProvider endpoints */ public function getUuidByUsernameAtWrongMoment(FunctionalTester $I, Example $url): void { @@ -52,6 +56,7 @@ class UsernameToUuidCest { } /** + * @param Example $url * @dataProvider endpoints */ public function getUuidByUsernameWithoutMoment(FunctionalTester $I, Example $url): void { @@ -62,6 +67,7 @@ class UsernameToUuidCest { } /** + * @param Example $url * @dataProvider endpoints */ public function getUuidByWrongUsername(FunctionalTester $I, Example $url): void { @@ -72,6 +78,7 @@ class UsernameToUuidCest { } /** + * @param Example $url * @dataProvider endpoints */ public function getUuidForDeletedAccount(FunctionalTester $I, Example $url): void { @@ -82,6 +89,7 @@ class UsernameToUuidCest { } /** + * @param Example $url * @dataProvider endpoints */ public function nonPassedUsername(FunctionalTester $I, Example $url): void { diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 699dc44..77dcd4e 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -645,16 +645,6 @@ parameters: count: 1 path: api/tests/_pages/AuthenticationRoute.php - - - message: "#^Method api\\\\tests\\\\_pages\\\\MojangApiRoute\\:\\:usernameToUuid\\(\\) has parameter \\$at with no type specified\\.$#" - count: 1 - path: api/tests/_pages/MojangApiRoute.php - - - - message: "#^Method api\\\\tests\\\\_pages\\\\MojangApiRoute\\:\\:usernameToUuid\\(\\) has parameter \\$username with no type specified\\.$#" - count: 1 - path: api/tests/_pages/MojangApiRoute.php - - message: "#^Method api\\\\tests\\\\_pages\\\\MojangApiRoute\\:\\:usernamesByUuid\\(\\) has parameter \\$uuid with no type specified\\.$#" count: 1