From: Tim Düsterhus Date: Thu, 21 Oct 2021 11:54:38 +0000 (+0200) Subject: Prevent object creation for the DatabaseTableColumn factory classes X-Git-Tag: 5.5.0_Alpha_1~358^2 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=16525803b548bcbbe80417e59d36484526514973;p=GitHub%2FWoltLab%2FWCF.git Prevent object creation for the DatabaseTableColumn factory classes Resolves #4563 --- diff --git a/wcfsetup/install/files/lib/system/database/table/column/DefaultFalseBooleanDatabaseTableColumn.class.php b/wcfsetup/install/files/lib/system/database/table/column/DefaultFalseBooleanDatabaseTableColumn.class.php index 5be53e1bc6..1aed91c838 100644 --- a/wcfsetup/install/files/lib/system/database/table/column/DefaultFalseBooleanDatabaseTableColumn.class.php +++ b/wcfsetup/install/files/lib/system/database/table/column/DefaultFalseBooleanDatabaseTableColumn.class.php @@ -12,19 +12,17 @@ namespace wcf\system\database\table\column; * @package WoltLabSuite\Core\System\Database\Table\Column * @since 5.2 */ -class DefaultFalseBooleanDatabaseTableColumn extends TinyintDatabaseTableColumn +final class DefaultFalseBooleanDatabaseTableColumn { - /** - * @inheritDoc - */ public static function create($name) { - /** @var TinyintDatabaseTableColumn $column */ - $column = parent::create($name); - - return $column + return TinyintDatabaseTableColumn::create($name) ->length(1) ->notNull() ->defaultValue(0); } + + private function __construct() + { + } } diff --git a/wcfsetup/install/files/lib/system/database/table/column/DefaultTrueBooleanDatabaseTableColumn.class.php b/wcfsetup/install/files/lib/system/database/table/column/DefaultTrueBooleanDatabaseTableColumn.class.php index 3c28ebd43d..fd26976817 100644 --- a/wcfsetup/install/files/lib/system/database/table/column/DefaultTrueBooleanDatabaseTableColumn.class.php +++ b/wcfsetup/install/files/lib/system/database/table/column/DefaultTrueBooleanDatabaseTableColumn.class.php @@ -12,19 +12,17 @@ namespace wcf\system\database\table\column; * @package WoltLabSuite\Core\System\Database\Table\Column * @since 5.2 */ -class DefaultTrueBooleanDatabaseTableColumn extends TinyintDatabaseTableColumn +final class DefaultTrueBooleanDatabaseTableColumn { - /** - * @inheritDoc - */ public static function create($name) { - /** @var TinyintDatabaseTableColumn $column */ - $column = parent::create($name); - - return $column + return TinyintDatabaseTableColumn::create($name) ->length(1) ->notNull() ->defaultValue(1); } + + private function __construct() + { + } } diff --git a/wcfsetup/install/files/lib/system/database/table/column/NotNullInt10DatabaseTableColumn.class.php b/wcfsetup/install/files/lib/system/database/table/column/NotNullInt10DatabaseTableColumn.class.php index 78aace3686..0fe91517d5 100644 --- a/wcfsetup/install/files/lib/system/database/table/column/NotNullInt10DatabaseTableColumn.class.php +++ b/wcfsetup/install/files/lib/system/database/table/column/NotNullInt10DatabaseTableColumn.class.php @@ -11,15 +11,19 @@ namespace wcf\system\database\table\column; * @package WoltLabSuite\Core\System\Database\Table\Column * @since 5.2 */ -class NotNullInt10DatabaseTableColumn extends IntDatabaseTableColumn +final class NotNullInt10DatabaseTableColumn { /** * @inheritDoc */ public static function create($name) { - return parent::create($name) + return IntDatabaseTableColumn::create($name) ->notNull() ->length(10); } + + private function __construct() + { + } } diff --git a/wcfsetup/install/files/lib/system/database/table/column/NotNullVarchar191DatabaseTableColumn.class.php b/wcfsetup/install/files/lib/system/database/table/column/NotNullVarchar191DatabaseTableColumn.class.php index 19d54c1807..0c9b0a7ee1 100644 --- a/wcfsetup/install/files/lib/system/database/table/column/NotNullVarchar191DatabaseTableColumn.class.php +++ b/wcfsetup/install/files/lib/system/database/table/column/NotNullVarchar191DatabaseTableColumn.class.php @@ -11,15 +11,19 @@ namespace wcf\system\database\table\column; * @package WoltLabSuite\Core\System\Database\Table\Column * @since 5.2 */ -class NotNullVarchar191DatabaseTableColumn extends VarcharDatabaseTableColumn +final class NotNullVarchar191DatabaseTableColumn { /** * @inheritDoc */ public static function create($name) { - return parent::create($name) + return VarcharDatabaseTableColumn::create($name) ->notNull() ->length(191); } + + private function __construct() + { + } } diff --git a/wcfsetup/install/files/lib/system/database/table/column/NotNullVarchar255DatabaseTableColumn.class.php b/wcfsetup/install/files/lib/system/database/table/column/NotNullVarchar255DatabaseTableColumn.class.php index 24b565e9de..874b89994a 100644 --- a/wcfsetup/install/files/lib/system/database/table/column/NotNullVarchar255DatabaseTableColumn.class.php +++ b/wcfsetup/install/files/lib/system/database/table/column/NotNullVarchar255DatabaseTableColumn.class.php @@ -11,15 +11,19 @@ namespace wcf\system\database\table\column; * @package WoltLabSuite\Core\System\Database\Table\Column * @since 5.2 */ -class NotNullVarchar255DatabaseTableColumn extends VarcharDatabaseTableColumn +final class NotNullVarchar255DatabaseTableColumn { /** * @inheritDoc */ public static function create($name) { - return parent::create($name) + return VarcharDatabaseTableColumn::create($name) ->notNull() ->length(255); } + + private function __construct() + { + } } diff --git a/wcfsetup/install/files/lib/system/database/table/column/ObjectIdDatabaseTableColumn.class.php b/wcfsetup/install/files/lib/system/database/table/column/ObjectIdDatabaseTableColumn.class.php index 33bd990abd..3f3eb8adb6 100644 --- a/wcfsetup/install/files/lib/system/database/table/column/ObjectIdDatabaseTableColumn.class.php +++ b/wcfsetup/install/files/lib/system/database/table/column/ObjectIdDatabaseTableColumn.class.php @@ -14,14 +14,18 @@ namespace wcf\system\database\table\column; * @package WoltLabSuite\Core\System\Database\Table\Column * @since 5.2 */ -class ObjectIdDatabaseTableColumn extends NotNullInt10DatabaseTableColumn +final class ObjectIdDatabaseTableColumn { /** * @inheritDoc */ public static function create($name) { - return parent::create($name) + return NotNullInt10DatabaseTableColumn::create($name) ->autoIncrement(); } + + private function __construct() + { + } }