Commit 5b7d8513 authored by Tino Goratsch's avatar Tino Goratsch

fix some errors reported by PHPStan

parent 391ea077
Pipeline #46878093 passed with stages
in 2 minutes and 54 seconds
......@@ -26,7 +26,7 @@ interface ColumnTypeStrategyInterface
public function doUnescape($value);
/**
* @return string|int
* @return mixed
*/
public function getDefaultValue();
}
......@@ -23,6 +23,9 @@ class IntegerNullableColumnType extends IntegerColumnType
return $value;
}
/**
* @return int|string|null
*/
public function getDefaultValue()
{
return null;
......
......@@ -27,7 +27,11 @@ class PictureValidationRule extends AbstractValidationRule
}
/**
* {@inheritdoc}
* @param array|bool|float|int|string|UploadedFile $data
* @param string|array $field
* @param array $extra
*
* @return bool
*/
public function isValid($data, $field = '', array $extra = []): bool
{
......@@ -41,9 +45,9 @@ class PictureValidationRule extends AbstractValidationRule
if ($this->fileUploadValidationRule->isValid($data)) {
return $this->isPicture(
$data instanceof UploadedFile ? $data->getPathname() : $data['tmp_name'],
$params['width'],
$params['height'],
$params['filesize']
(int) $params['width'],
(int) $params['height'],
(int) $params['filesize']
);
} elseif ($params['required'] === false && empty($data)) {
return true;
......@@ -60,7 +64,7 @@ class PictureValidationRule extends AbstractValidationRule
*
* @return bool
*/
protected function isPicture($file, $width = 0, $height = 0, $filesize = 0)
protected function isPicture(string $file, int $width = 0, int $height = 0, int $filesize = 0)
{
$info = \getimagesize($file);
$isPicture = ($info[2] >= 1 && $info[2] <= 3);
......@@ -87,10 +91,10 @@ class PictureValidationRule extends AbstractValidationRule
*
* @return bool
*/
protected function validateOptionalParameters($file, array $info, $width, $height, $filesize)
protected function validateOptionalParameters(string $file, array $info, int $width, int $height, int $filesize)
{
return $width > 0 && $info[0] > $width ||
$height > 0 && $info[1] > $height ||
$filesize > 0 && \filesize($file) > $filesize;
return $width > 0 && $info[0] > $width
|| $height > 0 && $info[1] > $height
|| $filesize > 0 && \filesize($file) > $filesize;
}
}
......@@ -56,7 +56,7 @@ class Delete extends Core\Controller\AbstractFormAction
return $this->redirectMessages()->setMessage(
$result,
$this->translator->t('system', $result !== false ? 'delete_success' : 'delete_error'),
$this->translator->t('system', $result > 0 ? 'delete_success' : 'delete_error'),
$redirectUrl
);
},
......
......@@ -44,7 +44,7 @@ class Delete extends Core\Controller\AbstractFormAction
function (array $items) {
try {
$result = $this->usersModel->delete($items);
$text = $this->translator->t('system', $result !== false ? 'delete_success' : 'delete_error');
$text = $this->translator->t('system', $result > 0 ? 'delete_success' : 'delete_error');
} catch (Users\Exception\SuperUserNotDeletableException $e) {
$result = false;
$text = $this->translator->t('users', 'admin_user_undeletable');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment