From ff245397d5a107cf478e27e343bf34e73546d320 Mon Sep 17 00:00:00 2001 From: Philipp Lang Date: Tue, 19 Sep 2023 20:14:52 +0200 Subject: [PATCH] Lint --- app/Subactivity.php | 12 +++++++++++ database/factories/SubactivityFactory.php | 2 +- phpstan.neon | 25 ----------------------- tests/Feature/Member/StoreTest.php | 3 +++ tests/Lib/MergesAttributes.php | 9 +++++++- 5 files changed, 24 insertions(+), 27 deletions(-) diff --git a/app/Subactivity.php b/app/Subactivity.php index 78aea4ec..37952f8e 100644 --- a/app/Subactivity.php +++ b/app/Subactivity.php @@ -14,15 +14,27 @@ class Subactivity extends Model use HasNamiField; use Sluggable; + /** + * @var array + */ public $fillable = ['is_age_group', 'is_filterable', 'slug', 'name', 'nami_id']; + /** + * @var bool + */ public $timestamps = false; + /** + * @var array + */ public $casts = [ 'is_age_group' => 'boolean', 'is_filterable' => 'boolean', ]; + /** + * @return array + */ public function sluggable(): array { return [ diff --git a/database/factories/SubactivityFactory.php b/database/factories/SubactivityFactory.php index 5074d989..4cd12c58 100644 --- a/database/factories/SubactivityFactory.php +++ b/database/factories/SubactivityFactory.php @@ -34,7 +34,7 @@ class SubactivityFactory extends Factory /** * Define the model's default state. * - * @return array + * @return array */ public function definition() { diff --git a/phpstan.neon b/phpstan.neon index 87f3eeda..879129b8 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -163,11 +163,6 @@ parameters: count: 1 path: app/Providers/AuthServiceProvider.php - - - message: "#^Method App\\\\Subactivity\\:\\:sluggable\\(\\) return type has no value type specified in iterable type array\\.$#" - count: 1 - path: app/Subactivity.php - - message: "#^Method Database\\\\Factories\\\\ActivityFactory\\:\\:definition\\(\\) return type has no value type specified in iterable type array\\.$#" count: 1 @@ -198,32 +193,12 @@ parameters: count: 1 path: database/factories/Payment/StatusFactory.php - - - message: "#^Method Database\\\\Factories\\\\SubactivityFactory\\:\\:definition\\(\\) return type has no value type specified in iterable type array\\.$#" - count: 1 - path: database/factories/SubactivityFactory.php - - message: "#^Call to an undefined method Phake\\\\Proxies\\\\StubberProxy.*#" - message: "#^Call to an undefined method Phake\\\\Proxies\\\\VerifierProxy.*#" - - - message: "#^Method Tests\\\\Feature\\\\Member\\\\StoreTest\\:\\:attributes\\(\\) has parameter \\$overwrites with no value type specified in iterable type array\\.$#" - count: 1 - path: tests/Feature/Member/StoreTest.php - - - - message: "#^Method Tests\\\\Feature\\\\Member\\\\StoreTest\\:\\:attributes\\(\\) return type has no value type specified in iterable type array\\.$#" - count: 1 - path: tests/Feature/Member/StoreTest.php - - - - message: "#^Method Tests\\\\Feature\\\\Member\\\\StoreTest\\:\\:defaults\\(\\) return type has no value type specified in iterable type array\\.$#" - count: 1 - path: tests/Feature/Member/StoreTest.php - - message: "#^PHPDoc tag @param has invalid value \\(\\ \\$class\\)\\: Unexpected token \"\\<\", expected type at offset 18$#" count: 1 diff --git a/tests/Feature/Member/StoreTest.php b/tests/Feature/Member/StoreTest.php index 17eb5194..485e8b33 100644 --- a/tests/Feature/Member/StoreTest.php +++ b/tests/Feature/Member/StoreTest.php @@ -211,6 +211,9 @@ class StoreTest extends TestCase ->assertSessionHasErrors(['subscription_id' => 'Beitragsart ist erforderlich.']); } + /** + * @return array + */ public function defaults(): array { $country = Country::factory()->create(); diff --git a/tests/Lib/MergesAttributes.php b/tests/Lib/MergesAttributes.php index d36b9540..b9a3d490 100644 --- a/tests/Lib/MergesAttributes.php +++ b/tests/Lib/MergesAttributes.php @@ -4,8 +4,15 @@ namespace Tests\Lib; trait MergesAttributes { - abstract public function defaults(); + /** + * @return array + */ + abstract public function defaults(): array; + /** + * @param array $overwrites + * @return array + */ public function attributes(?array $overwrites = []): array { $defaults = collect($this->defaults());