psalm fixes

This commit is contained in:
Robin Appelman 2025-10-24 17:31:24 +02:00
commit 4a93467905
12 changed files with 61 additions and 33 deletions

View file

@ -28,7 +28,7 @@ class TimeZoneProvider implements ITimeZoneProvider {
$timeZone = null;
$net = $this->system->getNetPath();
// for local domain names we can assume same timezone
if ($net && $host && strpos($host, '.') !== false) {
if ($net !== null && $host && strpos($host, '.') !== false) {
$command = sprintf(
'%s time zone -S %s',
$net,
@ -37,11 +37,12 @@ class TimeZoneProvider implements ITimeZoneProvider {
$timeZone = exec($command);
}
if (!$timeZone) {
if (!is_string($timeZone)) {
$date = $this->system->getDatePath();
if ($date) {
if ($date !== null) {
$timeZone = exec($date . " +%z");
} else {
}
if (!is_string($timeZone)) {
$timeZone = date_default_timezone_get();
}
}