#451 PHPStan level 5

This commit is contained in:
Roland Gruber 2025-09-05 08:36:04 +02:00
parent b054c2bd02
commit a133fc09c5
4 changed files with 10 additions and 10 deletions

View file

@ -1771,7 +1771,7 @@ abstract class baseModule {
$field->setFieldSize(null); $field->setFieldSize(null);
} }
elseif ($isTextArea && !in_array($name, $readOnlyFields)) { elseif ($isTextArea && !in_array($name, $readOnlyFields)) {
$field = new htmlInputTextarea(static::class . '_' . $name, $value, null, null); $field = new htmlInputTextarea(static::class . '_' . $name, $value, 100, 3);
} }
elseif (!$isTextArea) { elseif (!$isTextArea) {
$field = new htmlOutputText($value); $field = new htmlOutputText($value);

View file

@ -3190,7 +3190,7 @@ class LAMCfgMain {
@chmod($fileName, 0600); @chmod($fileName, 0600);
} }
else { else {
throw new LAMException(printf(_('Unable to write file %s.'), $fileName)); throw new LAMException(sprintf(_('Unable to write file %s.'), $fileName));
} }
} }
@ -3268,11 +3268,11 @@ class LAMCfgMain {
} }
catch (PDOException $e) { catch (PDOException $e) {
syslog(LOG_ERR, 'Unable to read main config: ' . $e->getMessage()); syslog(LOG_ERR, 'Unable to read main config: ' . $e->getMessage());
throw new LAMException(_('Unable to connect to configuration database.'), null, $e); throw new LAMException(_('Unable to connect to configuration database.'), '', $e);
} }
catch (LAMException $e) { catch (LAMException $e) {
syslog(LOG_ERR, 'Unable to import main config: ' . $e->getMessage()); syslog(LOG_ERR, 'Unable to import main config: ' . $e->getMessage());
throw new LAMException(_('Unable to connect to configuration database.'), null, $e); throw new LAMException(_('Unable to connect to configuration database.'), '', $e);
} }
} }

View file

@ -140,10 +140,10 @@ class CronRunner {
$pdo = $cronDatabase->getPdo(); $pdo = $cronDatabase->getPdo();
} }
catch (PDOException $e) { catch (PDOException $e) {
throw new LAMException("Unable to connect to database. " . $e->getMessage(), null, $e); throw new LAMException("Unable to connect to database. " . $e->getMessage(), '', $e);
} }
catch (LAMException $e) { catch (LAMException $e) {
throw new LAMException("Unable to connect to database. " . $e->getTitle(), null, $e); throw new LAMException("Unable to connect to database. " . $e->getTitle(), '', $e);
} }
// get jobs to run // get jobs to run
if (empty($cronDatabase->getJobs())) { if (empty($cronDatabase->getJobs())) {

View file

@ -1286,7 +1286,7 @@ class htmlSelect extends htmlElement {
if ($selectedElements != null) { if ($selectedElements != null) {
$this->selectedElements = $selectedElements; $this->selectedElements = $selectedElements;
} }
$this->size = htmlspecialchars($size); $this->size = htmlspecialchars((string) $size);
} }
/** /**
@ -2374,8 +2374,8 @@ class htmlInputTextarea extends htmlElement {
function __construct($name, $value, $colCount, $rowCount) { function __construct($name, $value, $colCount, $rowCount) {
$this->name = htmlspecialchars($name); $this->name = htmlspecialchars($name);
$this->value = htmlspecialchars($value); $this->value = htmlspecialchars($value);
$this->colCount = htmlspecialchars($colCount); $this->colCount = htmlspecialchars((string) $colCount);
$this->rowCount = htmlspecialchars($rowCount); $this->rowCount = htmlspecialchars((string) $rowCount);
} }
/** /**
@ -4900,7 +4900,7 @@ class htmlProgressbar extends htmlElement {
*/ */
function __construct(string $id = null, int $progress = 0) { function __construct(string $id = null, int $progress = 0) {
$this->id = htmlspecialchars($id); $this->id = htmlspecialchars($id);
$this->progress = htmlspecialchars($progress); $this->progress = htmlspecialchars((string) $progress);
} }
/** /**