Fix a lot of phpstan things

This commit is contained in:
James Cole
2023-11-26 12:10:42 +01:00
parent a6c355c7b8
commit 68f01d932e
53 changed files with 214 additions and 120 deletions

View File

@@ -141,7 +141,7 @@ class DebugController extends Controller
}
if ('' !== $logContent) {
// last few lines
$logContent = 'Truncated from this point <----|' . substr($logContent, -16384);
$logContent = 'Truncated from this point <----|' . substr((string)$logContent, -16384);
}
return view('debug', compact('table', 'now', 'logContent'));
@@ -166,8 +166,8 @@ class DebugController extends Controller
*/
private function getSystemInformation(): array
{
$maxFileSize = app('steam')->phpBytes(ini_get('upload_max_filesize'));
$maxPostSize = app('steam')->phpBytes(ini_get('post_max_size'));
$maxFileSize = app('steam')->phpBytes((string)ini_get('upload_max_filesize'));
$maxPostSize = app('steam')->phpBytes((string)ini_get('post_max_size'));
$drivers = DB::availableDrivers();
$currentDriver = DB::getDriverName();
return [
@@ -199,7 +199,7 @@ class DebugController extends Controller
];
try {
if (file_exists('/var/www/counter-main.txt')) {
$return['build'] = trim(file_get_contents('/var/www/counter-main.txt'));
$return['build'] = trim((string)file_get_contents('/var/www/counter-main.txt'));
}
} catch (Exception $e) { // @phpstan-ignore-line
app('log')->debug('Could not check build counter, but thats ok.');
@@ -207,7 +207,7 @@ class DebugController extends Controller
}
try {
if (file_exists('/var/www/build-date-main.txt')) {
$return['build_date'] = trim(file_get_contents('/var/www/build-date-main.txt'));
$return['build_date'] = trim((string)file_get_contents('/var/www/build-date-main.txt'));
}
} catch (Exception $e) { // @phpstan-ignore-line
app('log')->debug('Could not check build date, but thats ok.');
@@ -236,7 +236,7 @@ class DebugController extends Controller
if ($lastTime > 0) {
$carbon = Carbon::createFromTimestamp($lastTime);
$lastCronjob = $carbon->format('Y-m-d H:i:s');
$lastCronjobAgo = $carbon->locale('en')->diffForHumans();
$lastCronjobAgo = $carbon->locale('en')->diffForHumans(); // @phpstan-ignore-line
}
return [
@@ -279,7 +279,7 @@ class DebugController extends Controller
$result = setlocale(LC_ALL, $code);
$localeAttempts[$code] = $result === $code;
}
setlocale(LC_ALL, $original);
setlocale(LC_ALL, (string) $original);
return [
'user_id' => auth()->user()->id,