From b33072ad202c3f5ada6d138a4db426e8ba4ad389 Mon Sep 17 00:00:00 2001
From: philipp lang <philipp@aweos.de>
Date: Sun, 30 Mar 2025 04:29:27 +0200
Subject: [PATCH] Lint

---
 app/Activity.php                              |  2 +-
 app/Course/Models/CourseMember.php            |  4 +--
 app/Fee.php                                   |  2 +-
 app/Form/Models/Form.php                      |  2 +-
 app/Form/Models/Participant.php               |  6 ++---
 app/Group.php                                 |  4 +--
 app/Invoice/Models/Invoice.php                |  2 +-
 app/Invoice/Models/InvoicePosition.php        |  4 +--
 app/Maildispatcher/Models/Maildispatcher.php  |  2 +-
 app/Member/BankAccount.php                    |  3 ++-
 app/Member/Member.php                         | 26 +++++++++----------
 app/Member/Membership.php                     |  8 +++---
 app/Payment/Subscription.php                  |  4 +--
 app/Subactivity.php                           |  2 +-
 .../factories/Member/BankAccountFactory.php   |  2 +-
 phpstan.neon                                  |  3 ---
 16 files changed, 37 insertions(+), 39 deletions(-)

diff --git a/app/Activity.php b/app/Activity.php
index cca7090a..b971d2f9 100644
--- a/app/Activity.php
+++ b/app/Activity.php
@@ -34,7 +34,7 @@ class Activity extends Model
     }
 
     /**
-     * @return BelongsToMany<Subactivity>
+     * @return BelongsToMany<Subactivity, $this>
      */
     public function subactivities(): BelongsToMany
     {
diff --git a/app/Course/Models/CourseMember.php b/app/Course/Models/CourseMember.php
index 260ac56e..ba0ea2fa 100644
--- a/app/Course/Models/CourseMember.php
+++ b/app/Course/Models/CourseMember.php
@@ -17,7 +17,7 @@ class CourseMember extends Model
     public $guarded = [];
 
     /**
-     * @return BelongsTo<Course, self>
+     * @return BelongsTo<Course, $this>
      */
     public function course(): BelongsTo
     {
@@ -25,7 +25,7 @@ class CourseMember extends Model
     }
 
     /**
-     * @return BelongsTo<Member, self>
+     * @return BelongsTo<Member, $this>
      */
     public function member(): BelongsTo
     {
diff --git a/app/Fee.php b/app/Fee.php
index ef8151eb..c1eb9050 100644
--- a/app/Fee.php
+++ b/app/Fee.php
@@ -22,7 +22,7 @@ class Fee extends Model
     public $timestamps = false;
 
     /**
-     * @return HasMany<Subscription>
+     * @return HasMany<Subscription, $this>
      */
     public function subscriptions(): HasMany
     {
diff --git a/app/Form/Models/Form.php b/app/Form/Models/Form.php
index 45e372c4..ca2681b5 100644
--- a/app/Form/Models/Form.php
+++ b/app/Form/Models/Form.php
@@ -62,7 +62,7 @@ class Form extends Model implements HasMedia
     }
 
     /**
-     * @return HasMany<Participant>
+     * @return HasMany<Participant, $this>
      */
     public function participants(): HasMany
     {
diff --git a/app/Form/Models/Participant.php b/app/Form/Models/Participant.php
index 1c863539..b34fc4e9 100644
--- a/app/Form/Models/Participant.php
+++ b/app/Form/Models/Participant.php
@@ -33,7 +33,7 @@ class Participant extends Model implements Preventable
     ];
 
     /**
-     * @return BelongsTo<Form, self>
+     * @return BelongsTo<Form, $this>
      */
     public function form(): BelongsTo
     {
@@ -41,7 +41,7 @@ class Participant extends Model implements Preventable
     }
 
     /**
-     * @return HasMany<self>
+     * @return HasMany<Participant, $this>
      */
     public function children(): HasMany
     {
@@ -49,7 +49,7 @@ class Participant extends Model implements Preventable
     }
 
     /**
-     * @return BelongsTo<Member, self>
+     * @return BelongsTo<Member, $this>
      */
     public function member(): BelongsTo
     {
diff --git a/app/Group.php b/app/Group.php
index 0d737322..f4a70263 100644
--- a/app/Group.php
+++ b/app/Group.php
@@ -26,7 +26,7 @@ class Group extends Model
     ];
 
     /**
-     * @return BelongsTo<self, self>
+     * @return BelongsTo<Group, $this>
      */
     public function parent(): BelongsTo
     {
@@ -34,7 +34,7 @@ class Group extends Model
     }
 
     /**
-     * @return HasMany<self>
+     * @return HasMany<Group, $this>
      */
     public function children(): HasMany
     {
diff --git a/app/Invoice/Models/Invoice.php b/app/Invoice/Models/Invoice.php
index e409021b..b5896511 100644
--- a/app/Invoice/Models/Invoice.php
+++ b/app/Invoice/Models/Invoice.php
@@ -37,7 +37,7 @@ class Invoice extends Model
     ];
 
     /**
-     * @return HasMany<InvoicePosition>
+     * @return HasMany<InvoicePosition, $this>
      */
     public function positions(): HasMany
     {
diff --git a/app/Invoice/Models/InvoicePosition.php b/app/Invoice/Models/InvoicePosition.php
index 43d2d2ca..91485df0 100644
--- a/app/Invoice/Models/InvoicePosition.php
+++ b/app/Invoice/Models/InvoicePosition.php
@@ -16,7 +16,7 @@ class InvoicePosition extends Model
     public $guarded = [];
 
     /**
-     * @return BelongsTo<Member, self>
+     * @return BelongsTo<Member, $this>
      */
     public function member(): BelongsTo
     {
@@ -24,7 +24,7 @@ class InvoicePosition extends Model
     }
 
     /**
-     * @return BelongsTo<Invoice, self>
+     * @return BelongsTo<Invoice, $this>
      */
     public function invoice(): BelongsTo
     {
diff --git a/app/Maildispatcher/Models/Maildispatcher.php b/app/Maildispatcher/Models/Maildispatcher.php
index 3cdf717f..dc8eaf35 100644
--- a/app/Maildispatcher/Models/Maildispatcher.php
+++ b/app/Maildispatcher/Models/Maildispatcher.php
@@ -23,7 +23,7 @@ class Maildispatcher extends Model
     ];
 
     /**
-     * @return BelongsTo<Mailgateway, self>
+     * @return BelongsTo<Mailgateway, $this>
      */
     public function gateway(): BelongsTo
     {
diff --git a/app/Member/BankAccount.php b/app/Member/BankAccount.php
index 2af3341b..7e700992 100644
--- a/app/Member/BankAccount.php
+++ b/app/Member/BankAccount.php
@@ -2,12 +2,13 @@
 
 namespace App\Member;
 
+use Database\Factories\Member\BankAccountFactory;
 use Illuminate\Database\Eloquent\Factories\HasFactory;
 use Illuminate\Database\Eloquent\Model;
 
 class BankAccount extends Model
 {
-    /** @use HasFactory<\Database\Factories\\App\Member\BankAccountFactory> */
+    /** @use HasFactory<BankAccountFactory> */
     use HasFactory;
 
     public $guarded = [];
diff --git a/app/Member/Member.php b/app/Member/Member.php
index 105e31da..0fa866df 100644
--- a/app/Member/Member.php
+++ b/app/Member/Member.php
@@ -196,7 +196,7 @@ class Member extends Model implements Geolocatable
 
     // ---------------------------------- Relations ----------------------------------
     /**
-     * @return BelongsTo<Country, self>
+     * @return BelongsTo<Country, $this>
      */
     public function country(): BelongsTo
     {
@@ -204,7 +204,7 @@ class Member extends Model implements Geolocatable
     }
 
     /**
-     * @return BelongsTo<Gender, self>
+     * @return BelongsTo<Gender, $this>
      */
     public function gender(): BelongsTo
     {
@@ -212,7 +212,7 @@ class Member extends Model implements Geolocatable
     }
 
     /**
-     * @return BelongsTo<Region, self>
+     * @return BelongsTo<Region, $this>
      */
     public function region(): BelongsTo
     {
@@ -223,7 +223,7 @@ class Member extends Model implements Geolocatable
     }
 
     /**
-     * @return HasMany<InvoicePosition>
+     * @return HasMany<InvoicePosition, $this>
      */
     public function invoicePositions(): HasMany
     {
@@ -231,7 +231,7 @@ class Member extends Model implements Geolocatable
     }
 
     /**
-     * @return BelongsTo<Confession, self>
+     * @return BelongsTo<Confession, $this>
      */
     public function confession(): BelongsTo
     {
@@ -239,7 +239,7 @@ class Member extends Model implements Geolocatable
     }
 
     /**
-     * @return BelongsTo<Nationality, self>
+     * @return BelongsTo<Nationality, $this>
      */
     public function nationality(): BelongsTo
     {
@@ -247,7 +247,7 @@ class Member extends Model implements Geolocatable
     }
 
     /**
-     * @return BelongsTo<Subscription, self>
+     * @return BelongsTo<Subscription, $this>
      */
     public function subscription(): BelongsTo
     {
@@ -255,7 +255,7 @@ class Member extends Model implements Geolocatable
     }
 
     /**
-     * @return BelongsTo<Group, self>
+     * @return BelongsTo<Group, $this>
      */
     public function group(): BelongsTo
     {
@@ -263,7 +263,7 @@ class Member extends Model implements Geolocatable
     }
 
     /**
-     * @return HasMany<CourseMember>
+     * @return HasMany<CourseMember, $this>
      */
     public function courses(): HasMany
     {
@@ -271,7 +271,7 @@ class Member extends Model implements Geolocatable
     }
 
     /**
-     * @return HasMany<Membership>
+     * @return HasMany<Membership, $this>
      */
     public function memberships(): HasMany
     {
@@ -279,7 +279,7 @@ class Member extends Model implements Geolocatable
     }
 
     /**
-     * @return HasMany<Membership>
+     * @return HasMany<Membership, $this>
      */
     public function leaderMemberships(): HasMany
     {
@@ -287,7 +287,7 @@ class Member extends Model implements Geolocatable
     }
 
     /**
-     * @return HasMany<Membership>
+     * @return HasMany<Membership, $this>
      */
     public function ageGroupMemberships(): HasMany
     {
@@ -295,7 +295,7 @@ class Member extends Model implements Geolocatable
     }
 
     /**
-     * @return HasOne<BankAccount>
+     * @return HasOne<BankAccount, $this>
      */
     public function bankAccount(): HasOne
     {
diff --git a/app/Member/Membership.php b/app/Member/Membership.php
index f9325129..8d4fc9fe 100644
--- a/app/Member/Membership.php
+++ b/app/Member/Membership.php
@@ -32,7 +32,7 @@ class Membership extends Model
     ];
 
     /**
-     * @return BelongsTo<Activity, self>
+     * @return BelongsTo<Activity, $this>
      */
     public function activity(): BelongsTo
     {
@@ -40,7 +40,7 @@ class Membership extends Model
     }
 
     /**
-     * @return BelongsTo<Group, self>
+     * @return BelongsTo<Group, $this>
      */
     public function group(): BelongsTo
     {
@@ -48,7 +48,7 @@ class Membership extends Model
     }
 
     /**
-     * @return BelongsTo<Subactivity, self>
+     * @return BelongsTo<Subactivity, $this>
      */
     public function subactivity(): BelongsTo
     {
@@ -56,7 +56,7 @@ class Membership extends Model
     }
 
     /**
-     * @return BelongsTo<Member, self>
+     * @return BelongsTo<Member, $this>
      */
     public function member(): BelongsTo
     {
diff --git a/app/Payment/Subscription.php b/app/Payment/Subscription.php
index 438a6083..bd1e60d1 100644
--- a/app/Payment/Subscription.php
+++ b/app/Payment/Subscription.php
@@ -25,7 +25,7 @@ class Subscription extends Model
     }
 
     /**
-     * @return BelongsTo<Fee, self>
+     * @return BelongsTo<Fee, $this>
      */
     public function fee(): BelongsTo
     {
@@ -33,7 +33,7 @@ class Subscription extends Model
     }
 
     /**
-     * @return HasMany<SubscriptionChild>
+     * @return HasMany<SubscriptionChild, $this>
      */
     public function children(): HasMany
     {
diff --git a/app/Subactivity.php b/app/Subactivity.php
index 02a4c2f5..0bac483b 100644
--- a/app/Subactivity.php
+++ b/app/Subactivity.php
@@ -47,7 +47,7 @@ class Subactivity extends Model
     }
 
     /**
-     * @return BelongsToMany<Activity>
+     * @return BelongsToMany<Activity, $this>
      */
     public function activities(): BelongsToMany
     {
diff --git a/database/factories/Member/BankAccountFactory.php b/database/factories/Member/BankAccountFactory.php
index 34dcdfd2..a9dc6ae7 100644
--- a/database/factories/Member/BankAccountFactory.php
+++ b/database/factories/Member/BankAccountFactory.php
@@ -1,6 +1,6 @@
 <?php
 
-namespace Database\Factories;
+namespace Database\Factories\Member;
 
 use App\Member\BankAccount;
 use Illuminate\Database\Eloquent\Factories\Factory;
diff --git a/phpstan.neon b/phpstan.neon
index fed30009..978ea5b7 100644
--- a/phpstan.neon
+++ b/phpstan.neon
@@ -30,9 +30,6 @@ parameters:
     ignoreErrors:
         -
             message: "#but does not specify its types: TData#"
-
-        -
-            message: "#cast\\(\\) has parameter \\$properties#"
         -
             message: "#^Method App\\\\Activity\\:\\:sluggable\\(\\) return type has no value type specified in iterable type array\\.$#"
             count: 1