Skip to content

Commit 16d7fd4

Browse files
committed
Working my way through stan errors
1 parent 14afa42 commit 16d7fd4

File tree

13 files changed

+127
-33
lines changed

13 files changed

+127
-33
lines changed

app/Models/User.php

+5
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace App\Models;
44

5+
use ArtisanBuild\Hallway\Members\Traits\HasHallwayMembership;
56
use ArtisanBuild\Till\Traits\Tillable;
67
use ArtisanBuild\Verbstream\Traits\HasProfilePhoto;
78
use ArtisanBuild\Verbstream\Traits\HasTeams;
@@ -70,12 +71,16 @@
7071
* @method static Builder<static>|User whereTwoFactorSecret($value)
7172
* @method static Builder<static>|User whereUpdatedAt($value)
7273
*
74+
* @property-read Collection<int, \ArtisanBuild\Hallway\Members\Models\Member> $hallway_members
75+
* @property-read int|null $hallway_members_count
76+
*
7377
* @mixin Eloquent
7478
*/
7579
class User extends Authenticatable implements MustVerifyEmail
7680
{
7781
use HasApiTokens;
7882
use HasFactory;
83+
use HasHallwayMembership;
7984
use HasProfilePhoto;
8085
use HasTeams;
8186
use Notifiable;

composer.lock

+85-6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/adverbs/src/Models/Dummy.php

+14-11
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@
77
use ArtisanBuild\Adverbs\States\DummyState;
88
use ArtisanBuild\Adverbs\Traits\GetsRowsFromVerbsStates;
99
use ArtisanBuild\Adverbs\Traits\HasVerbsState;
10+
use Eloquent;
11+
use Illuminate\Database\Eloquent\Builder;
1012
use Illuminate\Database\Eloquent\Model;
13+
use Thunk\Verbs\State;
1114

1215
/**
1316
* @property string|null $name
@@ -16,26 +19,26 @@
1619
* @property int|null $id
1720
* @property string|null $last_event_id
1821
*
19-
* @method static \Illuminate\Database\Eloquent\Builder<static>|Dummy newModelQuery()
20-
* @method static \Illuminate\Database\Eloquent\Builder<static>|Dummy newQuery()
21-
* @method static \Illuminate\Database\Eloquent\Builder<static>|Dummy query()
22-
* @method static \Illuminate\Database\Eloquent\Builder<static>|Dummy whereDescription($value)
23-
* @method static \Illuminate\Database\Eloquent\Builder<static>|Dummy whereId($value)
24-
* @method static \Illuminate\Database\Eloquent\Builder<static>|Dummy whereLastEventId($value)
25-
* @method static \Illuminate\Database\Eloquent\Builder<static>|Dummy whereMetadata($value)
26-
* @method static \Illuminate\Database\Eloquent\Builder<static>|Dummy whereName($value)
22+
* @method static Builder<static>|Dummy newModelQuery()
23+
* @method static Builder<static>|Dummy newQuery()
24+
* @method static Builder<static>|Dummy query()
25+
* @method static Builder<static>|Dummy whereDescription($value)
26+
* @method static Builder<static>|Dummy whereId($value)
27+
* @method static Builder<static>|Dummy whereLastEventId($value)
28+
* @method static Builder<static>|Dummy whereMetadata($value)
29+
* @method static Builder<static>|Dummy whereName($value)
2730
*
28-
* @mixin \Eloquent
31+
* @mixin Eloquent
2932
*/
3033
class Dummy extends Model
3134
{
3235
use GetsRowsFromVerbsStates;
3336
use HasVerbsState;
3437

35-
public string $stateClass = DummyState::class;
38+
public string $state_class = DummyState::class;
3639

3740
protected function getStateClass(): string
3841
{
39-
return \Thunk\Verbs\State::class;
42+
return State::class;
4043
}
4144
}

packages/adverbs/src/Traits/HasVerbsState.php

+7-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,13 @@ trait HasVerbsState
1212
/**
1313
* Get the state class for this model.
1414
*/
15-
abstract protected function getStateClass(): string;
15+
protected function getVerbsState(): string
16+
{
17+
$state = $this->state_class;
18+
throw_if(! class_exists($state), 'Unknown class '.$this->verbs_state);
19+
20+
return $state;
21+
}
1622

1723
/**
1824
* @throws Throwable

packages/hallway-core/src/Calendar/Models/Gathering.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class Gathering extends Model
2222

2323
protected $appends = ['day', 'month'];
2424

25-
protected string $stateClass = GatheringState::class;
25+
protected string $state_class = GatheringState::class;
2626

2727
public function day(): Attribute
2828
{

packages/hallway-core/src/ChannelMembership/Models/ChannelMembership.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,5 @@ class ChannelMembership extends Model
1616
use GetsRowsFromVerbsStates;
1717
use HasVerbsState;
1818

19-
protected string $stateClass = ChannelMembershipState::class;
19+
protected string $state_class = ChannelMembershipState::class;
2020
}

packages/hallway-core/src/Members/Middleware/GetCurrentActiveMemberFromSession.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public function handle($request, Closure $next)
4747
private function guest(): State
4848
{
4949
return Cache::rememberForever('guest_state', function () {
50-
$id = MemberRoles::Guest->data(MemberRoles::Guest, 'id');
50+
$id = MemberRoles::Guest->data('id');
5151
$guest = Member::find($id);
5252

5353
if ($guest instanceof Member) {

packages/hallway-core/src/Members/States/MemberState.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,10 @@ public function can(Event|string $event)
9898
return true;
9999
}
100100

101-
if (Mirror::reflect($event)->reflection_class->hasProperty('needs_channel_permissions')) {
101+
if (Mirror::driver('Ed')->reflect($event)->reflection_class->hasProperty('needs_channel_permissions')) {
102102

103103
$channel_permission = is_string($event)
104-
? Mirror::reflect($event)->property('needs_channel_permissions')->reflection_property->getDefaultValue()
104+
? Mirror::driver('Ed')->reflect($event)->property('needs_channel_permissions')->reflection_property->getDefaultValue()
105105
/** @phpstan-ignore-next-line */
106106
: $event->needs_channel_permissions;
107107

packages/hallway-core/src/Messages/Models/Message.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@ class Message extends Model
1414
use GetsRowsFromVerbsStates;
1515
use HasVerbsState;
1616

17-
protected $stateClass = MessageState::class;
17+
protected string $state_class = MessageState::class;
1818
}

packages/hallway-core/src/Pages/Models/Page.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@ class Page extends Model
1414
use GetsRowsFromVerbsStates;
1515
use HasVerbsState;
1616

17-
protected string $stateClass = PageState::class;
17+
protected string $state_class = PageState::class;
1818
}

packages/hallway-core/src/Seeders/ChannelsSeeder.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ public function run(): void
1818
foreach (ChannelsFixture::cases() as $case) {
1919
CommunityChannelCreated::commit(
2020
channel_id: $case->value,
21-
name: $case->data($case, 'name'),
22-
description: $case->data($case, 'description'),
23-
type: $case->data($case, 'type'),
21+
name: $case->data('name'),
22+
description: $case->data('description'),
23+
type: $case->data('type'),
2424
);
2525
}
2626
}

packages/hallway-core/src/Seeders/GatheringsSeeder.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ public function run(): void
1818
foreach (GatheringsFixture::cases() as $case) {
1919
GatheringCreated::commit(
2020
gathering_id: $case->value,
21-
title: $case->data($case, 'title'),
22-
description: $case->data($case, 'description'),
23-
start: now()->addDays((int) $case->data($case, 'start')),
24-
end: now()->addDays((int) $case->data($case, 'end')),
25-
invitation_level: $case->data($case, 'invitation_level'),
21+
title: $case->data('title'),
22+
description: $case->data('description'),
23+
start: now()->addDays((int) $case->data('start')),
24+
end: now()->addDays((int) $case->data('end')),
25+
invitation_level: $case->data('invitation_level'),
2626
);
2727
}
2828
}

packages/hallway-flux/composer.json

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
"livewire/flux": "*",
2121
"livewire/flux-pro": "*",
2222
"illuminate/contracts": "^11.0",
23+
"spatie/livewire-filepond": "*",
2324
"spatie/php-structure-discoverer": "*"
2425
},
2526
"require-dev": {

0 commit comments

Comments
 (0)