Skip to content

Commit 5e93439

Browse files
committed
Rector 2.3 fixes
1 parent 515201e commit 5e93439

File tree

10 files changed

+12
-12
lines changed

10 files changed

+12
-12
lines changed

LibreNMS/Alert/Transport/Pagerduty.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public function deliverAlert(array $alert_data): bool
4949
} else {
5050
// Legacy behaviour: strip tags and split into non-empty lines
5151
$safe_message = strip_tags($msg_raw) ?: 'Test';
52-
$message = array_filter(explode("\n", $safe_message), fn ($value): bool => strlen($value) > 0);
52+
$message = array_filter(explode("\n", $safe_message), fn ($value): bool => strlen((string) $value) > 0);
5353
$custom_details = ['message' => $message];
5454
}
5555
$data = [

LibreNMS/OS/ArubaInstant.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ protected function decodeChannel($channel): int
282282
*/
283283
public function pollWirelessFrequency(array $sensors)
284284
{
285-
return $this->pollWirelessChannelAsFrequency($sensors, [$this, 'decodeChannel']);
285+
return $this->pollWirelessChannelAsFrequency($sensors, $this->decodeChannel(...));
286286
}
287287

288288
/**

LibreNMS/OS/Arubaos.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,6 @@ public function discoverWirelessUtilization()
215215
*/
216216
public function pollWirelessFrequency(array $sensors)
217217
{
218-
return $this->pollWirelessChannelAsFrequency($sensors, [$this, 'decodeChannel']);
218+
return $this->pollWirelessChannelAsFrequency($sensors, $this->decodeChannel(...));
219219
}
220220
}

LibreNMS/OS/Iosxe.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ public function discoverIsIs(): Collection
106106
'isisISAdjNeighSysID' => $this->formatIsIsId($adjacency_data['CISCO-IETF-ISIS-MIB::ciiISAdjNeighSysID'] ?? ''),
107107
'isisISAdjNeighPriority' => $adjacency_data['CISCO-IETF-ISIS-MIB::ciiISAdjNeighPriority'] ?? '',
108108
'isisISAdjLastUpTime' => $this->parseAdjacencyTime($adjacency_data['CISCO-IETF-ISIS-MIB::ciiISAdjLastUpTime'] ?? 0),
109-
'isisISAdjAreaAddress' => implode(',', array_map([$this, 'formatIsIsId'], $adjacency_data['CISCO-IETF-ISIS-MIB::ciiISAdjAreaAddress'] ?? [])),
109+
'isisISAdjAreaAddress' => implode(',', array_map($this->formatIsIsId(...), $adjacency_data['CISCO-IETF-ISIS-MIB::ciiISAdjAreaAddress'] ?? [])),
110110
'isisISAdjIPAddrType' => implode(',', $adjacency_data['CISCO-IETF-ISIS-MIB::ciiISAdjIPAddrType'] ?? []),
111111
'isisISAdjIPAddrAddress' => implode(',', array_map(fn ($ip) => (string) IP::fromHexString($ip, true), $adjacency_data['CISCO-IETF-ISIS-MIB::ciiISAdjIPAddrAddress'] ?? [])),
112112
]));

LibreNMS/Validations/Database/CheckSchemaStructure.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,8 +203,8 @@ private function checkSchema(): void
203203

204204
private function addTableSql(string $table, array $table_schema): string
205205
{
206-
$columns = array_map([$this, 'columnToSql'], $table_schema['Columns']);
207-
$indexes = array_map([$this, 'indexToSql'], $table_schema['Indexes'] ?? []);
206+
$columns = array_map($this->columnToSql(...), $table_schema['Columns']);
207+
$indexes = array_map($this->indexToSql(...), $table_schema['Indexes'] ?? []);
208208

209209
$def = implode(', ', array_merge(array_values($columns), array_values($indexes)));
210210

app/Console/Commands/ReportDevices.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -252,13 +252,13 @@ public function completeOptionValue(DynamicInputOption $option, string $current)
252252
->merge(Schema::getColumnListing('devices'))
253253
->merge(array_keys($this->getSyntheticFields()))
254254
->merge(Device::definedRelations())
255-
->when($current, fn ($c) => $c->filter(fn ($i) => str_starts_with($i, $current)));
255+
->when($current, fn ($c) => $c->filter(fn ($i) => str_starts_with((string) $i, $current)));
256256
}
257257

258258
if ($option->getName() == 'relationships') {
259259
return collect()
260260
->merge($this->getRelationships())
261-
->when($current, fn ($c) => $c->filter(fn ($i) => str_starts_with($i, $current)));
261+
->when($current, fn ($c) => $c->filter(fn ($i) => str_starts_with((string) $i, $current)));
262262
}
263263

264264
return null;

app/Http/Controllers/Device/Tabs/QosController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public function data(Device $device, Request $request): array
5757
$show = null;
5858
$vars = $request->vars;
5959
if ($vars) {
60-
$showvars = array_filter(explode('/', $vars), fn ($v) => str_starts_with($v, 'show='));
60+
$showvars = array_filter(explode('/', $vars), fn ($v) => str_starts_with((string) $v, 'show='));
6161
if ($showvars) {
6262
$showvar = explode('=', $showvars[0]);
6363
$show = array_pop($showvar);

app/Http/Controllers/Table/GraylogController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ public function __invoke(Request $request, GraylogApi $api)
8686
$messages = $data['messages'] ?? [];
8787

8888
return $this->formatResponse(
89-
array_map([$this, 'formatMessage'], $messages),
89+
array_map($this->formatMessage(...), $messages),
9090
$page,
9191
count($messages),
9292
$data['total_results'] ?? 0,

includes/discovery/sensors/ipmi.inc.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
Log::debug('Trying IPMI type: ' . $ipmi_type);
3636
$results = explode(PHP_EOL, (string) external_exec(array_merge($cmd, ['-I', $ipmi_type, 'sensor'])));
3737

38-
$results = array_values(array_filter($results, fn ($line) => ! Str::contains($line, 'discrete') && trim($line) !== ''));
38+
$results = array_values(array_filter($results, fn ($line) => ! Str::contains($line, 'discrete') && trim((string) $line) !== ''));
3939

4040
if (! empty($results)) {
4141
set_dev_attrib($device, 'ipmi_type', $ipmi_type);

includes/html/pages/iftype.inc.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
return strtolower((string) $descr);
1616
});
1717
array_walk($types_array, function (&$type) use ($ctypes): void {
18-
$name = $ctypes->get(strtolower($type), $type);
18+
$name = $ctypes->get(strtolower((string) $type), $type);
1919
$type = ucwords(is_array($name) ? $name[0] : $name);
2020
});
2121

0 commit comments

Comments
 (0)