From 020e657088950e62373bfa1f126ef1891ee76bce Mon Sep 17 00:00:00 2001 From: Matthias Schmidt Date: Sat, 21 Jul 2018 10:51:46 +0200 Subject: [PATCH] Remove scalar type hints from form builder API See #2509 See #2720 --- .../form/builder/DialogFormDocument.class.php | 2 +- .../form/builder/FormDocument.class.php | 14 ++++---- .../form/builder/IFormDocument.class.php | 14 ++++---- .../form/builder/IFormElement.class.php | 4 +-- .../system/form/builder/IFormNode.class.php | 34 +++++++++---------- .../form/builder/IFormParentNode.class.php | 6 ++-- .../form/builder/TFormElement.class.php | 8 ++--- .../system/form/builder/TFormNode.class.php | 34 +++++++++---------- .../form/builder/TFormParentNode.class.php | 6 ++-- .../builder/field/AbstractFormField.class.php | 16 ++++----- .../field/AbstractNumericFormField.class.php | 2 +- .../form/builder/field/AclFormField.class.php | 2 +- .../field/ClassNameFormField.class.php | 18 +++++----- .../form/builder/field/IFormField.class.php | 14 ++++---- .../builder/field/II18nFormField.class.php | 6 ++-- .../field/IMaximumLengthFormField.class.php | 4 +-- .../field/IMinimumLengthFormField.class.php | 4 +-- .../field/IMultipleFormField.class.php | 6 ++-- .../field/INullableFormField.class.php | 2 +- .../field/IObjectTypeFormField.class.php | 2 +- .../field/IPlaceholderFormField.class.php | 2 +- .../field/ISelectionFormField.class.php | 2 +- .../field/ISuffixedFormField.class.php | 2 +- .../builder/field/ItemListFormField.class.php | 2 +- .../field/MultilineTextFormField.class.php | 2 +- .../field/ShowOrderFormField.class.php | 2 +- .../field/TDefaultIdFormField.class.php | 2 +- .../builder/field/TI18nFormField.class.php | 12 +++---- .../field/TMaximumLengthFormField.class.php | 4 +-- .../field/TMinimumLengthFormField.class.php | 4 +-- .../field/TMultipleFormField.class.php | 6 ++-- .../field/TNullableFormField.class.php | 2 +- .../field/TObjectTypeFormField.class.php | 2 +- .../field/TPlaceholderFormField.class.php | 4 +-- .../field/TSelectionFormField.class.php | 2 +- .../field/TSuffixedFormField.class.php | 4 +-- .../builder/field/TextFormField.class.php | 2 +- .../builder/field/WysiwygFormField.class.php | 6 ++-- .../CustomFormFieldDataProcessor.class.php | 2 +- .../AbstractFormFieldDependency.class.php | 6 ++-- .../dependency/IFormFieldDependency.class.php | 2 +- .../ValueFormFieldDependency.class.php | 2 +- .../FormFieldValidationError.class.php | 2 +- .../validation/FormFieldValidator.class.php | 6 ++-- .../FormFieldValidatorUtil.class.php | 2 +- .../IFormFieldValidationError.class.php | 2 +- .../validation/IFormFieldValidator.class.php | 6 ++-- 47 files changed, 145 insertions(+), 145 deletions(-) diff --git a/wcfsetup/install/files/lib/system/form/builder/DialogFormDocument.class.php b/wcfsetup/install/files/lib/system/form/builder/DialogFormDocument.class.php index 99d308314c..f40f152f8e 100644 --- a/wcfsetup/install/files/lib/system/form/builder/DialogFormDocument.class.php +++ b/wcfsetup/install/files/lib/system/form/builder/DialogFormDocument.class.php @@ -24,7 +24,7 @@ class DialogFormDocument extends FormDocument { * @param bool $cancelable determines if dialog from can be canceled * @return static this document */ - public function cancelable(bool $cancelable = true) { + public function cancelable($cancelable = true) { $this->__isCancelable = $cancelable; return $this; diff --git a/wcfsetup/install/files/lib/system/form/builder/FormDocument.class.php b/wcfsetup/install/files/lib/system/form/builder/FormDocument.class.php index 5022926b3b..5467a4e16a 100644 --- a/wcfsetup/install/files/lib/system/form/builder/FormDocument.class.php +++ b/wcfsetup/install/files/lib/system/form/builder/FormDocument.class.php @@ -60,7 +60,7 @@ class FormDocument implements IFormDocument { /** * encoding type of this form - * @var null|string + * @var null| */ protected $enctype = ''; @@ -73,7 +73,7 @@ class FormDocument implements IFormDocument { /** * @inheritDoc */ - public function action(string $action) { + public function action($action) { $this->__action = $action; return $this; @@ -114,7 +114,7 @@ class FormDocument implements IFormDocument { /** * @inheritDoc */ - public function formMode(string $formMode) { + public function formMode($formMode) { if ($this->__formMode !== null) { throw new \BadMethodCallException("Form mode has already been set"); } @@ -228,7 +228,7 @@ class FormDocument implements IFormDocument { /** * @inheritDoc */ - public function getRequestData(string $index = null) { + public function getRequestData($index = null) { if ($this->__requestData === null) { $this->__requestData = $_POST; } @@ -247,7 +247,7 @@ class FormDocument implements IFormDocument { /** * @inheritDoc */ - public function hasRequestData(string $index = null) { + public function hasRequestData($index = null) { $requestData = $this->getRequestData(); if ($index !== null) { @@ -290,7 +290,7 @@ class FormDocument implements IFormDocument { /** * @inheritDoc */ - public function method(string $method) { + public function method($method) { if ($method !== 'get' && $method !== 'post') { throw new \InvalidArgumentException("Invalid method '{$method}' given."); } @@ -303,7 +303,7 @@ class FormDocument implements IFormDocument { /** * @inheritDoc */ - public function prefix(string $prefix) { + public function prefix($prefix) { static::validateId($prefix); $this->__prefix = $prefix; diff --git a/wcfsetup/install/files/lib/system/form/builder/IFormDocument.class.php b/wcfsetup/install/files/lib/system/form/builder/IFormDocument.class.php index cc2febb99f..1d6bbe247d 100644 --- a/wcfsetup/install/files/lib/system/form/builder/IFormDocument.class.php +++ b/wcfsetup/install/files/lib/system/form/builder/IFormDocument.class.php @@ -32,7 +32,7 @@ interface IFormDocument extends IFormParentNode { * * @throws \InvalidArgumentException if the given action is invalid */ - public function action(string $action); + public function action($action); /** * Is called once after all nodes have been added to this document. @@ -56,7 +56,7 @@ interface IFormDocument extends IFormParentNode { * @throws \BadMethodCallException if the form mode has already been set * @throws \InvalidArgumentException if the given form mode is invalid */ - public function formMode(string $formMode); + public function formMode($formMode); /** * Returns the `action` property of the HTML `form` element. @@ -117,7 +117,7 @@ interface IFormDocument extends IFormParentNode { /** * Returns the global form prefix that is prepended to form elements' names and ids to - * avoid conflicts with other forms. If no prefix has been set, an empty string is returned. + * avoid conflicts with other forms. If no prefix has been set, an empty is returned. * * Note: If a prefix `foo` has been set, this method returns `foo_`. * @@ -135,7 +135,7 @@ interface IFormDocument extends IFormParentNode { * * @throws \InvalidArgumentException if invalid index is given */ - public function getRequestData(string $index = null); + public function getRequestData($index = null); /** * Returns `true` if there is any request data or, if a parameter is given, if @@ -146,7 +146,7 @@ interface IFormDocument extends IFormParentNode { * @param null|string $index array index of the returned data * @return bool `tu */ - public function hasRequestData(string $index = null); + public function hasRequestData($index = null); /** * Loads the field values from the given object and returns this document. @@ -167,7 +167,7 @@ interface IFormDocument extends IFormParentNode { * * @throws \InvalidArgumentException if the given method is invalid */ - public function method(string $method); + public function method($method); /** * Sets the global form prefix that is prepended to form elements' names and ids to @@ -181,7 +181,7 @@ interface IFormDocument extends IFormParentNode { * * @throws \InvalidArgumentException if the given prefix is invalid */ - public function prefix(string $prefix); + public function prefix($prefix); /** * Sets the request data of the form's fields. diff --git a/wcfsetup/install/files/lib/system/form/builder/IFormElement.class.php b/wcfsetup/install/files/lib/system/form/builder/IFormElement.class.php index c60ea858d5..6d269a0a81 100644 --- a/wcfsetup/install/files/lib/system/form/builder/IFormElement.class.php +++ b/wcfsetup/install/files/lib/system/form/builder/IFormElement.class.php @@ -22,7 +22,7 @@ interface IFormElement extends IFormNode { * * @throws \InvalidArgumentException if the given description is invalid */ - public function description(string $languageItem = null, array $variables = []); + public function description($languageItem = null, array $variables = []); /** * Returns the description of this element or `null` if no description has been set. @@ -49,7 +49,7 @@ interface IFormElement extends IFormNode { * * @throws \InvalidArgumentException if the given label is invalid */ - public function label(string $languageItem = null, array $variables = []); + public function label($languageItem = null, array $variables = []); /** * Returns `true` if this element requires a label to be set. 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 97b4b1a3be..b21276f382 100644 --- a/wcfsetup/install/files/lib/system/form/builder/IFormNode.class.php +++ b/wcfsetup/install/files/lib/system/form/builder/IFormNode.class.php @@ -20,7 +20,7 @@ interface IFormNode { * * @throws \InvalidArgumentException if the given class is invalid */ - public function addClass(string $class); + public function addClass($class); /** * Adds a dependency on the value of a `IFormField` so that this node is @@ -46,7 +46,7 @@ interface IFormNode { * * @throws \InvalidArgumentException if an invalid name or value is given (some attribute names are invalid as there are specific methods for setting that attribute) */ - public function attribute(string $name, string $value = null); + public function attribute($name, $value = null); /** * Sets if this node is available and returns this node. @@ -68,7 +68,7 @@ interface IFormNode { * @param bool $available determines if node is available * @return static this node */ - public function available(bool $available = true); + public function available($available = true); /** * Returns `true` if the node's dependencies are met and returns `false` otherwise. @@ -85,7 +85,7 @@ interface IFormNode { * * @throws \InvalidArgumentException if the given name is invalid or no such attribute exists */ - public function getAttribute(string $name); + public function getAttribute($name); /** * Returns additional attributes of this node. @@ -163,7 +163,7 @@ interface IFormNode { * * @throws \InvalidArgumentException if the given attribute name is invalid */ - public function hasAttribute(string $name); + public function hasAttribute($name); /** * Returns `true` if a CSS class with the given name exists and returns `false` otherwise. @@ -173,7 +173,7 @@ interface IFormNode { * * @throws \InvalidArgumentException if the given class is invalid */ - public function hasClass(string $class); + public function hasClass($class); /** * Returns `true` if this node has a dependency with the given id and @@ -184,7 +184,7 @@ interface IFormNode { * * @throws \InvalidArgumentException if the given id is invalid */ - public function hasDependency(string $dependencyId); + public function hasDependency($dependencyId); /** * Sets the id of the node. @@ -195,7 +195,7 @@ interface IFormNode { * @throws \BadMethodCallException if id has already been set * @throws \InvalidArgumentException if the given id is invalid */ - public function id(string $id); + public function id($id); /** * Returns `true` if this node is available and returns `false` otherwise. @@ -231,7 +231,7 @@ interface IFormNode { * * @throws \InvalidArgumentException if the given class is invalid */ - public function removeClass(string $class); + public function removeClass($class); /** * Removes the dependency with the given id and returns this node. @@ -241,7 +241,7 @@ interface IFormNode { * * @throws \InvalidArgumentException if the given id is invalid or no such dependency exists */ - public function removeDependency(string $dependencyId); + public function removeDependency($dependencyId); /** * Validates the node. @@ -259,32 +259,32 @@ interface IFormNode { * * @throws \InvalidArgumentException if the given id is already used by another element or otherwise is invalid */ - public static function create(string $id); + public static function create($id); /** - * Checks if the given attribute name class a string and a valid attribute name. + * 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(string $name); + public static function validateAttribute($name); /** - * Checks if the given parameter class a string and a valid node class. + * 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(string $class); + public static function validateClass($class); /** - * Checks if the given parameter is a string and a valid node id. + * 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(string $id); + public static function validateId($id); } diff --git a/wcfsetup/install/files/lib/system/form/builder/IFormParentNode.class.php b/wcfsetup/install/files/lib/system/form/builder/IFormParentNode.class.php index 1e967dbf6a..2b8935246a 100644 --- a/wcfsetup/install/files/lib/system/form/builder/IFormParentNode.class.php +++ b/wcfsetup/install/files/lib/system/form/builder/IFormParentNode.class.php @@ -45,7 +45,7 @@ interface IFormParentNode extends \Countable, IFormNode, \RecursiveIterator { * @param string $nodeId id of searched node * @return bool */ - public function contains(string $nodeId); + public function contains($nodeId); /** * Returns a recursive iterator for this node. @@ -67,7 +67,7 @@ interface IFormParentNode extends \Countable, IFormNode, \RecursiveIterator { * * @throws \InvalidArgumentException if the given id is invalid */ - public function getNodeById(string $nodeId); + public function getNodeById($nodeId); /** * Returns `true` if this node or any of its children has a validation error and @@ -86,7 +86,7 @@ interface IFormParentNode extends \Countable, IFormNode, \RecursiveIterator { * * @throws \InvalidArgumentException if given node cannot be inserted or reference node id is invalid */ - public function insertBefore(IFormChildNode $child, string $referenceNodeId); + public function insertBefore(IFormChildNode $child, $referenceNodeId); /** * Reads the value of this node and its children from request data and diff --git a/wcfsetup/install/files/lib/system/form/builder/TFormElement.class.php b/wcfsetup/install/files/lib/system/form/builder/TFormElement.class.php index 5d70c17c9a..6cd382f966 100644 --- a/wcfsetup/install/files/lib/system/form/builder/TFormElement.class.php +++ b/wcfsetup/install/files/lib/system/form/builder/TFormElement.class.php @@ -35,9 +35,9 @@ trait TFormElement { * @param array $variables additional variables used when resolving the language item * @return static this element * - * @throws \InvalidArgumentException if the given description is no string or otherwise is invalid + * @throws \InvalidArgumentException if the given description is no or otherwise is invalid */ - public function description(string $languageItem = null, array $variables = []) { + public function description($languageItem = null, array $variables = []) { if ($languageItem === null) { if (!empty($variables)) { throw new \InvalidArgumentException("Cannot use variables when unsetting description of element '{$this->getId()}'"); @@ -83,9 +83,9 @@ trait TFormElement { * @param array $variables additional variables used when resolving the language item * @return static this element * - * @throws \InvalidArgumentException if the given label is no string or otherwise is invalid + * @throws \InvalidArgumentException if the given label is no or otherwise is invalid */ - public function label(string $languageItem = null, array $variables = []) { + public function label($languageItem = null, array $variables = []) { if ($languageItem === null) { if (!empty($variables)) { throw new \InvalidArgumentException("Cannot use variables when unsetting label of element '{$this->getId()}'"); diff --git a/wcfsetup/install/files/lib/system/form/builder/TFormNode.class.php b/wcfsetup/install/files/lib/system/form/builder/TFormNode.class.php index 2f5354f9f0..fd6838261e 100644 --- a/wcfsetup/install/files/lib/system/form/builder/TFormNode.class.php +++ b/wcfsetup/install/files/lib/system/form/builder/TFormNode.class.php @@ -62,7 +62,7 @@ trait TFormNode { * * @throws \InvalidArgumentException if the given class is invalid */ - public function addClass(string $class) { + public function addClass($class) { static::validateClass($class); if (!in_array($class, $this->__classes)) { @@ -102,7 +102,7 @@ trait TFormNode { * * @throws \InvalidArgumentException if an invalid name or value is given (some attribute names are invalid as there are specific methods for setting that attribute) */ - public function attribute(string $name, string $value = null) { + public function attribute($name, $value = null) { static::validateAttribute($name); if ($value !== null && !is_bool($value) && !is_numeric($value) && !is_string($value)) { @@ -134,7 +134,7 @@ trait TFormNode { * @param bool $available determines if node is available * @return static this node */ - public function available(bool $available = true) { + public function available($available = true) { $this->__available = $available; return $this; @@ -181,7 +181,7 @@ trait TFormNode { * * @throws \InvalidArgumentException if the given name is invalid or no such attribute exists */ - public function getAttribute(string $name) { + public function getAttribute($name) { if (!$this->hasAttribute($name)) { throw new \InvalidArgumentException("Unknown attribute '{$name}' requested."); } @@ -274,7 +274,7 @@ trait TFormNode { * * @throws \InvalidArgumentException if the given attribute name is invalid */ - public function hasAttribute(string $name) { + public function hasAttribute($name) { static::validateAttribute($name); return isset($this->__attributes[$name]); @@ -288,7 +288,7 @@ trait TFormNode { * * @throws \InvalidArgumentException if the given class is invalid */ - public function hasClass(string $class) { + public function hasClass($class) { static::validateClass($class); return array_search($class, $this->__classes) !== false; @@ -303,7 +303,7 @@ trait TFormNode { * * @throws \InvalidArgumentException if the given id is invalid */ - public function hasDependency(string $dependencyId) { + public function hasDependency($dependencyId) { foreach ($this->dependencies as $dependency) { if ($dependency->getId() === $dependencyId) { return true; @@ -322,7 +322,7 @@ trait TFormNode { * @throws \BadMethodCallException if id has already been set * @throws \InvalidArgumentException if the given id is invalid */ - public function id(string $id) { + public function id($id) { static::validateId($id); if ($this->__id !== null) { @@ -390,7 +390,7 @@ trait TFormNode { * * @throws \InvalidArgumentException if the given class is invalid */ - public function removeClass(string $class) { + public function removeClass($class) { static::validateClass($class); $index = array_search($class, $this->__classes); @@ -409,7 +409,7 @@ trait TFormNode { * * @throws \InvalidArgumentException if the given id is invalid or no such dependency exists */ - public function removeDependency(string $dependencyId) { + public function removeDependency($dependencyId) { foreach ($this->dependencies as $key => $dependency) { if ($dependency->getId() === $dependencyId) { unset($this->dependencies[$key]); @@ -429,31 +429,31 @@ trait TFormNode { * * @throws \InvalidArgumentException if the given id is already used by another node, or otherwise is invalid */ - public static function create(string $id) { + public static function create($id) { return (new static)->id($id); } /** - * Checks if the given attribute name class a string and a valid attribute name. + * 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(string $name) { + public static function validateAttribute($name) { if (preg_match('~^[_A-z][_A-z0-9-]*$~', $name) !== 1) { throw new \InvalidArgumentException("Invalid name '{$name}' given."); } } /** - * Checks if the given parameter class a string and a valid node class. + * Checks if the given parameter class a and a valid node class. * * @param string $class checked id * * @throws \InvalidArgumentException if the given id is invalid */ - public static function validateClass(string $class) { + public static function validateClass($class) { // regular expression is a more restrictive version of // (https://www.w3.org/TR/2011/REC-css3-selectors-20110929/#w3cselgrammar) if (preg_match('~^-?[_A-z][_A-z0-9-]*$~', $class) !== 1) { @@ -462,13 +462,13 @@ trait TFormNode { } /** - * Checks if the given parameter is a string and a valid node id. + * 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(string $id) { + public static function validateId($id) { // regular expression is a more restrictive version of // https://www.w3.org/TR/CSS21/syndata.html#value-def-identifier if (preg_match('~^-?[_A-z][_A-z0-9-]*$~', $id) !== 1) { diff --git a/wcfsetup/install/files/lib/system/form/builder/TFormParentNode.class.php b/wcfsetup/install/files/lib/system/form/builder/TFormParentNode.class.php index 32746dbc1d..c7ef7f2936 100644 --- a/wcfsetup/install/files/lib/system/form/builder/TFormParentNode.class.php +++ b/wcfsetup/install/files/lib/system/form/builder/TFormParentNode.class.php @@ -65,7 +65,7 @@ trait TFormParentNode { * @param string $nodeId id of searched node * @return bool */ - public function contains(string $nodeId) { + public function contains($nodeId) { static::validateId($nodeId); foreach ($this->children() as $child) { @@ -145,7 +145,7 @@ trait TFormParentNode { * * @throws \InvalidArgumentException if the given id is invalid */ - public function getNodeById(string $nodeId) { + public function getNodeById($nodeId) { static::validateId($nodeId); foreach ($this->children() as $child) { @@ -205,7 +205,7 @@ trait TFormParentNode { * * @throws \InvalidArgumentException if given node cannot be inserted or reference node id is invalid */ - public function insertBefore(IFormChildNode $child, string $referenceNodeId) { + public function insertBefore(IFormChildNode $child, $referenceNodeId) { $didInsertNode = false; foreach ($this->children() as $index => $existingChild) { if ($existingChild->getId() === $referenceNodeId) { diff --git a/wcfsetup/install/files/lib/system/form/builder/field/AbstractFormField.class.php b/wcfsetup/install/files/lib/system/form/builder/field/AbstractFormField.class.php index 064cd647e0..ec20dd66bd 100644 --- a/wcfsetup/install/files/lib/system/form/builder/field/AbstractFormField.class.php +++ b/wcfsetup/install/files/lib/system/form/builder/field/AbstractFormField.class.php @@ -23,7 +23,7 @@ abstract class AbstractFormField implements IFormField { /** * `true` if this field is auto-focused and `false` otherwise - * @var bool + * @var bool */ protected $__autoFocus = false; @@ -53,7 +53,7 @@ abstract class AbstractFormField implements IFormField { /** * name of the template used to output this field - * @var string + * @var string */ protected $templateName; @@ -98,7 +98,7 @@ abstract class AbstractFormField implements IFormField { /** * @inheritDoc */ - public function autoFocus(bool $autoFocus = true) { + public function autoFocus($autoFocus = true) { $this->__autoFocus = $autoFocus; return $this; @@ -166,7 +166,7 @@ abstract class AbstractFormField implements IFormField { /** * @inheritDoc */ - public function hasValidator(string $validatorId) { + public function hasValidator($validatorId) { FormFieldValidator::validateId($validatorId); return isset($this->validators[$validatorId]); @@ -182,7 +182,7 @@ abstract class AbstractFormField implements IFormField { /** * @inheritDoc */ - public function immutable(bool $immutable = true) { + public function immutable($immutable = true) { $this->__immutable = $immutable; return $this; @@ -224,7 +224,7 @@ abstract class AbstractFormField implements IFormField { * @inheritDoc * @return static */ - public function objectProperty(string $objectProperty) { + public function objectProperty($objectProperty) { if ($objectProperty === '') { $this->__objectProperty = null; } @@ -240,7 +240,7 @@ abstract class AbstractFormField implements IFormField { /** * @inheritDoc */ - public function removeValidator(string $validatorId) { + public function removeValidator($validatorId) { if (!$this->hasValidator($validatorId)) { throw new \InvalidArgumentException("Unknown validator with id '{$validatorId}'"); } @@ -254,7 +254,7 @@ abstract class AbstractFormField implements IFormField { * @inheritDoc * @return static */ - public function required(bool $required = true) { + public function required($required = true) { $this->__required = $required; return $this; diff --git a/wcfsetup/install/files/lib/system/form/builder/field/AbstractNumericFormField.class.php b/wcfsetup/install/files/lib/system/form/builder/field/AbstractNumericFormField.class.php index b88097ec7c..28c82d1360 100644 --- a/wcfsetup/install/files/lib/system/form/builder/field/AbstractNumericFormField.class.php +++ b/wcfsetup/install/files/lib/system/form/builder/field/AbstractNumericFormField.class.php @@ -119,7 +119,7 @@ abstract class AbstractNumericFormField extends AbstractFormField implements IMa } else { if (is_string($step) && $step !== 'any') { - throw new \InvalidArgumentException("The only valid string step value is 'any', '" . $step . "' given."); + throw new \InvalidArgumentException("The only valid step value is 'any', '" . $step . "' given."); } else if (!is_numeric($step)) { throw new \InvalidArgumentException("Given step is no number, '" . gettype($step) . "' given."); diff --git a/wcfsetup/install/files/lib/system/form/builder/field/AclFormField.class.php b/wcfsetup/install/files/lib/system/form/builder/field/AclFormField.class.php index 8aecf22ff8..bd5c2c9c2a 100644 --- a/wcfsetup/install/files/lib/system/form/builder/field/AclFormField.class.php +++ b/wcfsetup/install/files/lib/system/form/builder/field/AclFormField.class.php @@ -50,7 +50,7 @@ class AclFormField extends AbstractFormField implements IObjectTypeFormField { * * @throws \InvalidArgumentException if given category name is invalid */ - public function categoryName(string $categoryName) { + public function categoryName($categoryName) { // TODO: validation $this->__categoryName = $categoryName; diff --git a/wcfsetup/install/files/lib/system/form/builder/field/ClassNameFormField.class.php b/wcfsetup/install/files/lib/system/form/builder/field/ClassNameFormField.class.php index 20ed4097b8..53ae5183bc 100644 --- a/wcfsetup/install/files/lib/system/form/builder/field/ClassNameFormField.class.php +++ b/wcfsetup/install/files/lib/system/form/builder/field/ClassNameFormField.class.php @@ -56,7 +56,7 @@ class ClassNameFormField extends TextFormField { * @param bool $classExists determines if entered class must exist * @return static this field */ - public function classExists(bool $classExists = true) { + public function classExists($classExists = true) { $this->__classExists = $classExists; return $this; @@ -73,9 +73,9 @@ class ClassNameFormField extends TextFormField { } /** - * Returns class the entered class must extend or an empty string if the + * Returns class the entered class must extend or an empty if the * entered class does not have to extend any specific class. By default, - * an empty string is returned. + * an empty is returned. * * @return string */ @@ -85,8 +85,8 @@ class ClassNameFormField extends TextFormField { /** * Returns name of the interface the entered class must implement or an - * empty string if the entered class does not have to implement any specific - * interface. By default, an empty string is returned. + * empty if the entered class does not have to implement any specific + * interface. By default, an empty is returned. * * @return string */ @@ -106,7 +106,7 @@ class ClassNameFormField extends TextFormField { * * @throws \InvalidArgumentException if the entered interface does not exists */ - public function implementedInterface(string $interface) { + public function implementedInterface($interface) { if (!interface_exists($interface)) { throw new \InvalidArgumentException("Interface '{$interface}' does not exist."); } @@ -129,7 +129,7 @@ class ClassNameFormField extends TextFormField { * @param bool $instantiable determines if entered class must be instantiable * @return static this field */ - public function instantiable(bool $instantiable = true) { + public function instantiable($instantiable = true) { $this->__instantiable = $instantiable; return $this; @@ -153,7 +153,7 @@ class ClassNameFormField extends TextFormField { * * @throws \InvalidArgumentException if the entered class does not exists */ - public function parentClass(string $parentClass) { + public function parentClass($parentClass) { if (!class_exists($parentClass)) { throw new \InvalidArgumentException("Class '{$parentClass}' does not exist."); } @@ -166,7 +166,7 @@ class ClassNameFormField extends TextFormField { /** * @inheritDoc */ - protected function validateText(string $text, Language $language = null) { + protected function validateText($text, Language $language = null) { parent::validateText($text, $language); if (empty($this->getValidationErrors())) { diff --git a/wcfsetup/install/files/lib/system/form/builder/field/IFormField.class.php b/wcfsetup/install/files/lib/system/form/builder/field/IFormField.class.php index 1402a99c2b..f516e54f09 100644 --- a/wcfsetup/install/files/lib/system/form/builder/field/IFormField.class.php +++ b/wcfsetup/install/files/lib/system/form/builder/field/IFormField.class.php @@ -30,7 +30,7 @@ interface IFormField extends IFormChildNode, IFormElement { * @param bool $autoFocus determines if field is auto-focused * @return static this field */ - public function autoFocus(bool $autoFocus = true); + public function autoFocus($autoFocus = true); /** * Adds the given validation error to this field and returns this field. @@ -92,7 +92,7 @@ interface IFormField extends IFormChildNode, IFormElement { * * @throws \InvalidArgumentException if the given id is invalid */ - public function hasValidator(string $validatorId); + public function hasValidator($validatorId); /** * Returns `true` if this field provides a value that can simply be stored @@ -113,7 +113,7 @@ interface IFormField extends IFormChildNode, IFormElement { * @param bool $immutable determines if field value is immutable * @return static this field */ - public function immutable(bool $immutable = true); + public function immutable($immutable = true); /** * Returns `true` if this field is auto-focused and returns `false` otherwise. @@ -149,7 +149,7 @@ interface IFormField extends IFormChildNode, IFormElement { /** * Sets the name of the object property this field represents. If an empty - * string is passed, the object property is unset. + * is passed, the object property is unset. * * The object property allows having different fields (requiring different ids) * that represent the same object property which is handy when available options @@ -162,7 +162,7 @@ interface IFormField extends IFormChildNode, IFormElement { * * @throws \InvalidArgumentException if the passed object property is no valid id */ - public function objectProperty(string $objectProperty); + public function objectProperty($objectProperty); /** * Reads the value of this field from request data and return this field. @@ -179,7 +179,7 @@ interface IFormField extends IFormChildNode, IFormElement { * * @throws \InvalidArgumentException if the given id is invalid or no such validator exists */ - public function removeValidator(string $validatorId); + public function removeValidator($validatorId); /** * Sets whether it is required to fill out this field and returns this field. @@ -187,7 +187,7 @@ interface IFormField extends IFormChildNode, IFormElement { * @param bool $required determines if field has to be filled out * @return static this field */ - public function required(bool $required = true); + public function required($required = true); /** * Sets the value of this field and returns this field. diff --git a/wcfsetup/install/files/lib/system/form/builder/field/II18nFormField.class.php b/wcfsetup/install/files/lib/system/form/builder/field/II18nFormField.class.php index 877aede9a3..54b54f434f 100644 --- a/wcfsetup/install/files/lib/system/form/builder/field/II18nFormField.class.php +++ b/wcfsetup/install/files/lib/system/form/builder/field/II18nFormField.class.php @@ -42,7 +42,7 @@ interface II18nFormField extends IFormField { * @param bool $i18n determines if field is supports i18n input * @return static this field */ - public function i18n(bool $i18n = true); + public function i18n($i18n = true); /** * Sets whether this field's value must be i18n input and returns this field. @@ -53,7 +53,7 @@ interface II18nFormField extends IFormField { * @param bool $i18nRequired determines if field value must be i18n input * @return static this field */ - public function i18nRequired(bool $i18nRequired = true); + public function i18nRequired($i18nRequired = true); /** * Returns `true` if this field supports i18n input and returns `false` otherwise. @@ -81,5 +81,5 @@ interface II18nFormField extends IFormField { * @throws \BadMethodCallException if i18n is disabled for this field * @throws \InvalidArgumentException if the given pattern is invalid */ - public function languageItemPattern(string $pattern); + public function languageItemPattern($pattern); } diff --git a/wcfsetup/install/files/lib/system/form/builder/field/IMaximumLengthFormField.class.php b/wcfsetup/install/files/lib/system/form/builder/field/IMaximumLengthFormField.class.php index 1a851dcf0b..064feaf271 100644 --- a/wcfsetup/install/files/lib/system/form/builder/field/IMaximumLengthFormField.class.php +++ b/wcfsetup/install/files/lib/system/form/builder/field/IMaximumLengthFormField.class.php @@ -29,7 +29,7 @@ interface IMaximumLengthFormField { * * @throws \InvalidArgumentException if the given maximum length is no integer or otherwise invalid */ - public function maximumLength(int $maximumLength = null); + public function maximumLength($maximumLength = null); /** * Validates the maximum length of the given text. @@ -37,5 +37,5 @@ interface IMaximumLengthFormField { * @param string $text validated text * @param null|Language $language language of the validated text */ - public function validateMaximumLength(string $text, Language $language = null); + public function validateMaximumLength($text, Language $language = null); } diff --git a/wcfsetup/install/files/lib/system/form/builder/field/IMinimumLengthFormField.class.php b/wcfsetup/install/files/lib/system/form/builder/field/IMinimumLengthFormField.class.php index 67c50a315e..05188d3b9e 100644 --- a/wcfsetup/install/files/lib/system/form/builder/field/IMinimumLengthFormField.class.php +++ b/wcfsetup/install/files/lib/system/form/builder/field/IMinimumLengthFormField.class.php @@ -29,7 +29,7 @@ interface IMinimumLengthFormField { * * @throws \InvalidArgumentException if the given minimum length is no integer or otherwise invalid */ - public function minimumLength(int $minimumLength = null); + public function minimumLength($minimumLength = null); /** * Validates the minimum length of the given text. @@ -37,5 +37,5 @@ interface IMinimumLengthFormField { * @param string $text validated text * @param null|Language $language language of the validated text */ - public function validateMinimumLength(string $text, Language $language = null); + public function validateMinimumLength($text, Language $language = null); } diff --git a/wcfsetup/install/files/lib/system/form/builder/field/IMultipleFormField.class.php b/wcfsetup/install/files/lib/system/form/builder/field/IMultipleFormField.class.php index 8f07ab50c0..1fa08b6c7b 100644 --- a/wcfsetup/install/files/lib/system/form/builder/field/IMultipleFormField.class.php +++ b/wcfsetup/install/files/lib/system/form/builder/field/IMultipleFormField.class.php @@ -54,7 +54,7 @@ interface IMultipleFormField { * * @throws \InvalidArgumentException if the given maximum number of values is invalid */ - public function maximumMultiples(int $maximum); + public function maximumMultiples($maximum); /** * Sets the minimum number of values that can be selected or set and returns @@ -65,7 +65,7 @@ interface IMultipleFormField { * * @throws \InvalidArgumentException if the given minimum number of values is invalid */ - public function minimumMultiples(int $minimum); + public function minimumMultiples($minimum); /** * Sets whether multiple values can be selected or set and returns this field. @@ -73,5 +73,5 @@ interface IMultipleFormField { * @param bool $multiple determines if multiple values can be selected/set * @return static this field */ - public function multiple(bool $multiple = true); + public function multiple($multiple = true); } diff --git a/wcfsetup/install/files/lib/system/form/builder/field/INullableFormField.class.php b/wcfsetup/install/files/lib/system/form/builder/field/INullableFormField.class.php index acb0a30d80..ed828f28db 100644 --- a/wcfsetup/install/files/lib/system/form/builder/field/INullableFormField.class.php +++ b/wcfsetup/install/files/lib/system/form/builder/field/INullableFormField.class.php @@ -27,5 +27,5 @@ interface INullableFormField { * @param bool $nullable determines if field supports `null` as its value * @return static this node */ - public function nullable(bool $nullable = true); + public function nullable($nullable = true); } diff --git a/wcfsetup/install/files/lib/system/form/builder/field/IObjectTypeFormField.class.php b/wcfsetup/install/files/lib/system/form/builder/field/IObjectTypeFormField.class.php index 6b82a8732a..e26aa1557b 100644 --- a/wcfsetup/install/files/lib/system/form/builder/field/IObjectTypeFormField.class.php +++ b/wcfsetup/install/files/lib/system/form/builder/field/IObjectTypeFormField.class.php @@ -32,7 +32,7 @@ interface IObjectTypeFormField { * @throws \UnexpectedValueException if object type definition returned by `getObjectTypeDefinition()` is unknown * @throws InvalidObjectTypeException if given object type name is invalid */ - public function objectType(string $objectType); + public function objectType($objectType); /** * Returns the name of the object type definition the set object type must be of. diff --git a/wcfsetup/install/files/lib/system/form/builder/field/IPlaceholderFormField.class.php b/wcfsetup/install/files/lib/system/form/builder/field/IPlaceholderFormField.class.php index dcf38cab20..5f6bb43e2a 100644 --- a/wcfsetup/install/files/lib/system/form/builder/field/IPlaceholderFormField.class.php +++ b/wcfsetup/install/files/lib/system/form/builder/field/IPlaceholderFormField.class.php @@ -30,5 +30,5 @@ interface IPlaceholderFormField { * * @throws \InvalidArgumentException if the given value is invalid */ - public function placeholder(string $languageItem = null, array $variables = []); + public function placeholder($languageItem = null, array $variables = []); } diff --git a/wcfsetup/install/files/lib/system/form/builder/field/ISelectionFormField.class.php b/wcfsetup/install/files/lib/system/form/builder/field/ISelectionFormField.class.php index 01bb9e1ace..1ac8410126 100644 --- a/wcfsetup/install/files/lib/system/form/builder/field/ISelectionFormField.class.php +++ b/wcfsetup/install/files/lib/system/form/builder/field/ISelectionFormField.class.php @@ -57,7 +57,7 @@ interface ISelectionFormField { * @throws \InvalidArgumentException if given options are no array or callable or otherwise invalid * @throws \UnexpectedValueException if callable does not return an array */ - public function options($options, bool $nestedOptions = false); + public function options($options, $nestedOptions = false); /** * Returns `true` if the field class supports nested options and `false` otherwise. diff --git a/wcfsetup/install/files/lib/system/form/builder/field/ISuffixedFormField.class.php b/wcfsetup/install/files/lib/system/form/builder/field/ISuffixedFormField.class.php index 10e42ce3ee..29a4972be4 100644 --- a/wcfsetup/install/files/lib/system/form/builder/field/ISuffixedFormField.class.php +++ b/wcfsetup/install/files/lib/system/form/builder/field/ISuffixedFormField.class.php @@ -28,5 +28,5 @@ interface ISuffixedFormField { * * @throws \InvalidArgumentException if the given language item is invalid */ - public function suffix(string $languageItem = null, array $variables = []); + public function suffix($languageItem = null, array $variables = []); } diff --git a/wcfsetup/install/files/lib/system/form/builder/field/ItemListFormField.class.php b/wcfsetup/install/files/lib/system/form/builder/field/ItemListFormField.class.php index e4252ec9bb..c8ec995de0 100644 --- a/wcfsetup/install/files/lib/system/form/builder/field/ItemListFormField.class.php +++ b/wcfsetup/install/files/lib/system/form/builder/field/ItemListFormField.class.php @@ -131,7 +131,7 @@ class ItemListFormField extends AbstractFormField { * @throws \BadMethodCallException if save value type has already been set * @throws \InvalidArgumentException if given save value type is invalid */ - public function saveValueType(string $saveValueType) { + public function saveValueType($saveValueType) { if ($this->saveValueType !== null) { throw new \BadMethodCallException("Save value type has already been set."); } diff --git a/wcfsetup/install/files/lib/system/form/builder/field/MultilineTextFormField.class.php b/wcfsetup/install/files/lib/system/form/builder/field/MultilineTextFormField.class.php index d493f7a306..f85b7c08b2 100644 --- a/wcfsetup/install/files/lib/system/form/builder/field/MultilineTextFormField.class.php +++ b/wcfsetup/install/files/lib/system/form/builder/field/MultilineTextFormField.class.php @@ -40,7 +40,7 @@ class MultilineTextFormField extends TextFormField { * * @throws \InvalidArgumentException if given number of rows is invalid */ - public function rows(int $rows) { + public function rows($rows) { if ($rows <= 0) { throw new \InvalidArgumentException("Given number of rows is not positive."); } diff --git a/wcfsetup/install/files/lib/system/form/builder/field/ShowOrderFormField.class.php b/wcfsetup/install/files/lib/system/form/builder/field/ShowOrderFormField.class.php index 5d957cbc34..2e429f9462 100644 --- a/wcfsetup/install/files/lib/system/form/builder/field/ShowOrderFormField.class.php +++ b/wcfsetup/install/files/lib/system/form/builder/field/ShowOrderFormField.class.php @@ -63,7 +63,7 @@ class ShowOrderFormField extends SingleSelectionFormField { * and using the language item `wcf.form.field.showOrder.firstPosition` * as value to mark adding it at the first position. */ - public function options($options, bool $nestedOptions = false) { + public function options($options, $nestedOptions = false) { parent::options($options, $nestedOptions); $this->__options = [0 => WCF::getLanguage()->get('wcf.form.field.showOrder.firstPosition')] + $this->__options; diff --git a/wcfsetup/install/files/lib/system/form/builder/field/TDefaultIdFormField.class.php b/wcfsetup/install/files/lib/system/form/builder/field/TDefaultIdFormField.class.php index ae1d1c5d21..d526b8a8d1 100644 --- a/wcfsetup/install/files/lib/system/form/builder/field/TDefaultIdFormField.class.php +++ b/wcfsetup/install/files/lib/system/form/builder/field/TDefaultIdFormField.class.php @@ -19,7 +19,7 @@ trait TDefaultIdFormField { * @inheritDoc * @return static */ - public static function create(string $id = null) { + public static function create($id = null) { if ($id === null) { $id = static::getDefaultId(); } diff --git a/wcfsetup/install/files/lib/system/form/builder/field/TI18nFormField.class.php b/wcfsetup/install/files/lib/system/form/builder/field/TI18nFormField.class.php index 554970be43..259b0ee310 100644 --- a/wcfsetup/install/files/lib/system/form/builder/field/TI18nFormField.class.php +++ b/wcfsetup/install/files/lib/system/form/builder/field/TI18nFormField.class.php @@ -162,7 +162,7 @@ trait TI18nFormField { * @param bool $i18n determines if field supports i18n input * @return II18nFormField this field */ - public function i18n(bool $i18n = true) { + public function i18n($i18n = true) { $this->__i18n = $i18n; return $this; @@ -177,7 +177,7 @@ trait TI18nFormField { * @param bool $i18nRequired determines if field value must be i18n input * @return static this field */ - public function i18nRequired(bool $i18nRequired = true) { + public function i18nRequired($i18nRequired = true) { $this->__i18nRequired = $i18nRequired; $this->i18n(); @@ -214,7 +214,7 @@ trait TI18nFormField { * @throws \BadMethodCallException if i18n is disabled for this field * @throws \InvalidArgumentException if the given pattern is invalid */ - public function languageItemPattern(string $pattern) { + public function languageItemPattern($pattern) { if (!$this->isI18n()) { throw new \BadMethodCallException("The language item pattern can only be set for fields with i18n enabled."); } @@ -301,14 +301,14 @@ trait TI18nFormField { } /** - * Sets the value of this form field based on the given string value. + * Sets the value of this form field based on the given value. * If the value is a language item matching the language item pattern, * the relevant language items are loaded and their values are used as * field values. * * @param string $value set value */ - protected function setStringValue(string $value) { + protected function setStringValue($value) { if (Regex::compile('^' . $this->getLanguageItemPattern() . '$')->match($value)) { $languageItemList = new LanguageItemList(); $languageItemList->getConditionBuilder()->add('languageItem = ?', [$value]); @@ -345,7 +345,7 @@ trait TI18nFormField { } } else { - throw new \InvalidArgumentException("Given value is neither a string nor an array, " . gettype($value) . " given."); + throw new \InvalidArgumentException("Given value is neither a nor an array, " . gettype($value) . " given."); } } else { diff --git a/wcfsetup/install/files/lib/system/form/builder/field/TMaximumLengthFormField.class.php b/wcfsetup/install/files/lib/system/form/builder/field/TMaximumLengthFormField.class.php index 350ddfa248..d8619fbfb4 100644 --- a/wcfsetup/install/files/lib/system/form/builder/field/TMaximumLengthFormField.class.php +++ b/wcfsetup/install/files/lib/system/form/builder/field/TMaximumLengthFormField.class.php @@ -38,7 +38,7 @@ trait TMaximumLengthFormField { * * @throws \InvalidArgumentException if the given maximum length is no integer or otherwise invalid */ - public function maximumLength(int $maximumLength = null) { + public function maximumLength($maximumLength = null) { if ($maximumLength !== null) { if (!is_int($maximumLength)) { throw new \InvalidArgumentException("Given maximum length is no int, '" . gettype($maximumLength) . "' given."); @@ -67,7 +67,7 @@ trait TMaximumLengthFormField { * @param string $text validated text * @param null|Language $language language of the validated text */ - public function validateMaximumLength(string $text, Language $language = null) { + public function validateMaximumLength($text, Language $language = null) { if ($this->getMaximumLength() !== null && mb_strlen($text) > $this->getMaximumLength()) { $this->addValidationError(new FormFieldValidationError( 'maximumLength', diff --git a/wcfsetup/install/files/lib/system/form/builder/field/TMinimumLengthFormField.class.php b/wcfsetup/install/files/lib/system/form/builder/field/TMinimumLengthFormField.class.php index 2cf4245df7..5cb978b299 100644 --- a/wcfsetup/install/files/lib/system/form/builder/field/TMinimumLengthFormField.class.php +++ b/wcfsetup/install/files/lib/system/form/builder/field/TMinimumLengthFormField.class.php @@ -38,7 +38,7 @@ trait TMinimumLengthFormField { * * @throws \InvalidArgumentException if the given minimum length is no integer or otherwise invalid */ - public function minimumLength(int $minimumLength = null) { + public function minimumLength($minimumLength = null) { if ($minimumLength !== null) { if (!is_int($minimumLength)) { throw new \InvalidArgumentException("Given minimum length is no int, '" . gettype($minimumLength) . "' given."); @@ -67,7 +67,7 @@ trait TMinimumLengthFormField { * @param string $text validated text * @param null|Language $language language of the validated text */ - public function validateMinimumLength(string $text, Language $language = null) { + public function validateMinimumLength($text, Language $language = null) { if ($this->getMinimumLength() !== null && mb_strlen($text) < $this->getMinimumLength()) { $this->addValidationError(new FormFieldValidationError( 'minimumLength', diff --git a/wcfsetup/install/files/lib/system/form/builder/field/TMultipleFormField.class.php b/wcfsetup/install/files/lib/system/form/builder/field/TMultipleFormField.class.php index ad8a4f9386..836fa791d3 100644 --- a/wcfsetup/install/files/lib/system/form/builder/field/TMultipleFormField.class.php +++ b/wcfsetup/install/files/lib/system/form/builder/field/TMultipleFormField.class.php @@ -89,7 +89,7 @@ trait TMultipleFormField { * * @throws \InvalidArgumentException if the given maximum number of values is invalid */ - public function maximumMultiples(int $maximum) { + public function maximumMultiples($maximum) { if ($maximum !== IMultipleFormField::NO_MAXIMUM_MULTIPLES) { if ($maximum <= 0) { throw new \InvalidArgumentException("The maximum number of values has to be positive, '{$maximum}' given."); @@ -114,7 +114,7 @@ trait TMultipleFormField { * * @throws \InvalidArgumentException if the given minimum number of values is invalid */ - public function minimumMultiples(int $minimum) { + public function minimumMultiples($minimum) { if ($minimum < 0) { throw new \InvalidArgumentException("The minimum number of values has to be non-negative, '{$minimum}' given."); } @@ -134,7 +134,7 @@ trait TMultipleFormField { * @param bool $multiple determines if multiple values can be selected/set * @return static this field */ - public function multiple(bool $multiple = true) { + public function multiple($multiple = true) { $this->__multiple = $multiple; return $this; diff --git a/wcfsetup/install/files/lib/system/form/builder/field/TNullableFormField.class.php b/wcfsetup/install/files/lib/system/form/builder/field/TNullableFormField.class.php index f769f20d22..95c575a64a 100644 --- a/wcfsetup/install/files/lib/system/form/builder/field/TNullableFormField.class.php +++ b/wcfsetup/install/files/lib/system/form/builder/field/TNullableFormField.class.php @@ -35,7 +35,7 @@ trait TNullableFormField { * @param bool $nullable determines if field supports `null` as its value * @return static this node */ - public function nullable(bool $nullable = true) { + public function nullable($nullable = true) { $this->__nullable = $nullable; return $this; diff --git a/wcfsetup/install/files/lib/system/form/builder/field/TObjectTypeFormField.class.php b/wcfsetup/install/files/lib/system/form/builder/field/TObjectTypeFormField.class.php index 674c63174a..1333003fac 100644 --- a/wcfsetup/install/files/lib/system/form/builder/field/TObjectTypeFormField.class.php +++ b/wcfsetup/install/files/lib/system/form/builder/field/TObjectTypeFormField.class.php @@ -45,7 +45,7 @@ trait TObjectTypeFormField { * @throws \UnexpectedValueException if object type definition returned by `getObjectTypeDefinition()` is unknown * @throws InvalidObjectTypeException if given object type name is invalid */ - public function objectType(string $objectType) { + public function objectType($objectType) { if ($this->__objectType !== null) { throw new \BadMethodCallException("Object type has already been set."); } diff --git a/wcfsetup/install/files/lib/system/form/builder/field/TPlaceholderFormField.class.php b/wcfsetup/install/files/lib/system/form/builder/field/TPlaceholderFormField.class.php index dffe03b357..fe52c6cab1 100644 --- a/wcfsetup/install/files/lib/system/form/builder/field/TPlaceholderFormField.class.php +++ b/wcfsetup/install/files/lib/system/form/builder/field/TPlaceholderFormField.class.php @@ -37,9 +37,9 @@ trait TPlaceholderFormField { * @param array $variables additional variables used when resolving the language item * @return static this field * - * @throws \InvalidArgumentException if the given value is no string or otherwise invalid + * @throws \InvalidArgumentException if the given value is no or otherwise invalid */ - public function placeholder(string $languageItem = null, array $variables = []) { + public function placeholder($languageItem = null, array $variables = []) { if ($languageItem === null) { if (!empty($variables)) { throw new \InvalidArgumentException("Cannot use variables when unsetting placeholder of field '{$this->getId()}'"); diff --git a/wcfsetup/install/files/lib/system/form/builder/field/TSelectionFormField.class.php b/wcfsetup/install/files/lib/system/form/builder/field/TSelectionFormField.class.php index aa2cc4680b..26dddcc92b 100644 --- a/wcfsetup/install/files/lib/system/form/builder/field/TSelectionFormField.class.php +++ b/wcfsetup/install/files/lib/system/form/builder/field/TSelectionFormField.class.php @@ -115,7 +115,7 @@ trait TSelectionFormField { * @throws \InvalidArgumentException if given options are no array or callable or otherwise invalid * @throws \UnexpectedValueException if callable does not return an array */ - public function options($options, bool $nestedOptions = false) { + public function options($options, $nestedOptions = false) { if ($nestedOptions) { if (!is_array($options) && !is_callable($options)) { throw new \InvalidArgumentException("The given nested options are neither an array nor a callable, " . gettype($options) . " given."); diff --git a/wcfsetup/install/files/lib/system/form/builder/field/TSuffixedFormField.class.php b/wcfsetup/install/files/lib/system/form/builder/field/TSuffixedFormField.class.php index df56a4df2a..cc2bf41006 100644 --- a/wcfsetup/install/files/lib/system/form/builder/field/TSuffixedFormField.class.php +++ b/wcfsetup/install/files/lib/system/form/builder/field/TSuffixedFormField.class.php @@ -35,9 +35,9 @@ trait TSuffixedFormField { * @param array $variables additional variables used when resolving the language item * @return static this field * - * @throws \InvalidArgumentException if the given language item is no string or otherwise invalid + * @throws \InvalidArgumentException if the given language item is no or otherwise invalid */ - public function suffix(string $languageItem = null, array $variables = []) { + public function suffix($languageItem = null, array $variables = []) { if ($languageItem === null) { if (!empty($variables)) { throw new \InvalidArgumentException("Cannot use variables when unsetting suffix of field '{$this->getId()}'"); diff --git a/wcfsetup/install/files/lib/system/form/builder/field/TextFormField.class.php b/wcfsetup/install/files/lib/system/form/builder/field/TextFormField.class.php index d8b71cec65..2b732740a7 100644 --- a/wcfsetup/install/files/lib/system/form/builder/field/TextFormField.class.php +++ b/wcfsetup/install/files/lib/system/form/builder/field/TextFormField.class.php @@ -61,7 +61,7 @@ class TextFormField extends AbstractFormField implements II18nFormField, IMaximu * @param string $text validated text * @param null|Language $language language of validated text or `null` for monolingual text */ - protected function validateText(string $text, Language $language = null) { + protected function validateText($text, Language $language = null) { $this->validateMinimumLength($text, $language); $this->validateMaximumLength($text, $language); } diff --git a/wcfsetup/install/files/lib/system/form/builder/field/WysiwygFormField.class.php b/wcfsetup/install/files/lib/system/form/builder/field/WysiwygFormField.class.php index 1073ca4e29..c16808f332 100644 --- a/wcfsetup/install/files/lib/system/form/builder/field/WysiwygFormField.class.php +++ b/wcfsetup/install/files/lib/system/form/builder/field/WysiwygFormField.class.php @@ -49,7 +49,7 @@ class WysiwygFormField extends AbstractFormField implements IMaximumLengthFormFi * @param string $autosaveId identifier used to autosave field value * @return WysiwygFormField this field */ - public function autosaveId(string $autosaveId) { + public function autosaveId($autosaveId) { $this->__autosaveId = $autosaveId; return $this; @@ -57,7 +57,7 @@ class WysiwygFormField extends AbstractFormField implements IMaximumLengthFormFi /** * Returns the identifier used to autosave the field value. If autosave is disabled, - * an empty string is returned. + * an empty is returned. * * @return string */ @@ -95,7 +95,7 @@ class WysiwygFormField extends AbstractFormField implements IMaximumLengthFormFi * @param int $lastEditTime last time field has been edited * @return WysiwygFormField this field */ - public function lastEditTime(int $lastEditTime) { + public function lastEditTime($lastEditTime) { $this->__lastEditTime = $lastEditTime; return $this; diff --git a/wcfsetup/install/files/lib/system/form/builder/field/data/CustomFormFieldDataProcessor.class.php b/wcfsetup/install/files/lib/system/form/builder/field/data/CustomFormFieldDataProcessor.class.php index 3ed97760d2..bbb9e18c5b 100644 --- a/wcfsetup/install/files/lib/system/form/builder/field/data/CustomFormFieldDataProcessor.class.php +++ b/wcfsetup/install/files/lib/system/form/builder/field/data/CustomFormFieldDataProcessor.class.php @@ -32,7 +32,7 @@ class CustomFormFieldDataProcessor implements IFormFieldDataProcessor { * * @throws \InvalidArgumentException if either id or processor callable are invalid */ - public function __construct(string $id, callable $processor) { + public function __construct($id, callable $processor) { if (preg_match('~^[a-z][A-z0-9-]*$~', $id) !== 1) { throw new \InvalidArgumentException("Invalid id '{$id}' given."); } 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 e3c31af453..12c8470421 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 @@ -104,9 +104,9 @@ abstract class AbstractFormFieldDependency implements IFormFieldDependency { * @param string $id id of the dependency * @return static $this this dependency * - * @throws \InvalidArgumentException if given id no string or otherwise invalid + * @throws \InvalidArgumentException if given id no or otherwise invalid */ - protected function id(string $id) { + protected function id($id) { if (preg_match('~^[a-z][A-z0-9-]*$~', $id) !== 1) { throw new \InvalidArgumentException("Invalid id '{$id}' given."); } @@ -120,7 +120,7 @@ abstract class AbstractFormFieldDependency implements IFormFieldDependency { * @inheritDoc * @return static */ - public static function create(string $id) { + public static function create($id) { return (new static)->id($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 e6e6072385..7c1e3e825a 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 @@ -77,5 +77,5 @@ interface IFormFieldDependency { * * @throws \InvalidArgumentException if the given id is invalid */ - public static function create(string $id); + public static function create($id); } diff --git a/wcfsetup/install/files/lib/system/form/builder/field/dependency/ValueFormFieldDependency.class.php b/wcfsetup/install/files/lib/system/form/builder/field/dependency/ValueFormFieldDependency.class.php index f85a95695e..9d06283744 100644 --- a/wcfsetup/install/files/lib/system/form/builder/field/dependency/ValueFormFieldDependency.class.php +++ b/wcfsetup/install/files/lib/system/form/builder/field/dependency/ValueFormFieldDependency.class.php @@ -73,7 +73,7 @@ class ValueFormFieldDependency extends AbstractFormFieldDependency { * @param bool $negate * @return static $this this dependency */ - public function negate(bool $negate = true) { + public function negate($negate = true) { $this->__isNegated = $negate; return $this; diff --git a/wcfsetup/install/files/lib/system/form/builder/field/validation/FormFieldValidationError.class.php b/wcfsetup/install/files/lib/system/form/builder/field/validation/FormFieldValidationError.class.php index fdf03cea0c..5d87cd2c1e 100644 --- a/wcfsetup/install/files/lib/system/form/builder/field/validation/FormFieldValidationError.class.php +++ b/wcfsetup/install/files/lib/system/form/builder/field/validation/FormFieldValidationError.class.php @@ -33,7 +33,7 @@ class FormFieldValidationError implements IFormFieldValidationError { /** * @inheritDoc */ - public function __construct(string $type, string $languageItem = null, array $information = []) { + public function __construct($type, $languageItem = null, array $information = []) { if ($languageItem === null) { $languageItem = 'wcf.global.form.error.' . $type; } 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 656c8b318f..2436ebc47f 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 @@ -14,7 +14,7 @@ use wcf\system\form\builder\field\IFormField; class FormFieldValidator implements IFormFieldValidator { /** * id of the validator that has to be unique for each field - * @var string + * @var */ protected $id; @@ -27,7 +27,7 @@ class FormFieldValidator implements IFormFieldValidator { /** * @inheritDoc */ - public function __construct(string $id, callable $validator) { + public function __construct($id, callable $validator) { static::validateId($id); $this->id = $id; @@ -65,7 +65,7 @@ class FormFieldValidator implements IFormFieldValidator { /** * @inheritDoc */ - public static function validateId(string $id) { + public static function validateId($id) { if (preg_match('~^[a-z][A-z0-9-]*$~', $id) !== 1) { throw new \InvalidArgumentException("Invalid id '{$id}' given."); } diff --git a/wcfsetup/install/files/lib/system/form/builder/field/validation/FormFieldValidatorUtil.class.php b/wcfsetup/install/files/lib/system/form/builder/field/validation/FormFieldValidatorUtil.class.php index 6e7aac11c9..bc26b7f7cd 100644 --- a/wcfsetup/install/files/lib/system/form/builder/field/validation/FormFieldValidatorUtil.class.php +++ b/wcfsetup/install/files/lib/system/form/builder/field/validation/FormFieldValidatorUtil.class.php @@ -23,7 +23,7 @@ abstract class FormFieldValidatorUtil { * * @throws \InvalidArgumentException if regular expression is invalid */ - public static function getRegularExpressionValidator(string $regularExpression, string $languageItemPrefix) { + public static function getRegularExpressionValidator($regularExpression, $languageItemPrefix) { $regex = Regex::compile($regularExpression); if (!$regex->isValid()) { throw new \InvalidArgumentException("Invalid regular expression '{$regularExpression}' given."); diff --git a/wcfsetup/install/files/lib/system/form/builder/field/validation/IFormFieldValidationError.class.php b/wcfsetup/install/files/lib/system/form/builder/field/validation/IFormFieldValidationError.class.php index 4aa233ffdb..5daeb06708 100644 --- a/wcfsetup/install/files/lib/system/form/builder/field/validation/IFormFieldValidationError.class.php +++ b/wcfsetup/install/files/lib/system/form/builder/field/validation/IFormFieldValidationError.class.php @@ -22,7 +22,7 @@ interface IFormFieldValidationError { * * @throws \InvalidArgumentException if the given error type is invalid */ - public function __construct(string $type, string $languageItem = null, array $information = []); + public function __construct($type, $languageItem = null, array $information = []); /** * Returns the HTML element representing the error. 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 b088ba6f86..a91bd0a1e3 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 @@ -20,7 +20,7 @@ interface IFormFieldValidator { * * @throws \InvalidArgumentException if the given id is invalid */ - public function __construct(string $id, callable $validator); + public function __construct($id, callable $validator); /** * Validates the value of the given field. @@ -37,11 +37,11 @@ interface IFormFieldValidator { public function getId(); /** - * Checks if the given parameter is a string and a valid validator id. + * 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(string $id); + public static function validateId($id); } -- 2.20.1