Skip to content

Commit fef3895

Browse files
Remove legacy User model (#3443)
This PR completes our longstanding effort to migrate the User model fully to Eloquent.
1 parent 72160e5 commit fef3895

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
@@ -11403,60 +11403,6 @@ parameters:
1140311403
count: 2
1140411404
path: app/cdash/app/Model/SubProjectGroup.php
1140511405

11406-
-
11407-
rawMessage: '''
11408-
Access to property $Email 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: property.deprecatedClass
11412-
count: 2
11413-
path: app/cdash/app/Model/Subscriber.php
11414-
11415-
-
11416-
rawMessage: '''
11417-
Access to property $Id 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: property.deprecatedClass
11421-
count: 2
11422-
path: app/cdash/app/Model/Subscriber.php
11423-
11424-
-
11425-
rawMessage: '''
11426-
Call to method AddLabel() 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: method.deprecatedClass
11430-
count: 1
11431-
path: app/cdash/app/Model/Subscriber.php
11432-
11433-
-
11434-
rawMessage: '''
11435-
Call to method GetLabelCollection() of deprecated class CDash\Model\User:
11436-
04/22/2025 Used only in the legacy notification system. Use Eloquent for new work.
11437-
'''
11438-
identifier: method.deprecatedClass
11439-
count: 1
11440-
path: app/cdash/app/Model/Subscriber.php
11441-
11442-
-
11443-
rawMessage: '''
11444-
Call to method __construct() of deprecated class CDash\Model\User:
11445-
04/22/2025 Used only in the legacy notification system. Use Eloquent for new work.
11446-
'''
11447-
identifier: method.deprecatedClass
11448-
count: 1
11449-
path: app/cdash/app/Model/Subscriber.php
11450-
11451-
-
11452-
rawMessage: '''
11453-
Instantiation of deprecated class CDash\Model\User:
11454-
04/22/2025 Used only in the legacy notification system. Use Eloquent for new work.
11455-
'''
11456-
identifier: new.deprecatedClass
11457-
count: 1
11458-
path: app/cdash/app/Model/Subscriber.php
11459-
1146011406
-
1146111407
rawMessage: 'Loose comparison via "==" is not allowed.'
1146211408
identifier: equal.notAllowed
@@ -11494,38 +11440,32 @@ parameters:
1149411440
path: app/cdash/app/Model/Subscriber.php
1149511441

1149611442
-
11497-
rawMessage: 'Only booleans are allowed in a ternary operator condition, CDash\Model\User|null given.'
11498-
identifier: ternary.condNotBoolean
11443+
rawMessage: 'Parameter #1 $build of method CDash\Messaging\Topic\Topic::addBuild() expects CDash\Model\Build, mixed given.'
11444+
identifier: argument.type
1149911445
count: 1
1150011446
path: app/cdash/app/Model/Subscriber.php
1150111447

1150211448
-
11503-
rawMessage: 'Parameter #1 $build of method CDash\Messaging\Topic\Topic::addBuild() expects CDash\Model\Build, mixed given.'
11449+
rawMessage: 'Parameter #1 $build of method CDash\Messaging\Topic\TopicInterface::subscribesToBuild() expects CDash\Model\Build, mixed given.'
1150411450
identifier: argument.type
1150511451
count: 1
1150611452
path: app/cdash/app/Model/Subscriber.php
1150711453

1150811454
-
11509-
rawMessage: 'Parameter #1 $build of method CDash\Messaging\Topic\TopicInterface::subscribesToBuild() expects CDash\Model\Build, mixed given.'
11510-
identifier: argument.type
11455+
rawMessage: Property CDash\Model\Subscriber::$Email has no type specified.
11456+
identifier: missingType.property
1151111457
count: 1
1151211458
path: app/cdash/app/Model/Subscriber.php
1151311459

1151411460
-
11515-
rawMessage: '''
11516-
Parameter $user of method CDash\Model\Subscriber::__construct() has typehint with deprecated class CDash\Model\User:
11517-
04/22/2025 Used only in the legacy notification system. Use Eloquent for new work.
11518-
'''
11519-
identifier: parameter.deprecatedClass
11461+
rawMessage: 'Property CDash\Model\Subscriber::$LabelCollection with generic class Illuminate\Support\Collection does not specify its types: TKey, TValue'
11462+
identifier: missingType.generics
1152011463
count: 1
1152111464
path: app/cdash/app/Model/Subscriber.php
1152211465

1152311466
-
11524-
rawMessage: '''
11525-
Property $user references deprecated class CDash\Model\User in its type:
11526-
04/22/2025 Used only in the legacy notification system. Use Eloquent for new work.
11527-
'''
11528-
identifier: property.deprecatedClass
11467+
rawMessage: Property CDash\Model\Subscriber::$UserId has no type specified.
11468+
identifier: missingType.property
1152911469
count: 1
1153011470
path: app/cdash/app/Model/Subscriber.php
1153111471

@@ -11547,30 +11487,6 @@ parameters:
1154711487
count: 1
1154811488
path: app/cdash/app/Model/SubscriberInterface.php
1154911489

11550-
-
11551-
rawMessage: 'Method CDash\Model\User::GetLabelCollection() return type with generic class Illuminate\Support\Collection does not specify its types: TKey, TValue'
11552-
identifier: missingType.generics
11553-
count: 1
11554-
path: app/cdash/app/Model/User.php
11555-
11556-
-
11557-
rawMessage: Property CDash\Model\User::$Email has no type specified.
11558-
identifier: missingType.property
11559-
count: 1
11560-
path: app/cdash/app/Model/User.php
11561-
11562-
-
11563-
rawMessage: Property CDash\Model\User::$Id has no type specified.
11564-
identifier: missingType.property
11565-
count: 1
11566-
path: app/cdash/app/Model/User.php
11567-
11568-
-
11569-
rawMessage: 'Property CDash\Model\User::$LabelCollection with generic class Illuminate\Support\Collection does not specify its types: TKey, TValue'
11570-
identifier: missingType.generics
11571-
count: 1
11572-
path: app/cdash/app/Model/User.php
11573-
1157411490
-
1157511491
rawMessage: Cannot access property $Revision on CDash\Model\BuildUpdate|null.
1157611492
identifier: property.nonObject

0 commit comments

Comments
 (0)