From 524c86720b2c4e753b6eaa091d251c17ca5fcca0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20D=C3=BCsterhus?= Date: Mon, 8 Nov 2021 15:32:17 +0100 Subject: [PATCH] Remove static methods from form builder interfaces Resolves #4468 --- .../system/form/builder/IFormNode.class.php | 37 ------------------- .../field/IAttributeFormField.class.php | 7 ---- .../AbstractFormFieldDependency.class.php | 8 +++- .../dependency/IFormFieldDependency.class.php | 10 ----- .../validation/FormFieldValidator.class.php | 6 ++- .../validation/IFormFieldValidator.class.php | 9 ----- 6 files changed, 11 insertions(+), 66 deletions(-) diff --git a/wcfsetup/install/files/lib/system/form/builder/IFormNode.class.php b/wcfsetup/install/files/lib/system/form/builder/IFormNode.class.php index 34d15223f7d..224a53091cb 100644 --- a/wcfsetup/install/files/lib/system/form/builder/IFormNode.class.php +++ b/wcfsetup/install/files/lib/system/form/builder/IFormNode.class.php @@ -286,41 +286,4 @@ public function removeDependency($dependencyId); * nodes are valid. A `IFormField` object is valid if its value is valid. */ public function validate(); - - /** - * Creates a new element with the given id. - * - * @param string $id node id - * @return static this node - * - * @throws \InvalidArgumentException if the given id is already used by another element or otherwise is invalid - */ - public static function create($id); - - /** - * Checks if the given attribute name class a and a valid attribute name. - * - * @param string $name checked argument name - * - * @throws \InvalidArgumentException if the given attribute name is invalid - */ - public static function validateAttribute($name); - - /** - * Checks if the given parameter class a and a valid node class. - * - * @param string $class checked class - * - * @throws \InvalidArgumentException if the given id is invalid - */ - public static function validateClass($class); - - /** - * Checks if the given parameter is a and a valid node id. - * - * @param string $id checked id - * - * @throws \InvalidArgumentException if the given id is invalid - */ - public static function validateId($id); } diff --git a/wcfsetup/install/files/lib/system/form/builder/field/IAttributeFormField.class.php b/wcfsetup/install/files/lib/system/form/builder/field/IAttributeFormField.class.php index e163790aa93..e093d16c4bd 100644 --- a/wcfsetup/install/files/lib/system/form/builder/field/IAttributeFormField.class.php +++ b/wcfsetup/install/files/lib/system/form/builder/field/IAttributeFormField.class.php @@ -57,11 +57,4 @@ public function hasFieldAttribute(string $name): bool; * @return static this form field */ public function removeFieldAttribute(string $name); - - /** - * Checks if the given name is a valid additional attribute name. - * - * @throws \InvalidArgumentException if the given additional attribute name is invalid - */ - public static function validateFieldAttribute(string $name); } diff --git a/wcfsetup/install/files/lib/system/form/builder/field/dependency/AbstractFormFieldDependency.class.php b/wcfsetup/install/files/lib/system/form/builder/field/dependency/AbstractFormFieldDependency.class.php index 213af182a6d..f7170d0811a 100644 --- a/wcfsetup/install/files/lib/system/form/builder/field/dependency/AbstractFormFieldDependency.class.php +++ b/wcfsetup/install/files/lib/system/form/builder/field/dependency/AbstractFormFieldDependency.class.php @@ -170,8 +170,12 @@ protected function id($id) } /** - * @inheritDoc - * @return static + * Creates a new dependency with the given id. + * + * @param string $id id of the created dependency + * @return static newly created dependency + * + * @throws \InvalidArgumentException if the given id is invalid */ public static function create($id) { diff --git a/wcfsetup/install/files/lib/system/form/builder/field/dependency/IFormFieldDependency.class.php b/wcfsetup/install/files/lib/system/form/builder/field/dependency/IFormFieldDependency.class.php index 0da2568ddfd..cef1485bebb 100644 --- a/wcfsetup/install/files/lib/system/form/builder/field/dependency/IFormFieldDependency.class.php +++ b/wcfsetup/install/files/lib/system/form/builder/field/dependency/IFormFieldDependency.class.php @@ -93,14 +93,4 @@ public function getHtml(); * @return string id of the dependency */ public function getId(); - - /** - * Creates a new dependency with the given id. - * - * @param string $id id of the created dependency - * @return static newly created dependency - * - * @throws \InvalidArgumentException if the given id is invalid - */ - public static function create($id); } diff --git a/wcfsetup/install/files/lib/system/form/builder/field/validation/FormFieldValidator.class.php b/wcfsetup/install/files/lib/system/form/builder/field/validation/FormFieldValidator.class.php index 4ff159c8587..3dfadea9249 100644 --- a/wcfsetup/install/files/lib/system/form/builder/field/validation/FormFieldValidator.class.php +++ b/wcfsetup/install/files/lib/system/form/builder/field/validation/FormFieldValidator.class.php @@ -81,7 +81,11 @@ public function getId() } /** - * @inheritDoc + * Checks if the given parameter is a and a valid validator id. + * + * @param mixed $id checked id + * + * @throws \InvalidArgumentException if the given id is invalid */ public static function validateId($id) { diff --git a/wcfsetup/install/files/lib/system/form/builder/field/validation/IFormFieldValidator.class.php b/wcfsetup/install/files/lib/system/form/builder/field/validation/IFormFieldValidator.class.php index 8b412d42f81..90f2d8ee03d 100644 --- a/wcfsetup/install/files/lib/system/form/builder/field/validation/IFormFieldValidator.class.php +++ b/wcfsetup/install/files/lib/system/form/builder/field/validation/IFormFieldValidator.class.php @@ -38,13 +38,4 @@ public function __invoke(IFormField $field); * @return string id of the dependency */ public function getId(); - - /** - * Checks if the given parameter is a and a valid validator id. - * - * @param mixed $id checked id - * - * @throws \InvalidArgumentException if the given id is invalid - */ - public static function validateId($id); }