Skip to content

Commit 5de353b

Browse files
authored
Merge pull request #785 from nextcloud/psalm-ignore-overwrite
chore: add override attribute
2 parents 1a29c05 + e8707ea commit 5de353b

14 files changed

Lines changed: 59 additions & 85 deletions

File tree

lib/Commands/UpdateStorageStats.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ public function __construct(StorageStatistics $storageStatistics) {
2626
$this->storageStatistics = $storageStatistics;
2727
}
2828

29+
#[\Override]
2930
public function configure(): void {
3031
parent::configure();
3132
$this->setName('serverinfo:update-storage-statistics')

lib/Jobs/UpdateStorageStats.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ public function __construct(ITimeFactory $time, StorageStatistics $storageStatis
2727
/**
2828
* @inheritDoc
2929
*/
30+
#[\Override]
3031
protected function run($argument): void {
3132
$this->storageStatistics->updateStorageCounts();
3233
}

lib/OperatingSystems/Dummy.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,26 +10,32 @@
1010
use OCA\ServerInfo\Resources\Memory;
1111

1212
class Dummy implements IOperatingSystem {
13+
#[\Override]
1314
public function supported(): bool {
1415
return false;
1516
}
1617

18+
#[\Override]
1719
public function getMemory(): Memory {
1820
return new Memory();
1921
}
2022

23+
#[\Override]
2124
public function getCpuName(): string {
2225
return 'Unknown Processor';
2326
}
2427

28+
#[\Override]
2529
public function getTime(): string {
2630
return '';
2731
}
2832

33+
#[\Override]
2934
public function getUptime(): int {
3035
return -1;
3136
}
3237

38+
#[\Override]
3339
public function getNetworkInfo(): array {
3440
return [
3541
'hostname' => \gethostname(),
@@ -38,18 +44,22 @@ public function getNetworkInfo(): array {
3844
];
3945
}
4046

47+
#[\Override]
4148
public function getNetworkInterfaces(): array {
4249
return [];
4350
}
4451

52+
#[\Override]
4553
public function getDiskInfo(): array {
4654
return [];
4755
}
4856

57+
#[\Override]
4958
public function getThermalZones(): array {
5059
return [];
5160
}
5261

62+
#[\Override]
5363
public function getCpuCount(): int {
5464
return 1;
5565
}

lib/OperatingSystems/FreeBSD.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,12 @@ class FreeBSD implements IOperatingSystem {
1616
private const AF_INET = 2;
1717
private const AF_INET6 = 28;
1818

19+
#[\Override]
1920
public function supported(): bool {
2021
return false;
2122
}
2223

24+
#[\Override]
2325
public function getMemory(): Memory {
2426
$data = new Memory();
2527

@@ -57,6 +59,7 @@ public function getMemory(): Memory {
5759
return $data;
5860
}
5961

62+
#[\Override]
6063
public function getCpuName(): string {
6164
$data = 'Unknown Processor';
6265

@@ -75,6 +78,7 @@ public function getCpuName(): string {
7578
return $data;
7679
}
7780

81+
#[\Override]
7882
public function getCpuCount(): int {
7983
$numCpu = -1;
8084

@@ -87,6 +91,7 @@ public function getCpuCount(): int {
8791
return $numCpu;
8892
}
8993

94+
#[\Override]
9095
public function getTime(): string {
9196
try {
9297
return $this->executeCommand('date');
@@ -95,6 +100,7 @@ public function getTime(): string {
95100
}
96101
}
97102

103+
#[\Override]
98104
public function getUptime(): int {
99105
$uptime = -1;
100106

@@ -109,6 +115,7 @@ public function getUptime(): int {
109115
return $uptime;
110116
}
111117

118+
#[\Override]
112119
public function getNetworkInfo(): array {
113120
$result = [
114121
'gateway' => '',
@@ -128,6 +135,7 @@ public function getNetworkInfo(): array {
128135
return $result;
129136
}
130137

138+
#[\Override]
131139
public function getNetworkInterfaces(): array {
132140
$data = [];
133141

@@ -185,6 +193,7 @@ public function getNetworkInterfaces(): array {
185193
return $data;
186194
}
187195

196+
#[\Override]
188197
public function getDiskInfo(): array {
189198
$data = [];
190199

@@ -223,6 +232,7 @@ public function getDiskInfo(): array {
223232
return $data;
224233
}
225234

235+
#[\Override]
226236
public function getThermalZones(): array {
227237
return [];
228238
}

lib/OperatingSystems/Linux.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,12 @@ class Linux implements IOperatingSystem {
1919
private const AF_INET = 2;
2020
private const AF_INET6 = 10;
2121

22+
#[\Override]
2223
public function supported(): bool {
2324
return true;
2425
}
2526

27+
#[\Override]
2628
public function getMemory(): Memory {
2729
$data = new Memory();
2830

@@ -66,6 +68,7 @@ public function getMemory(): Memory {
6668
return $data;
6769
}
6870

71+
#[\Override]
6972
public function getCpuName(): string {
7073
$data = 'Unknown Processor';
7174

@@ -103,6 +106,7 @@ public function getCpuName(): string {
103106
return $data;
104107
}
105108

109+
#[\Override]
106110
public function getCpuCount(): int {
107111
$numCpu = -1;
108112

@@ -118,6 +122,7 @@ public function getCpuCount(): int {
118122
return count($matches[1]);
119123
}
120124

125+
#[\Override]
121126
public function getTime(): string {
122127
try {
123128
return $this->executeCommand('date');
@@ -126,6 +131,7 @@ public function getTime(): string {
126131
}
127132
}
128133

134+
#[\Override]
129135
public function getUptime(): int {
130136
$data = -1;
131137

@@ -140,6 +146,7 @@ public function getUptime(): int {
140146
return $uptimeInSeconds;
141147
}
142148

149+
#[\Override]
143150
public function getNetworkInfo(): array {
144151
$result = [
145152
'gateway' => '',
@@ -153,6 +160,7 @@ public function getNetworkInfo(): array {
153160
return $result;
154161
}
155162

163+
#[\Override]
156164
public function getNetworkInterfaces(): array {
157165
$data = [];
158166

@@ -202,6 +210,7 @@ public function getNetworkInterfaces(): array {
202210
return $data;
203211
}
204212

213+
#[\Override]
205214
public function getDiskInfo(): array {
206215
$data = [];
207216

@@ -241,6 +250,7 @@ public function getDiskInfo(): array {
241250
return $data;
242251
}
243252

253+
#[\Override]
244254
public function getThermalZones(): array {
245255
$data = [];
246256

lib/Os.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ public function __construct(IConfig $config) {
2222
$this->backend = $this->getBackend($restrictedMode ? 'Dummy' : PHP_OS);
2323
}
2424

25+
#[\Override]
2526
public function supported(): bool {
2627
return $this->backend->supported();
2728
}
@@ -37,26 +38,32 @@ public function getOSName(): string {
3738
return PHP_OS . ' ' . php_uname('r') . ' ' . php_uname('m');
3839
}
3940

41+
#[\Override]
4042
public function getMemory(): Memory {
4143
return $this->backend->getMemory();
4244
}
4345

46+
#[\Override]
4447
public function getCpuName(): string {
4548
return $this->backend->getCpuName();
4649
}
4750

51+
#[\Override]
4852
public function getCpuCount(): int {
4953
return $this->backend->getCpuCount();
5054
}
5155

56+
#[\Override]
5257
public function getTime(): string {
5358
return $this->backend->getTime();
5459
}
5560

61+
#[\Override]
5662
public function getUptime(): int {
5763
return $this->backend->getUptime();
5864
}
5965

66+
#[\Override]
6067
public function getDiskInfo(): array {
6168
return $this->backend->getDiskInfo();
6269
}
@@ -83,14 +90,17 @@ public function getDiskData(): array {
8390
return $data;
8491
}
8592

93+
#[\Override]
8694
public function getNetworkInfo(): array {
8795
return $this->backend->getNetworkInfo();
8896
}
8997

98+
#[\Override]
9099
public function getNetworkInterfaces(): array {
91100
return $this->backend->getNetworkInterfaces();
92101
}
93102

103+
#[\Override]
94104
public function getThermalZones(): array {
95105
return $this->backend->getThermalZones();
96106
}

lib/PhpInfoResponse.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ public function __construct() {
2525
$this->setFeaturePolicy(new FeaturePolicy());
2626
}
2727

28+
#[\Override]
2829
public function render() {
2930
ob_start();
3031
phpinfo(INFO_ALL & ~INFO_ENVIRONMENT & ~INFO_VARIABLES);

lib/Resources/ThermalZone.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ public function getTemp(): float {
3131
return $this->temp;
3232
}
3333

34+
#[\Override]
3435
public function jsonSerialize(): array {
3536
return [
3637
'zone' => $this->zone,

lib/Settings/AdminSection.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ public function __construct(IL10N $l, IURLGenerator $url) {
2626
/**
2727
* returns the ID of the section. It is supposed to be a lower case string
2828
*/
29+
#[\Override]
2930
public function getID(): string {
3031
return 'serverinfo';
3132
}
@@ -34,6 +35,7 @@ public function getID(): string {
3435
* returns the translated name as it should be displayed, e.g. 'LDAP / AD
3536
* integration'. Use the L10N service to translate it.
3637
*/
38+
#[\Override]
3739
public function getName(): string {
3840
return $this->l->t('System');
3941
}
@@ -45,13 +47,15 @@ public function getName(): string {
4547
*
4648
* keep the server setting at the top, right after "overview" and "basic settings"
4749
*/
50+
#[\Override]
4851
public function getPriority(): int {
4952
return 90;
5053
}
5154

5255
/**
5356
* {@inheritdoc}
5457
*/
58+
#[\Override]
5559
public function getIcon(): string {
5660
return $this->url->imagePath('serverinfo', 'app-dark.svg');
5761
}

lib/Settings/AdminSettings.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ public function __construct(
4040
) {
4141
}
4242

43+
#[\Override]
4344
public function getForm(): TemplateResponse {
4445
$monitoringEndPoint = $this->urlGenerator->getAbsoluteURL('ocs/v2.php/apps/serverinfo/api/v1/info');
4546
$params = [
@@ -69,6 +70,7 @@ public function getForm(): TemplateResponse {
6970
/**
7071
* @return string the section ID, e.g. 'sharing'
7172
*/
73+
#[\Override]
7274
public function getSection(): string {
7375
return 'serverinfo';
7476
}
@@ -80,6 +82,7 @@ public function getSection(): string {
8082
*
8183
* keep the server setting at the top, right after "server settings"
8284
*/
85+
#[\Override]
8386
public function getPriority(): int {
8487
return 0;
8588
}

0 commit comments

Comments
 (0)