Skip to content

Commit 7410c95

Browse files
committed
Improve code to phpstan level 8
1 parent 274c583 commit 7410c95

20 files changed

+87
-299
lines changed

phpstan.neon

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
parameters:
2-
level: 7
2+
level: 8
33
paths:
44
- src/
55
- tests/

src/Core/Image.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class Image
3232

3333
public function __construct(\SimpleXMLElement $xml)
3434
{
35-
$this->alt = $xml['alt']->__toString();
35+
$this->alt = $xml['alt'] ? $xml['alt']->__toString() : '';
3636
$this->height = (int) $xml['height'];
3737
$this->width = (int) $xml['width'];
3838
$this->url = $xml->__toString();

src/Parameters/CreateMeetingParameters.php

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,7 @@ public function setAllowStartStopRecording(bool $allowStartStopRecording): self
418418
return $this;
419419
}
420420

421-
public function getDuration(): int
421+
public function getDuration(): ?int
422422
{
423423
return $this->duration;
424424
}
@@ -572,7 +572,7 @@ public function setLearningDashboardEnabled(bool $learningDashboardEnabled): sel
572572
/**
573573
* @deprecated Removed in 2.5, temporarily still handled, please transition to disabledFeatures.
574574
*/
575-
public function isVirtualBackgroundsDisabled(): bool
575+
public function isVirtualBackgroundsDisabled(): ?bool
576576
{
577577
return $this->virtualBackgroundsDisabled;
578578
}
@@ -867,7 +867,7 @@ public function setLockSettingsLockOnJoinConfigurable(bool $lockOnJoinConfigurab
867867
return $this;
868868
}
869869

870-
public function isLockSettingsHideViewersCursor(): bool
870+
public function isLockSettingsHideViewersCursor(): ?bool
871871
{
872872
return $this->lockSettingsHideViewersCursor;
873873
}
@@ -905,7 +905,7 @@ public function setAllowModsToUnmuteUsers(bool $allowModsToUnmuteUsers): self
905905
return $this;
906906
}
907907

908-
public function isAllowModsToEjectCameras(): bool
908+
public function isAllowModsToEjectCameras(): ?bool
909909
{
910910
return $this->allowModsToEjectCameras;
911911
}
@@ -1026,7 +1026,7 @@ public function setGuestPolicy(string $guestPolicy): self
10261026
/**
10271027
* @deprecated Removed in 2.5, temporarily still handled, please transition to disabledFeatures.
10281028
*/
1029-
public function isBreakoutRoomsEnabled(): bool
1029+
public function isBreakoutRoomsEnabled(): ?bool
10301030
{
10311031
return $this->breakoutRoomsEnabled;
10321032
}
@@ -1047,7 +1047,7 @@ public function setBreakoutRoomsEnabled($breakoutRoomsEnabled): self
10471047
return $this;
10481048
}
10491049

1050-
public function isBreakoutRoomsRecord(): bool
1050+
public function isBreakoutRoomsRecord(): ?bool
10511051
{
10521052
return $this->breakoutRoomsRecord;
10531053
}
@@ -1081,7 +1081,7 @@ public function setBreakoutRoomsPrivateChatEnabled(bool $breakoutRoomsPrivateCha
10811081
return $this;
10821082
}
10831083

1084-
public function getMeetingEndedURL(): string
1084+
public function getMeetingEndedURL(): ?string
10851085
{
10861086
return $this->meetingEndedURL;
10871087
}
@@ -1154,7 +1154,7 @@ public function setUserCameraCap(int $userCameraCap): self
11541154
return $this;
11551155
}
11561156

1157-
public function getMeetingCameraCap(): int
1157+
public function getMeetingCameraCap(): ?int
11581158
{
11591159
return $this->meetingCameraCap;
11601160
}
@@ -1174,7 +1174,7 @@ public function setMeetingCameraCap(int $meetingCameraCap): self
11741174
return $this;
11751175
}
11761176

1177-
public function getMeetingExpireIfNoUserJoinedInMinutes(): int
1177+
public function getMeetingExpireIfNoUserJoinedInMinutes(): ?int
11781178
{
11791179
return $this->meetingExpireIfNoUserJoinedInMinutes;
11801180
}
@@ -1193,7 +1193,7 @@ public function setMeetingExpireIfNoUserJoinedInMinutes(int $meetingExpireIfNoUs
11931193
return $this;
11941194
}
11951195

1196-
public function getMeetingExpireWhenLastUserLeftInMinutes(): int
1196+
public function getMeetingExpireWhenLastUserLeftInMinutes(): ?int
11971197
{
11981198
return $this->meetingExpireWhenLastUserLeftInMinutes;
11991199
}
@@ -1214,7 +1214,7 @@ public function setMeetingExpireWhenLastUserLeftInMinutes(int $meetingExpireWhen
12141214
return $this;
12151215
}
12161216

1217-
public function isPreUploadedPresentationOverrideDefault(): bool
1217+
public function isPreUploadedPresentationOverrideDefault(): ?bool
12181218
{
12191219
return $this->preUploadedPresentationOverrideDefault;
12201220
}
@@ -1301,7 +1301,7 @@ public function setDisabledFeaturesExclude(array $disabledFeaturesExclude): self
13011301
return $this;
13021302
}
13031303

1304-
public function getRecordFullDurationMedia(): bool
1304+
public function getRecordFullDurationMedia(): ?bool
13051305
{
13061306
return $this->recordFullDurationMedia;
13071307
}
@@ -1342,7 +1342,7 @@ public function addBreakoutRoomsGroup($id, $name, $roster): self
13421342
return $this;
13431343
}
13441344

1345-
public function getNotifyRecordingIsOn(): bool
1345+
public function getNotifyRecordingIsOn(): ?bool
13461346
{
13471347
return $this->notifyRecordingIsOn;
13481348
}
@@ -1362,7 +1362,7 @@ public function setNotifyRecordingIsOn(bool $notifyRecordingIsOn): self
13621362
return $this;
13631363
}
13641364

1365-
public function getPresentationUploadExternalUrl(): string
1365+
public function getPresentationUploadExternalUrl(): ?string
13661366
{
13671367
return $this->presentationUploadExternalUrl;
13681368
}
@@ -1380,7 +1380,7 @@ public function setPresentationUploadExternalUrl(string $presentationUploadExter
13801380
return $this;
13811381
}
13821382

1383-
public function getPresentationUploadExternalDescription(): string
1383+
public function getPresentationUploadExternalDescription(): ?string
13841384
{
13851385
return $this->presentationUploadExternalDescription;
13861386
}
@@ -1414,8 +1414,8 @@ public function getHTTPQuery(): string
14141414
'maxParticipants' => $this->maxParticipants,
14151415
'autoStartRecording' => !is_null($this->autoStartRecording) ? ($this->autoStartRecording ? 'true' : 'false') : $this->autoStartRecording,
14161416
'allowStartStopRecording' => !is_null($this->allowStartStopRecording) ? ($this->allowStartStopRecording ? 'true' : 'false') : $this->allowStartStopRecording,
1417-
'welcome' => trim($this->welcomeMessage),
1418-
'moderatorOnlyMessage' => trim($this->moderatorOnlyMessage),
1417+
'welcome' => !is_null($this->welcomeMessage) ? trim($this->welcomeMessage) : '',
1418+
'moderatorOnlyMessage' => !is_null($this->moderatorOnlyMessage) ? trim($this->moderatorOnlyMessage) : '',
14191419
'webcamsOnlyForModerator' => !is_null($this->webcamsOnlyForModerator) ? ($this->webcamsOnlyForModerator ? 'true' : 'false') : $this->webcamsOnlyForModerator,
14201420
'logo' => $this->logo,
14211421
'copyright' => $this->copyright,
@@ -1433,8 +1433,8 @@ public function getHTTPQuery(): string
14331433
'lockSettingsHideViewersCursor' => !is_null($this->lockSettingsHideViewersCursor) ? ($this->lockSettingsHideViewersCursor ? 'true' : 'false') : $this->lockSettingsHideViewersCursor,
14341434
'allowModsToUnmuteUsers' => !is_null($this->allowModsToUnmuteUsers) ? ($this->allowModsToUnmuteUsers ? 'true' : 'false') : $this->allowModsToUnmuteUsers,
14351435
'allowModsToEjectCameras' => !is_null($this->allowModsToEjectCameras) ? ($this->allowModsToEjectCameras ? 'true' : 'false') : $this->allowModsToEjectCameras,
1436-
'bannerText' => trim($this->bannerText),
1437-
'bannerColor' => trim($this->bannerColor),
1436+
'bannerText' => !is_null($this->bannerText) ? trim($this->bannerText) : '',
1437+
'bannerColor' => !is_null($this->bannerColor) ? trim($this->bannerColor) : '',
14381438
'learningDashboardEnabled' => !is_null($this->learningDashboardEnabled) ? ($this->learningDashboardEnabled ? 'true' : 'false') : $this->learningDashboardEnabled,
14391439
'virtualBackgroundsDisabled' => !is_null($this->virtualBackgroundsDisabled) ? ($this->virtualBackgroundsDisabled ? 'true' : 'false') : $this->virtualBackgroundsDisabled,
14401440
'endWhenNoModeratorDelayInMinutes' => $this->endWhenNoModeratorDelayInMinutes,

src/Parameters/DeleteRecordingsParameters.php

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -27,40 +27,24 @@ class DeleteRecordingsParameters extends BaseParameters
2727
{
2828
private ?string $recordingId = null;
2929

30-
/**
31-
* DeleteRecordingsParameters constructor.
32-
*
33-
* @param mixed $recordingId
34-
*/
35-
public function __construct($recordingId = null)
30+
public function __construct(string $recordingId = null)
3631
{
3732
$this->recordingId = $recordingId;
3833
}
3934

40-
/**
41-
* @return string
42-
*/
43-
public function getRecordingId()
35+
public function getRecordingId(): ?string
4436
{
4537
return $this->recordingId;
4638
}
4739

48-
/**
49-
* @param string $recordingId
50-
*
51-
* @return DeleteRecordingsParameters
52-
*/
53-
public function setRecordingId($recordingId)
40+
public function setRecordingId(string $recordingId): DeleteRecordingsParameters
5441
{
5542
$this->recordingId = $recordingId;
5643

5744
return $this;
5845
}
5946

60-
/**
61-
* @return string
62-
*/
63-
public function getHTTPQuery()
47+
public function getHTTPQuery(): string
6448
{
6549
return $this->buildHTTPQuery(['recordID' => $this->recordingId]);
6650
}

src/Parameters/EndMeetingParameters.php

Lines changed: 6 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -32,32 +32,18 @@ class EndMeetingParameters extends BaseParameters
3232
*/
3333
private ?string $password = null;
3434

35-
/**
36-
* EndMeetingParameters constructor.
37-
*
38-
* @param string $meetingId
39-
* @param string $password
40-
*/
41-
public function __construct($meetingId = null, $password = null)
35+
public function __construct(string $meetingId = null, string $password = null)
4236
{
4337
$this->password = $password;
4438
$this->meetingId = $meetingId;
4539
}
4640

47-
/**
48-
* @return string
49-
*/
50-
public function getMeetingId()
41+
public function getMeetingId(): ?string
5142
{
5243
return $this->meetingId;
5344
}
5445

55-
/**
56-
* @param string $meetingId
57-
*
58-
* @return EndMeetingParameters
59-
*/
60-
public function setMeetingId($meetingId)
46+
public function setMeetingId(string $meetingId): self
6147
{
6248
$this->meetingId = $meetingId;
6349

@@ -66,32 +52,23 @@ public function setMeetingId($meetingId)
6652

6753
/**
6854
* @deprecated
69-
*
70-
* @return string
7155
*/
72-
public function getPassword()
56+
public function getPassword(): ?string
7357
{
7458
return $this->password;
7559
}
7660

7761
/**
78-
* @param string $password
79-
*
8062
* @deprecated
81-
*
82-
* @return EndMeetingParameters
8363
*/
84-
public function setPassword($password)
64+
public function setPassword(string $password): self
8565
{
8666
$this->password = $password;
8767

8868
return $this;
8969
}
9070

91-
/**
92-
* @return string
93-
*/
94-
public function getHTTPQuery()
71+
public function getHTTPQuery(): string
9572
{
9673
return $this->buildHTTPQuery(
9774
[

src/Parameters/GetMeetingInfoParameters.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public function __construct(?string $meetingId = null)
3636
$this->meetingId = $meetingId;
3737
}
3838

39-
public function getMeetingId(): string
39+
public function getMeetingId(): ?string
4040
{
4141
return $this->meetingId;
4242
}

src/Parameters/GetRecordingTextTracksParameters.php

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -29,38 +29,25 @@ class GetRecordingTextTracksParameters extends MetaParameters
2929

3030
/**
3131
* GetRecordingTextTracksParameters constructor.
32-
*
33-
* @param mixed $recordId
3432
*/
35-
public function __construct($recordId = null)
33+
public function __construct(string $recordId = null)
3634
{
3735
$this->recordId = $recordId;
3836
}
3937

40-
/**
41-
* @return string
42-
*/
43-
public function getRecordId()
38+
public function getRecordId(): ?string
4439
{
4540
return $this->recordId;
4641
}
4742

48-
/**
49-
* @param string $recordId
50-
*
51-
* @return GetRecordingTextTracksParameters
52-
*/
53-
public function setRecordId($recordId)
43+
public function setRecordId(string $recordId): self
5444
{
5545
$this->recordId = $recordId;
5646

5747
return $this;
5848
}
5949

60-
/**
61-
* @return string
62-
*/
63-
public function getHTTPQuery()
50+
public function getHTTPQuery(): string
6451
{
6552
$queries = [
6653
'recordID' => $this->recordId,

0 commit comments

Comments
 (0)