Fix 10 PHPStan errors
This commit is contained in:
parent
e1eb6fff83
commit
7e66b35b46
4 changed files with 10 additions and 11 deletions
|
@ -80,7 +80,7 @@ class Database implements ICanWriteToStorage
|
||||||
throw new StorageException(sprintf('Database storage failed to update %s', $reference), 500, new Exception($this->dba->errorMessage(), $this->dba->errorNo()));
|
throw new StorageException(sprintf('Database storage failed to update %s', $reference), 500, new Exception($this->dba->errorMessage(), $this->dba->errorNo()));
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->dba->lastInsertId();
|
return (string) $this->dba->lastInsertId();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -452,19 +452,17 @@ class System
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the current Load of the System
|
* Returns the current Load of the System
|
||||||
*
|
|
||||||
* @return integer
|
|
||||||
*/
|
*/
|
||||||
public static function currentLoad()
|
public static function currentLoad(): float
|
||||||
{
|
{
|
||||||
if (!function_exists('sys_getloadavg')) {
|
if (!function_exists('sys_getloadavg')) {
|
||||||
return false;
|
return (float) 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
$load_arr = sys_getloadavg();
|
$load_arr = sys_getloadavg();
|
||||||
|
|
||||||
if (!is_array($load_arr)) {
|
if (!is_array($load_arr)) {
|
||||||
return false;
|
return (float) 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return round(max($load_arr[0], $load_arr[1]), 2);
|
return round(max($load_arr[0], $load_arr[1]), 2);
|
||||||
|
|
|
@ -217,7 +217,7 @@ class Update
|
||||||
->set('system', 'maintenance', false)
|
->set('system', 'maintenance', false)
|
||||||
->delete('system', 'maintenance_reason')
|
->delete('system', 'maintenance_reason')
|
||||||
->commit();
|
->commit();
|
||||||
return $r;
|
return 'Pre update failed';
|
||||||
} else {
|
} else {
|
||||||
DI::logger()->notice('Pre update executed.', ['version' => $version]);
|
DI::logger()->notice('Pre update executed.', ['version' => $version]);
|
||||||
}
|
}
|
||||||
|
@ -262,7 +262,7 @@ class Update
|
||||||
->set('system', 'maintenance', false)
|
->set('system', 'maintenance', false)
|
||||||
->delete('system', 'maintenance_reason')
|
->delete('system', 'maintenance_reason')
|
||||||
->commit();
|
->commit();
|
||||||
return $r;
|
return 'Post update failed';
|
||||||
} else {
|
} else {
|
||||||
DI::config()->set('system', 'build', $version);
|
DI::config()->set('system', 'build', $version);
|
||||||
DI::logger()->notice('Post update executed.', ['version' => $version]);
|
DI::logger()->notice('Post update executed.', ['version' => $version]);
|
||||||
|
|
|
@ -271,12 +271,13 @@ class Worker
|
||||||
*
|
*
|
||||||
* @param integer $priority The priority that should be checked
|
* @param integer $priority The priority that should be checked
|
||||||
*
|
*
|
||||||
* @return integer Is there a process running with that priority?
|
* @return bool Is there a process running with that priority?
|
||||||
* @throws \Exception
|
* @throws \Exception
|
||||||
*/
|
*/
|
||||||
private static function processWithPriorityActive(int $priority): int
|
private static function processWithPriorityActive(int $priority): bool
|
||||||
{
|
{
|
||||||
$condition = ["`priority` <= ? AND `pid` != 0 AND NOT `done`", $priority];
|
$condition = ["`priority` <= ? AND `pid` != 0 AND NOT `done`", $priority];
|
||||||
|
|
||||||
return DBA::exists('workerqueue', $condition);
|
return DBA::exists('workerqueue', $condition);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -955,7 +956,7 @@ class Worker
|
||||||
/**
|
/**
|
||||||
* Returns the priority of the next workerqueue job
|
* Returns the priority of the next workerqueue job
|
||||||
*
|
*
|
||||||
* @return string|bool priority or FALSE on failure
|
* @return int|false priority or FALSE on failure
|
||||||
* @throws \Exception
|
* @throws \Exception
|
||||||
*/
|
*/
|
||||||
private static function nextPriority()
|
private static function nextPriority()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue