Skip to content

Commit b581765

Browse files
committed
Remove legacy User model
This PR completes our longstanding effort to migrate the User model fully to Eloquent.
1 parent 3350904 commit b581765

File tree

3 files changed

+19
-159
lines changed

3 files changed

+19
-159
lines changed

app/cdash/app/Model/Subscriber.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -40,20 +40,20 @@ class Subscriber implements SubscriberInterface
4040
/** @var TopicCollection */
4141
private $topics;
4242

43-
/** @var User */
44-
private $user;
43+
private $UserId;
44+
private $Email;
45+
private Collection $LabelCollection;
4546

4647
/**
4748
* Subscriber constructor.
4849
*/
4950
public function __construct(
5051
NotificationPreferences $preferences,
5152
?TopicCollection $topics = null,
52-
?User $user = null,
5353
) {
5454
$this->preferences = $preferences;
5555
$this->topics = $topics;
56-
$this->user = $user ? $user : new User();
56+
$this->LabelCollection = collect();
5757
}
5858

5959
public function hasBuildTopics(ActionableBuildInterface $submission): bool
@@ -94,24 +94,24 @@ public function getTopics(): TopicCollection
9494

9595
public function getAddress(): string
9696
{
97-
return $this->user->Email;
97+
return $this->Email;
9898
}
9999

100100
public function setAddress($address): static
101101
{
102-
$this->user->Email = $address;
102+
$this->Email = $address;
103103
return $this;
104104
}
105105

106106
public function getLabels(): Collection
107107
{
108-
return $this->user->GetLabelCollection();
108+
return $this->LabelCollection;
109109
}
110110

111111
public function setLabels(array $labels): static
112112
{
113113
foreach ($labels as $label) {
114-
$this->user->AddLabel($label);
114+
$this->LabelCollection->put($label->Text, $label);
115115
}
116116
return $this;
117117
}
@@ -123,12 +123,12 @@ public function getNotificationPreferences(): NotificationPreferences
123123

124124
public function setUserId($userId): static
125125
{
126-
$this->user->Id = $userId;
126+
$this->UserId = $userId;
127127
return $this;
128128
}
129129

130130
public function getUserId()
131131
{
132-
return $this->user->Id;
132+
return $this->UserId;
133133
}
134134
}

app/cdash/app/Model/User.php

Lines changed: 0 additions & 56 deletions
This file was deleted.

phpstan-baseline.neon

Lines changed: 9 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -11376,60 +11376,6 @@ parameters:
1137611376
count: 2
1137711377
path: app/cdash/app/Model/SubProjectGroup.php
1137811378

11379-
-
11380-
rawMessage: '''
11381-
Access to property $Email of deprecated class CDash\Model\User:
11382-
04/22/2025 Used only in the legacy notification system. Use Eloquent for new work.
11383-
'''
11384-
identifier: property.deprecatedClass
11385-
count: 2
11386-
path: app/cdash/app/Model/Subscriber.php
11387-
11388-
-
11389-
rawMessage: '''
11390-
Access to property $Id of deprecated class CDash\Model\User:
11391-
04/22/2025 Used only in the legacy notification system. Use Eloquent for new work.
11392-
'''
11393-
identifier: property.deprecatedClass
11394-
count: 2
11395-
path: app/cdash/app/Model/Subscriber.php
11396-
11397-
-
11398-
rawMessage: '''
11399-
Call to method AddLabel() of deprecated class CDash\Model\User:
11400-
04/22/2025 Used only in the legacy notification system. Use Eloquent for new work.
11401-
'''
11402-
identifier: method.deprecatedClass
11403-
count: 1
11404-
path: app/cdash/app/Model/Subscriber.php
11405-
11406-
-
11407-
rawMessage: '''
11408-
Call to method GetLabelCollection() of deprecated class CDash\Model\User:
11409-
04/22/2025 Used only in the legacy notification system. Use Eloquent for new work.
11410-
'''
11411-
identifier: method.deprecatedClass
11412-
count: 1
11413-
path: app/cdash/app/Model/Subscriber.php
11414-
11415-
-
11416-
rawMessage: '''
11417-
Call to method __construct() of deprecated class CDash\Model\User:
11418-
04/22/2025 Used only in the legacy notification system. Use Eloquent for new work.
11419-
'''
11420-
identifier: method.deprecatedClass
11421-
count: 1
11422-
path: app/cdash/app/Model/Subscriber.php
11423-
11424-
-
11425-
rawMessage: '''
11426-
Instantiation of deprecated class CDash\Model\User:
11427-
04/22/2025 Used only in the legacy notification system. Use Eloquent for new work.
11428-
'''
11429-
identifier: new.deprecatedClass
11430-
count: 1
11431-
path: app/cdash/app/Model/Subscriber.php
11432-
1143311379
-
1143411380
rawMessage: 'Loose comparison via "==" is not allowed.'
1143511381
identifier: equal.notAllowed
@@ -11467,38 +11413,32 @@ parameters:
1146711413
path: app/cdash/app/Model/Subscriber.php
1146811414

1146911415
-
11470-
rawMessage: 'Only booleans are allowed in a ternary operator condition, CDash\Model\User|null given.'
11471-
identifier: ternary.condNotBoolean
11416+
rawMessage: 'Parameter #1 $build of method CDash\Messaging\Topic\Topic::addBuild() expects CDash\Model\Build, mixed given.'
11417+
identifier: argument.type
1147211418
count: 1
1147311419
path: app/cdash/app/Model/Subscriber.php
1147411420

1147511421
-
11476-
rawMessage: 'Parameter #1 $build of method CDash\Messaging\Topic\Topic::addBuild() expects CDash\Model\Build, mixed given.'
11422+
rawMessage: 'Parameter #1 $build of method CDash\Messaging\Topic\TopicInterface::subscribesToBuild() expects CDash\Model\Build, mixed given.'
1147711423
identifier: argument.type
1147811424
count: 1
1147911425
path: app/cdash/app/Model/Subscriber.php
1148011426

1148111427
-
11482-
rawMessage: 'Parameter #1 $build of method CDash\Messaging\Topic\TopicInterface::subscribesToBuild() expects CDash\Model\Build, mixed given.'
11483-
identifier: argument.type
11428+
rawMessage: Property CDash\Model\Subscriber::$Email has no type specified.
11429+
identifier: missingType.property
1148411430
count: 1
1148511431
path: app/cdash/app/Model/Subscriber.php
1148611432

1148711433
-
11488-
rawMessage: '''
11489-
Parameter $user of method CDash\Model\Subscriber::__construct() has typehint with deprecated class CDash\Model\User:
11490-
04/22/2025 Used only in the legacy notification system. Use Eloquent for new work.
11491-
'''
11492-
identifier: parameter.deprecatedClass
11434+
rawMessage: 'Property CDash\Model\Subscriber::$LabelCollection with generic class Illuminate\Support\Collection does not specify its types: TKey, TValue'
11435+
identifier: missingType.generics
1149311436
count: 1
1149411437
path: app/cdash/app/Model/Subscriber.php
1149511438

1149611439
-
11497-
rawMessage: '''
11498-
Property $user references deprecated class CDash\Model\User in its type:
11499-
04/22/2025 Used only in the legacy notification system. Use Eloquent for new work.
11500-
'''
11501-
identifier: property.deprecatedClass
11440+
rawMessage: Property CDash\Model\Subscriber::$UserId has no type specified.
11441+
identifier: missingType.property
1150211442
count: 1
1150311443
path: app/cdash/app/Model/Subscriber.php
1150411444

@@ -11520,30 +11460,6 @@ parameters:
1152011460
count: 1
1152111461
path: app/cdash/app/Model/SubscriberInterface.php
1152211462

11523-
-
11524-
rawMessage: 'Method CDash\Model\User::GetLabelCollection() return type with generic class Illuminate\Support\Collection does not specify its types: TKey, TValue'
11525-
identifier: missingType.generics
11526-
count: 1
11527-
path: app/cdash/app/Model/User.php
11528-
11529-
-
11530-
rawMessage: Property CDash\Model\User::$Email has no type specified.
11531-
identifier: missingType.property
11532-
count: 1
11533-
path: app/cdash/app/Model/User.php
11534-
11535-
-
11536-
rawMessage: Property CDash\Model\User::$Id has no type specified.
11537-
identifier: missingType.property
11538-
count: 1
11539-
path: app/cdash/app/Model/User.php
11540-
11541-
-
11542-
rawMessage: 'Property CDash\Model\User::$LabelCollection with generic class Illuminate\Support\Collection does not specify its types: TKey, TValue'
11543-
identifier: missingType.generics
11544-
count: 1
11545-
path: app/cdash/app/Model/User.php
11546-
1154711463
-
1154811464
rawMessage: Cannot access property $Revision on CDash\Model\BuildUpdate|null.
1154911465
identifier: property.nonObject

0 commit comments

Comments
 (0)