diff --git a/.docker/base.Dockerfile b/.docker/base.Dockerfile index 9b9f4a74..140f45a1 100644 --- a/.docker/base.Dockerfile +++ b/.docker/base.Dockerfile @@ -1,4 +1,4 @@ -FROM php:8.1.6-fpm as php +FROM php:8.3.11-fpm as php WORKDIR /app RUN ls /app RUN apt-get update diff --git a/app/Activity.php b/app/Activity.php index 61218012..cca7090a 100644 --- a/app/Activity.php +++ b/app/Activity.php @@ -4,12 +4,14 @@ namespace App; use App\Nami\HasNamiField; use Cviebrock\EloquentSluggable\Sluggable; +use Database\Factories\ActivityFactory; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\BelongsToMany; class Activity extends Model { + /** @use HasFactory */ use HasFactory; use HasNamiField; use Sluggable; diff --git a/app/Confession.php b/app/Confession.php index 8cf1259d..5b4d3f28 100644 --- a/app/Confession.php +++ b/app/Confession.php @@ -2,11 +2,13 @@ namespace App; +use Database\Factories\ConfessionFactory; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; class Confession extends Model { + /** @use HasFactory */ use HasFactory; public $fillable = ['name', 'nami_id', 'is_null']; diff --git a/app/Contribution/Documents/BdkjHesse.php b/app/Contribution/Documents/BdkjHesse.php index 5f813733..c835b53d 100644 --- a/app/Contribution/Documents/BdkjHesse.php +++ b/app/Contribution/Documents/BdkjHesse.php @@ -74,7 +74,7 @@ class BdkjHesse extends ContributionDocument public function durationDays(): int { - return Carbon::parse($this->dateUntil)->diffInDays(Carbon::parse($this->dateFrom)) + 1; + return intVal(Carbon::parse($this->dateUntil)->diffInDays(Carbon::parse($this->dateFrom))) + 1; } /** diff --git a/app/Country.php b/app/Country.php index 99703da4..334f9e15 100644 --- a/app/Country.php +++ b/app/Country.php @@ -3,11 +3,13 @@ namespace App; use App\Nami\HasNamiField; +use Database\Factories\CountryFactory; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; class Country extends Model { + /** @use HasFactory */ use HasFactory; use HasNamiField; diff --git a/app/Course/Models/Course.php b/app/Course/Models/Course.php index e8f825b9..c2d69db0 100644 --- a/app/Course/Models/Course.php +++ b/app/Course/Models/Course.php @@ -3,11 +3,13 @@ namespace App\Course\Models; use App\Nami\HasNamiField; +use Database\Factories\Course\Models\CourseFactory; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; class Course extends Model { + /** @use HasFactory */ use HasFactory; use HasNamiField; diff --git a/app/Course/Models/CourseMember.php b/app/Course/Models/CourseMember.php index 7116371c..260ac56e 100644 --- a/app/Course/Models/CourseMember.php +++ b/app/Course/Models/CourseMember.php @@ -3,12 +3,14 @@ namespace App\Course\Models; use App\Member\Member; +use Database\Factories\Course\Models\CourseMemberFactory; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\BelongsTo; class CourseMember extends Model { + /** @use HasFactory */ use HasFactory; /** @var array */ diff --git a/app/Fee.php b/app/Fee.php index c42dc928..ef8151eb 100644 --- a/app/Fee.php +++ b/app/Fee.php @@ -4,12 +4,14 @@ namespace App; use App\Nami\HasNamiField; use App\Payment\Subscription; +use Database\Factories\FeeFactory; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\HasMany; class Fee extends Model { + /** @use HasFactory */ use HasFactory; use HasNamiField; diff --git a/app/Fileshare/Models/Fileshare.php b/app/Fileshare/Models/Fileshare.php index e659e67f..d8346e1e 100644 --- a/app/Fileshare/Models/Fileshare.php +++ b/app/Fileshare/Models/Fileshare.php @@ -3,11 +3,13 @@ namespace App\Fileshare\Models; use App\Fileshare\ConnectionTypes\ConnectionType; +use Database\Factories\Fileshare\Models\FileshareFactory; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; class Fileshare extends Model { + /** @use HasFactory */ use HasFactory; public $guarded = []; diff --git a/app/Form/Casts/CollectionCast.php b/app/Form/Casts/CollectionCast.php index 0118d0e6..22175760 100644 --- a/app/Form/Casts/CollectionCast.php +++ b/app/Form/Casts/CollectionCast.php @@ -21,7 +21,6 @@ class CollectionCast implements Cast /** * @param array> $value - * @param array $context * @return Collection */ public function cast(DataProperty $property, mixed $value, array $properties, CreationContext $context): mixed diff --git a/app/Form/Casts/FieldCollectionCast.php b/app/Form/Casts/FieldCollectionCast.php index ddcf5d54..5ba7dd71 100644 --- a/app/Form/Casts/FieldCollectionCast.php +++ b/app/Form/Casts/FieldCollectionCast.php @@ -12,7 +12,6 @@ class FieldCollectionCast implements Cast { /** * @param array> $value - * @param array $context * @return FieldCollection */ public function cast(DataProperty $property, mixed $value, array $properties, CreationContext $context): mixed diff --git a/app/Form/Models/Form.php b/app/Form/Models/Form.php index 52abfa64..06eac492 100644 --- a/app/Form/Models/Form.php +++ b/app/Form/Models/Form.php @@ -8,6 +8,7 @@ use App\Form\Data\FormConfigData; use App\Lib\Editor\Condition; use App\Lib\Editor\EditorData; use Cviebrock\EloquentSluggable\Sluggable; +use Database\Factories\Form\Models\FormFactory; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\HasMany; @@ -22,6 +23,7 @@ use Zoomyboy\MedialibraryHelper\DefersUploads; /** @todo replace editor content with EditorData cast */ class Form extends Model implements HasMedia { + /** @use HasFactory */ use HasFactory; use Sluggable; use InteractsWithMedia; diff --git a/app/Form/Models/Formtemplate.php b/app/Form/Models/Formtemplate.php index 86ab2cf1..56fcb2b9 100644 --- a/app/Form/Models/Formtemplate.php +++ b/app/Form/Models/Formtemplate.php @@ -4,6 +4,7 @@ namespace App\Form\Models; use App\Form\Data\FormConfigData; use App\Lib\Editor\EditorData; +use Database\Factories\Form\Models\FormtemplateFactory; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; @@ -12,6 +13,7 @@ use Illuminate\Database\Eloquent\Model; */ class Formtemplate extends Model { + /** @use HasFactory */ use HasFactory; public $guarded = []; diff --git a/app/Form/Models/Participant.php b/app/Form/Models/Participant.php index a1974425..5e8c0ce5 100644 --- a/app/Form/Models/Participant.php +++ b/app/Form/Models/Participant.php @@ -8,6 +8,7 @@ use App\Form\Mails\ConfirmRegistrationMail; use App\Form\Scopes\ParticipantFilterScope; use App\Member\Member; use App\Prevention\Contracts\Preventable; +use Database\Factories\Form\Models\ParticipantFactory; use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; @@ -18,6 +19,8 @@ use stdClass; class Participant extends Model implements Preventable { + + /** @use HasFactory */ use HasFactory; public $guarded = []; diff --git a/app/Gender.php b/app/Gender.php index 54da643d..883657fb 100644 --- a/app/Gender.php +++ b/app/Gender.php @@ -3,12 +3,15 @@ namespace App; use App\Nami\HasNamiField; +use Database\Factories\GenderFactory; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; class Gender extends Model { use HasNamiField; + + /** @use HasFactory */ use HasFactory; public $fillable = ['name', 'nami_id']; diff --git a/app/Group.php b/app/Group.php index 3f18bf52..0d737322 100644 --- a/app/Group.php +++ b/app/Group.php @@ -5,6 +5,7 @@ namespace App; use App\Fileshare\Data\FileshareResourceData; use App\Group\Enums\Level; use App\Nami\HasNamiField; +use Database\Factories\GroupFactory; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\BelongsTo; @@ -12,6 +13,7 @@ use Illuminate\Database\Eloquent\Relations\HasMany; class Group extends Model { + /** @use HasFactory */ use HasFactory; use HasNamiField; @@ -24,11 +26,11 @@ class Group extends Model ]; /** - * @return BelongsTo + * @return BelongsTo */ public function parent(): BelongsTo { - return $this->belongsTo(static::class, 'parent_id'); + return $this->belongsTo(self::class, 'parent_id'); } /** @@ -36,7 +38,7 @@ class Group extends Model */ public function children(): HasMany { - return $this->hasMany(static::class, 'parent_id'); + return $this->hasMany(self::class, 'parent_id'); } public static function booted(): void diff --git a/app/Invoice/Models/Invoice.php b/app/Invoice/Models/Invoice.php index f70e4696..0ae41b96 100644 --- a/app/Invoice/Models/Invoice.php +++ b/app/Invoice/Models/Invoice.php @@ -11,6 +11,7 @@ use App\Invoice\RememberDocument; use App\Invoice\Scopes\InvoiceFilterScope; use App\Member\Member; use App\Payment\Subscription; +use Database\Factories\Invoice\Models\InvoiceFactory; use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Collection; use Illuminate\Database\Eloquent\Factories\HasFactory; @@ -20,6 +21,7 @@ use stdClass; class Invoice extends Model { + /** @use HasFactory */ use HasFactory; public $guarded = []; diff --git a/app/Invoice/Models/InvoicePosition.php b/app/Invoice/Models/InvoicePosition.php index 9592f80b..43d2d2ca 100644 --- a/app/Invoice/Models/InvoicePosition.php +++ b/app/Invoice/Models/InvoicePosition.php @@ -3,12 +3,14 @@ namespace App\Invoice\Models; use App\Member\Member; +use Database\Factories\Invoice\Models\InvoicePositionFactory; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\BelongsTo; class InvoicePosition extends Model { + /** @use HasFactory */ use HasFactory; public $guarded = []; diff --git a/app/Lib/ScoutFilter.php b/app/Lib/ScoutFilter.php index 693b9969..ba8b602e 100644 --- a/app/Lib/ScoutFilter.php +++ b/app/Lib/ScoutFilter.php @@ -14,9 +14,11 @@ abstract class ScoutFilter extends Data { /** - * @return Builder + * @return Builder */ abstract public function getQuery(): Builder; + + /** @var Builder */ protected Builder $query; /** diff --git a/app/Maildispatcher/Models/Localmaildispatcher.php b/app/Maildispatcher/Models/Localmaildispatcher.php index 476bb574..2de038e2 100644 --- a/app/Maildispatcher/Models/Localmaildispatcher.php +++ b/app/Maildispatcher/Models/Localmaildispatcher.php @@ -8,7 +8,6 @@ use Illuminate\Database\Eloquent\Model; class Localmaildispatcher extends Model { - use HasFactory; use HasUuids; public $guarded = []; diff --git a/app/Maildispatcher/Models/Maildispatcher.php b/app/Maildispatcher/Models/Maildispatcher.php index bab4f14d..3cdf717f 100644 --- a/app/Maildispatcher/Models/Maildispatcher.php +++ b/app/Maildispatcher/Models/Maildispatcher.php @@ -3,6 +3,7 @@ namespace App\Maildispatcher\Models; use App\Mailgateway\Models\Mailgateway; +use Database\Factories\Maildispatcher\Models\MaildispatcherFactory; use Illuminate\Database\Eloquent\Concerns\HasUuids; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; @@ -10,6 +11,7 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo; class Maildispatcher extends Model { + /** @use HasFactory */ use HasFactory; use HasUuids; diff --git a/app/Mailgateway/Models/Mailgateway.php b/app/Mailgateway/Models/Mailgateway.php index 7b01ebec..5f9a5aa1 100644 --- a/app/Mailgateway/Models/Mailgateway.php +++ b/app/Mailgateway/Models/Mailgateway.php @@ -3,12 +3,14 @@ namespace App\Mailgateway\Models; use App\Mailgateway\Casts\TypeCast; +use Database\Factories\Mailgateway\Models\MailgatewayFactory; use Illuminate\Database\Eloquent\Concerns\HasUuids; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; class Mailgateway extends Model { + /** @use HasFactory */ use HasFactory; use HasUuids; diff --git a/app/Member/Member.php b/app/Member/Member.php index 91e4b076..3437595e 100644 --- a/app/Member/Member.php +++ b/app/Member/Member.php @@ -33,6 +33,7 @@ use Zoomyboy\Osm\Geolocatable; use Zoomyboy\Osm\HasGeolocation; use Zoomyboy\Phone\HasPhoneNumbers; use App\Prevention\Enums\Prevention; +use Database\Factories\Member\MemberFactory; /** * @property string $subscription_name @@ -42,6 +43,7 @@ class Member extends Model implements Geolocatable { use Notifiable; use HasNamiField; + /** @use HasFactory */ use HasFactory; use Sluggable; use Searchable; @@ -182,7 +184,7 @@ class Member extends Model implements Geolocatable public function getAge(): ?int { - return $this->birthday?->diffInYears(now()); + return $this->birthday ? intval($this->birthday->diffInYears(now())) : null; } protected function getAusstand(): int @@ -406,14 +408,14 @@ class Member extends Model implements Geolocatable return $query->where('group_id', $group->id); } - public static function fromVcard(string $url, string $data): static + public static function fromVcard(string $url, string $data): self { $settings = app(NamiSettings::class); $card = Reader::read($data); [$lastname, $firstname] = $card->N->getParts(); [$deprecated1, $deprecated2, $address, $location, $region, $zip, $country] = $card->ADR->getParts(); - return new static([ + return new self([ 'joined_at' => now(), 'send_newspaper' => false, 'firstname' => $firstname, diff --git a/app/Member/Membership.php b/app/Member/Membership.php index 621eaebf..f9325129 100644 --- a/app/Member/Membership.php +++ b/app/Member/Membership.php @@ -6,6 +6,7 @@ use App\Activity; use App\Group; use App\Nami\HasNamiField; use App\Subactivity; +use Database\Factories\Member\MembershipFactory; use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; @@ -16,6 +17,7 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo; */ class Membership extends Model { + /** @use HasFactory */ use HasFactory; use HasNamiField; diff --git a/app/Membership/TestersBlock.php b/app/Membership/TestersBlock.php index 49cf7f25..83267fdf 100644 --- a/app/Membership/TestersBlock.php +++ b/app/Membership/TestersBlock.php @@ -13,8 +13,8 @@ class TestersBlock extends Block */ public function query(): Builder { - return Member::whereHas('memberships', fn ($q) => $q->isTrying()) - ->with('memberships', fn ($q) => $q->isTrying()); + return Member::with('memberships', fn ($q) => $q->isTrying()) + ->whereHas('memberships', fn ($q) => $q->isTrying()); } /** diff --git a/app/Nationality.php b/app/Nationality.php index 2e00dde2..e434801f 100644 --- a/app/Nationality.php +++ b/app/Nationality.php @@ -3,11 +3,13 @@ namespace App; use App\Nami\HasNamiField; +use Database\Factories\NationalityFactory; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; class Nationality extends Model { + /** @use HasFactory */ use HasFactory; use HasNamiField; diff --git a/app/Payment/Subscription.php b/app/Payment/Subscription.php index abe7cf21..438a6083 100644 --- a/app/Payment/Subscription.php +++ b/app/Payment/Subscription.php @@ -3,6 +3,7 @@ namespace App\Payment; use App\Fee; +use Database\Factories\Payment\SubscriptionFactory; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\BelongsTo; @@ -10,6 +11,7 @@ use Illuminate\Database\Eloquent\Relations\HasMany; class Subscription extends Model { + /** @use HasFactory */ use HasFactory; /** diff --git a/app/Payment/SubscriptionChild.php b/app/Payment/SubscriptionChild.php index 4792ede9..3dbb4def 100644 --- a/app/Payment/SubscriptionChild.php +++ b/app/Payment/SubscriptionChild.php @@ -2,12 +2,14 @@ namespace App\Payment; +use Database\Factories\Payment\SubscriptionChildFactory; use Illuminate\Database\Eloquent\Concerns\HasUuids; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; class SubscriptionChild extends Model { + /** @use HasFactory */ use HasFactory; use HasUuids; diff --git a/app/Region.php b/app/Region.php index b505c45b..f776b834 100644 --- a/app/Region.php +++ b/app/Region.php @@ -2,12 +2,14 @@ namespace App; +use Database\Factories\RegionFactory; use Illuminate\Support\Collection; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; class Region extends Model { + /** @use HasFactory */ use HasFactory; public $timestamps = false; diff --git a/app/Subactivity.php b/app/Subactivity.php index 37952f8e..02a4c2f5 100644 --- a/app/Subactivity.php +++ b/app/Subactivity.php @@ -4,12 +4,14 @@ namespace App; use App\Nami\HasNamiField; use Cviebrock\EloquentSluggable\Sluggable; +use Database\Factories\UserFactory; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\BelongsToMany; class Subactivity extends Model { + /** @use HasFactory */ use HasFactory; use HasNamiField; use Sluggable; diff --git a/app/User.php b/app/User.php index bb1bdc3c..5376e63d 100644 --- a/app/User.php +++ b/app/User.php @@ -3,12 +3,14 @@ namespace App; use App\Auth\ResetPassword; +use Database\Factories\UserFactory; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Foundation\Auth\User as Authenticatable; use Illuminate\Notifications\Notifiable; class User extends Authenticatable { + /** @use HasFactory */ use HasFactory; use Notifiable; diff --git a/packages/laravel-nami b/packages/laravel-nami index 3f5321af..bc61530e 160000 --- a/packages/laravel-nami +++ b/packages/laravel-nami @@ -1 +1 @@ -Subproject commit 3f5321af9d6d48e1e50d6041548abfb74e594de0 +Subproject commit bc61530e510b3d41048984b7cf20b6d82c4f85fb diff --git a/phpstan.neon b/phpstan.neon index 61308345..c8185965 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -28,6 +28,11 @@ parameters: AddressBookCard: 'array{lastmodified: int, etag: string, uri: string, id: int, size: int}' 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 @@ -58,11 +63,6 @@ parameters: count: 1 path: app/Member/Member.php - - - message: "#^Unsafe usage of new static\\(\\)\\.$#" - count: 1 - path: app/Member/Member.php - - message: "#^Method App\\\\Member\\\\MemberRequest\\:\\:rules\\(\\) return type has no value type specified in iterable type array\\.$#" count: 1 @@ -393,16 +393,6 @@ parameters: count: 1 path: tests/Feature/Member/DavTest.php - - - message: "#^Access to an undefined property Illuminate\\\\Database\\\\Eloquent\\\\Model\\:\\:\\$email\\.$#" - count: 2 - path: app/Maildispatcher/Actions/ResyncAction.php - - - - message: "#^Access to an undefined property Illuminate\\\\Database\\\\Eloquent\\\\Model\\:\\:\\$email_parents\\.$#" - count: 2 - path: app/Maildispatcher/Actions/ResyncAction.php - - message: "#^Unable to resolve the template type TKey in call to function collect$#" count: 2