diff --git a/src/Config/Form.php b/src/Config/Form.php index f306d4fd27..f22fd3db29 100644 --- a/src/Config/Form.php +++ b/src/Config/Form.php @@ -84,9 +84,9 @@ class Form * * @param string $optionName path or field name * - * @return string|null one of: boolean, integer, double, string, select, array + * @return string one of: boolean, integer, double, string, select, array */ - public function getOptionType(string $optionName): string|null + public function getOptionType(string $optionName): string { $key = ltrim( mb_substr( @@ -96,7 +96,7 @@ class Form '/', ); - return $this->fieldsTypes[$key] ?? null; + return $this->fieldsTypes[$key] ?? ''; } /** diff --git a/src/Config/FormDisplay.php b/src/Config/FormDisplay.php index feafec89ff..326a695857 100644 --- a/src/Config/FormDisplay.php +++ b/src/Config/FormDisplay.php @@ -566,7 +566,7 @@ class FormDisplay foreach ($form->fields as $field => $systemPath) { $workPath = array_search($systemPath, $this->systemPaths); $key = $this->translatedPaths[$workPath]; - $type = (string) $form->getOptionType($field); + $type = $form->getOptionType($field); // skip groups if ($type === 'group') { diff --git a/src/ConfigStorage/Relation.php b/src/ConfigStorage/Relation.php index 1b4898e535..c7200ac646 100644 --- a/src/ConfigStorage/Relation.php +++ b/src/ConfigStorage/Relation.php @@ -1235,10 +1235,10 @@ class Relation /** * Create a PDF page * - * @param string|null $newpage name of the new PDF page - * @param string $db database name + * @param string $newpage name of the new PDF page + * @param string $db database name */ - public function createPage(string|null $newpage, PdfFeature $pdfFeature, string $db): int + public function createPage(string $newpage, PdfFeature $pdfFeature, string $db): int { $insQuery = 'INSERT INTO ' . Util::backquote($pdfFeature->database) . '.' @@ -1247,7 +1247,7 @@ class Relation . ' VALUES (' . $this->dbi->quoteString($db, ConnectionType::ControlUser) . ', ' . $this->dbi->quoteString( - $newpage !== null && $newpage !== '' ? $newpage : __('no description'), + $newpage !== '' ? $newpage : __('no description'), ConnectionType::ControlUser, ) . ')'; $this->dbi->tryQueryAsControlUser($insQuery); diff --git a/src/Controllers/Database/CentralColumnsController.php b/src/Controllers/Database/CentralColumnsController.php index a0b5325238..98d59a9146 100644 --- a/src/Controllers/Database/CentralColumnsController.php +++ b/src/Controllers/Database/CentralColumnsController.php @@ -42,7 +42,7 @@ final class CentralColumnsController implements InvocableController $request->getParsedBodyParamAsString('orig_col_name'), $request->getParsedBodyParamAsString('col_default'), $request->getParsedBodyParamAsString('col_default_sel'), - $request->getParsedBodyParamAsStringOrNull('col_extra'), + $request->getParsedBodyParamAsString('col_extra', ''), $request->getParsedBodyParamAsStringOrNull('col_isNull'), $request->getParsedBodyParamAsString('col_length'), $request->getParsedBodyParamAsString('col_attribute'), @@ -60,7 +60,7 @@ final class CentralColumnsController implements InvocableController $request->getParsedBodyParamAsString('col_name'), $request->getParsedBodyParamAsString('col_default'), $request->getParsedBodyParamAsString('col_default_sel'), - $request->getParsedBodyParamAsStringOrNull('col_extra'), + $request->getParsedBodyParamAsString('col_extra', ''), $request->getParsedBodyParamAsStringOrNull('col_isNull'), $request->getParsedBodyParamAsString('col_length'), $request->getParsedBodyParamAsString('col_attribute'), @@ -176,7 +176,7 @@ final class CentralColumnsController implements InvocableController string $origColName, string $colDefault, string $colDefaultSel, - string|null $colExtra, + string $colExtra, string|null $colIsNull, string $colLength, string $colAttribute, @@ -198,7 +198,7 @@ final class CentralColumnsController implements InvocableController $colLength, $colIsNull !== null, $collation, - $colExtra ?? '', + $colExtra, $columnDefault, ); } @@ -207,7 +207,7 @@ final class CentralColumnsController implements InvocableController string $colName, string $colDefault, string $colDefaultSel, - string|null $colExtra, + string $colExtra, string|null $colIsNull, string $colLength, string $colAttribute, @@ -224,7 +224,7 @@ final class CentralColumnsController implements InvocableController $colLength, $colIsNull !== null, $collation, - $colExtra ?? '', + $colExtra, $colDefault === 'NONE' && $colDefaultSel !== 'USER_DEFINED' ? '' : $colDefault, ); } diff --git a/tests/unit/Config/FormTest.php b/tests/unit/Config/FormTest.php index 593ea98bbc..586d9a24e4 100644 --- a/tests/unit/Config/FormTest.php +++ b/tests/unit/Config/FormTest.php @@ -68,7 +68,8 @@ class FormTest extends AbstractTestCase ['7' => 'Seven'], ); - self::assertNull( + self::assertSame( + '', $this->object->getOptionType('123/4/5/6'), );