From: Matthias Schmidt Date: Sat, 21 Jul 2018 08:46:47 +0000 (+0200) Subject: Remove return types from form builder API X-Git-Tag: 5.2.0_Alpha_1~680^2~9 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=7b43decd0f05be2ec10391349b391b16c732d335;p=GitHub%2FWoltLab%2FWCF.git Remove return types from form builder API See #2509 See #2720 --- 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 d9f3ed940d..818c213e5b 100644 --- a/wcfsetup/install/files/lib/system/form/builder/DialogFormDocument.class.php +++ b/wcfsetup/install/files/lib/system/form/builder/DialogFormDocument.class.php @@ -25,7 +25,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): DialogFormDocument { + public function cancelable(bool $cancelable = true) { $this->__isCancelable = $cancelable; return $this; @@ -34,7 +34,7 @@ class DialogFormDocument extends FormDocument { /** * @inheritDoc */ - public function getAction(): string { + public function getAction() { // do not throw exception if no action has been set as a dialog // form does not require an action to be set if ($this->__action === null) { @@ -47,7 +47,7 @@ class DialogFormDocument extends FormDocument { /** * @inheritDoc */ - public function getHtml(): string { + public function getHtml() { return WCF::getTPL()->fetch( '__dialogForm', 'wcf', @@ -63,7 +63,7 @@ class DialogFormDocument extends FormDocument { * * @return bool */ - public function isCancelable(): bool { + public function isCancelable() { return $this->__isCancelable; } } diff --git a/wcfsetup/install/files/lib/system/form/builder/FormDataHandler.class.php b/wcfsetup/install/files/lib/system/form/builder/FormDataHandler.class.php index 3940dea80d..67f39d169f 100644 --- a/wcfsetup/install/files/lib/system/form/builder/FormDataHandler.class.php +++ b/wcfsetup/install/files/lib/system/form/builder/FormDataHandler.class.php @@ -23,7 +23,7 @@ class FormDataHandler implements IFormDataHandler { /** * @inheritDoc */ - public function add(IFormFieldDataProcessor $processor): IFormDataHandler { + public function add(IFormFieldDataProcessor $processor) { $this->processors[] = $processor; return $this; @@ -32,7 +32,7 @@ class FormDataHandler implements IFormDataHandler { /** * @inheritDoc */ - public function getData(IFormDocument $document): array { + public function getData(IFormDocument $document) { $parameters = []; foreach ($this->processors as $processor) { $parameters = $processor($document, $parameters); 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 8ce36c1578..3e59cce575 100644 --- a/wcfsetup/install/files/lib/system/form/builder/FormDocument.class.php +++ b/wcfsetup/install/files/lib/system/form/builder/FormDocument.class.php @@ -74,7 +74,7 @@ class FormDocument implements IFormDocument { /** * @inheritDoc */ - public function action(string $action): IFormDocument { + public function action(string $action) { $this->__action = $action; return $this; @@ -83,7 +83,7 @@ class FormDocument implements IFormDocument { /** * @inheritDoc */ - public function build(): IFormDocument { + public function build() { if ($this->isBuilt) { throw new \BadMethodCallException("Form document has already been built."); } @@ -115,7 +115,7 @@ class FormDocument implements IFormDocument { /** * @inheritDoc */ - public function formMode(string $formMode): IFormDocument { + public function formMode(string $formMode) { if ($this->__formMode !== null) { throw new \BadMethodCallException("Form mode has already been set"); } @@ -132,7 +132,7 @@ class FormDocument implements IFormDocument { /** * @inheritDoc */ - public function getAction(): string { + public function getAction() { if ($this->__action === null) { throw new \BadMethodCallException("Action has not been set."); } @@ -143,14 +143,14 @@ class FormDocument implements IFormDocument { /** * @inheritDoc */ - public function getData(): array { + public function getData() { return $this->getDataHandler()->getData($this); } /** * @inheritDoc */ - public function getDataHandler(): IFormDataHandler { + public function getDataHandler() { if ($this->dataHandler === null) { $this->dataHandler = new FormDataHandler(); $this->dataHandler->add(new DefaultFormFieldDataProcessor()); @@ -162,7 +162,7 @@ class FormDocument implements IFormDocument { /** * @inheritDoc */ - public function getDocument(): IFormDocument { + public function getDocument() { return $this; } @@ -189,7 +189,7 @@ class FormDocument implements IFormDocument { /** * @inheritDoc */ - public function getFormMode(): string { + public function getFormMode() { if ($this->__formMode === null) { $this->__formMode = self::FORM_MODE_CREATE; } @@ -200,7 +200,7 @@ class FormDocument implements IFormDocument { /** * @inheritDoc */ - public function getHtml(): string { + public function getHtml() { return WCF::getTPL()->fetch( '__form', 'wcf', @@ -211,14 +211,14 @@ class FormDocument implements IFormDocument { /** * @inheritDoc */ - public function getMethod(): string { + public function getMethod() { return $this->__method; } /** * @inheritDoc */ - public function getPrefix(): string { + public function getPrefix() { if ($this->__prefix === null) { return ''; } @@ -248,7 +248,7 @@ class FormDocument implements IFormDocument { /** * @inheritDoc */ - public function hasRequestData(string $index = null): bool { + public function hasRequestData(string $index = null) { $requestData = $this->getRequestData(); if ($index !== null) { @@ -261,7 +261,7 @@ class FormDocument implements IFormDocument { /** * @inheritDoc */ - public function loadValuesFromObject(IStorableObject $object): IFormDocument { + public function loadValuesFromObject(IStorableObject $object) { if ($this->__formMode === null) { $this->formMode(self::FORM_MODE_UPDATE); } @@ -291,7 +291,7 @@ class FormDocument implements IFormDocument { /** * @inheritDoc */ - public function method(string $method): IFormDocument { + public function method(string $method) { if ($method !== 'get' && $method !== 'post') { throw new \InvalidArgumentException("Invalid method '{$method}' given."); } @@ -304,7 +304,7 @@ class FormDocument implements IFormDocument { /** * @inheritDoc */ - public function prefix(string $prefix): IFormDocument { + public function prefix(string $prefix) { static::validateId($prefix); $this->__prefix = $prefix; @@ -315,7 +315,7 @@ class FormDocument implements IFormDocument { /** * @inheritDoc */ - public function readValues(): IFormParentNode { + public function readValues() { if ($this->__requestData === null) { $this->__requestData = $_POST; } @@ -326,7 +326,7 @@ class FormDocument implements IFormDocument { /** * @inheritDoc */ - public function requestData(array $requestData): IFormDocument { + public function requestData(array $requestData) { if ($this->__requestData !== null) { throw new \BadMethodCallException('Request data has already been set.'); } diff --git a/wcfsetup/install/files/lib/system/form/builder/IFormChildNode.class.php b/wcfsetup/install/files/lib/system/form/builder/IFormChildNode.class.php index 8e674bf247..fc58887cac 100644 --- a/wcfsetup/install/files/lib/system/form/builder/IFormChildNode.class.php +++ b/wcfsetup/install/files/lib/system/form/builder/IFormChildNode.class.php @@ -19,7 +19,7 @@ interface IFormChildNode extends IFormNode { * * @throws \BadMethodCallException if the parent node has not been set previously */ - public function getParent(): IFormParentNode; + public function getParent(); /** * Sets the parent node of this node and returns this node. @@ -29,5 +29,5 @@ interface IFormChildNode extends IFormNode { * * @throws \BadMethodCallException if the parent node has already been set */ - public function parent(IFormParentNode $parentNode): IFormChildNode; + public function parent(IFormParentNode $parentNode); } diff --git a/wcfsetup/install/files/lib/system/form/builder/IFormDataHandler.class.php b/wcfsetup/install/files/lib/system/form/builder/IFormDataHandler.class.php index 6c8aa63853..242d9503d2 100644 --- a/wcfsetup/install/files/lib/system/form/builder/IFormDataHandler.class.php +++ b/wcfsetup/install/files/lib/system/form/builder/IFormDataHandler.class.php @@ -21,7 +21,7 @@ interface IFormDataHandler { * @param IFormFieldDataProcessor $processor added field data processor * @return static this data handler */ - public function add(IFormFieldDataProcessor $processor): IFormDataHandler; + public function add(IFormFieldDataProcessor $processor); /** * Returns the data from the given form that is passed as the parameters @@ -30,5 +30,5 @@ interface IFormDataHandler { * @param IFormDocument $document processed form document * @return array data passed to database object action */ - public function getData(IFormDocument $document): array; + public function getData(IFormDocument $document); } 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 261340787a..efe1035049 100644 --- a/wcfsetup/install/files/lib/system/form/builder/IFormDocument.class.php +++ b/wcfsetup/install/files/lib/system/form/builder/IFormDocument.class.php @@ -33,7 +33,7 @@ interface IFormDocument extends IFormParentNode { * * @throws \InvalidArgumentException if the given action is invalid */ - public function action(string $action): IFormDocument; + public function action(string $action); /** * Is called once after all nodes have been added to this document. @@ -46,7 +46,7 @@ interface IFormDocument extends IFormParentNode { * * @throws \BadMethodCallException if this document has already been built */ - public function build(): IFormDocument; + public function build(); /** * Sets the form mode (see `self::FORM_MODE_*` constants). @@ -57,7 +57,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): IFormDocument; + public function formMode(string $formMode); /** * Returns the `action` property of the HTML `form` element. @@ -66,7 +66,7 @@ interface IFormDocument extends IFormParentNode { * * @throws \BadMethodCallException if no action has been set */ - public function getAction(): string; + public function getAction(); /** * Returns the array passed as the `$parameters` argument of the constructor @@ -74,7 +74,7 @@ interface IFormDocument extends IFormParentNode { * * @return array data passed to database object action */ - public function getData(): array; + public function getData(); /** * Returns the data handler for this document that is used to process the @@ -86,7 +86,7 @@ interface IFormDocument extends IFormParentNode { * * @return IFormDataHandler form data handler */ - public function getDataHandler(): IFormDataHandler; + public function getDataHandler(); /** * Returns the encoding type of this form. If the form contains any @@ -106,7 +106,7 @@ interface IFormDocument extends IFormParentNode { * * @return string form mode */ - public function getFormMode(): string; + public function getFormMode(); /** * Returns the `method` property of the HTML `form` element. If no method @@ -114,7 +114,7 @@ interface IFormDocument extends IFormParentNode { * * @return string form method */ - public function getMethod(): string; + public function getMethod(); /** * Returns the global form prefix that is prepended to form elements' names and ids to @@ -124,7 +124,7 @@ interface IFormDocument extends IFormParentNode { * * @return string global form element prefix */ - public function getPrefix(): string; + public function getPrefix(); /** * Returns the request data of the form's fields. @@ -147,7 +147,7 @@ interface IFormDocument extends IFormParentNode { * @param null|string $index array index of the returned data * @return bool `tu */ - public function hasRequestData(string $index = null): bool; + public function hasRequestData(string $index = null); /** * Loads the field values from the given object and returns this document. @@ -158,7 +158,7 @@ interface IFormDocument extends IFormParentNode { * @param IStorableObject $object object used to load field values * @return static this document */ - public function loadValuesFromObject(IStorableObject $object): IFormDocument; + public function loadValuesFromObject(IStorableObject $object); /** * Sets the `method` property of the HTML `form` element and returns this document. @@ -168,7 +168,7 @@ interface IFormDocument extends IFormParentNode { * * @throws \InvalidArgumentException if the given method is invalid */ - public function method(string $method): IFormDocument; + public function method(string $method); /** * Sets the global form prefix that is prepended to form elements' names and ids to @@ -182,7 +182,7 @@ interface IFormDocument extends IFormParentNode { * * @throws \InvalidArgumentException if the given prefix is invalid */ - public function prefix(string $prefix): IFormDocument; + public function prefix(string $prefix); /** * Sets the request data of the form's fields. @@ -192,5 +192,5 @@ interface IFormDocument extends IFormParentNode { * * @throws \BadMethodCallException if request data has already been set */ - public function requestData(array $requestData): IFormDocument; + public function requestData(array $requestData); } 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 9b84e4e654..3bc6277f07 100644 --- a/wcfsetup/install/files/lib/system/form/builder/IFormElement.class.php +++ b/wcfsetup/install/files/lib/system/form/builder/IFormElement.class.php @@ -23,7 +23,7 @@ interface IFormElement extends IFormNode { * * @throws \InvalidArgumentException if the given description is invalid */ - public function description(string $languageItem = null, array $variables = []): IFormElement; + public function description(string $languageItem = null, array $variables = []); /** * Returns the description of this element or `null` if no description has been set. @@ -50,12 +50,12 @@ interface IFormElement extends IFormNode { * * @throws \InvalidArgumentException if the given label is invalid */ - public function label(string $languageItem = null, array $variables = []): IFormElement; + public function label(string $languageItem = null, array $variables = []); /** * Returns `true` if this element requires a label to be set. * * @return bool */ - public function requiresLabel(): bool; + public function requiresLabel(); } 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 0e391a4e14..d6ac62b967 100644 --- a/wcfsetup/install/files/lib/system/form/builder/IFormNode.class.php +++ b/wcfsetup/install/files/lib/system/form/builder/IFormNode.class.php @@ -21,7 +21,7 @@ interface IFormNode { * * @throws \InvalidArgumentException if the given class is invalid */ - public function addClass(string $class): IFormNode; + public function addClass(string $class); /** * Adds a dependency on the value of a `IFormField` so that this node is @@ -34,7 +34,7 @@ interface IFormNode { * @param IFormFieldDependency $dependency added node dependency * @return static this node */ - public function addDependency(IFormFieldDependency $dependency): IFormNode; + public function addDependency(IFormFieldDependency $dependency); /** * Adds an additional attribute to this node and returns this node. @@ -47,7 +47,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): IFormNode; + public function attribute(string $name, string $value = null); /** * Sets if this node is available and returns this node. @@ -69,14 +69,14 @@ interface IFormNode { * @param bool $available determines if node is available * @return static this node */ - public function available(bool $available = true): IFormNode; + public function available(bool $available = true); /** * Returns `true` if the node's dependencies are met and returns `false` otherwise. * * @return bool */ - public function checkDependencies(): bool; + public function checkDependencies(); /** * Returns the value of the additional attribute of this node with the given name. @@ -93,21 +93,21 @@ interface IFormNode { * * @return array additional node attributes */ - public function getAttributes(): array; + public function getAttributes(); /** * Returns all CSS classes of this node. * * @return string[] CSS classes of node */ - public function getClasses(): array; + public function getClasses(); /** * Returns all of the node's dependencies. * * @return IFormFieldDependency[] node's dependencies */ - public function getDependencies(): array; + public function getDependencies(); /** * Returns the form document this node belongs to. @@ -116,14 +116,14 @@ interface IFormNode { * * @throws \BadMethodCallException if form document is inaccessible for this node */ - public function getDocument(): IFormDocument; + public function getDocument(); /** * Returns the html representation of this node. * * @return string html representation of node */ - public function getHtml(): string; + public function getHtml(); /** * Returns additional template variables used to generate the html representation @@ -131,7 +131,7 @@ interface IFormNode { * * @return array additional template variables */ - public function getHtmlVariables(): array; + public function getHtmlVariables(); /** * Returns the id of the form node. @@ -140,7 +140,7 @@ interface IFormNode { * * @throws \BadMethodCallException if no id has been set */ - public function getId(): string; + public function getId(); /** * Returns the prefixed id of this node that means a combination of the form @@ -153,7 +153,7 @@ interface IFormNode { * * @throws \BadMethodCallException if no id has been set or if form document is inaccessible for this node */ - public function getPrefixedId(): string; + public function getPrefixedId(); /** * Returns `true` if an additional attribute with the given name exists and returns @@ -164,7 +164,7 @@ interface IFormNode { * * @throws \InvalidArgumentException if the given attribute name is invalid */ - public function hasAttribute(string $name): bool; + public function hasAttribute(string $name); /** * Returns `true` if a CSS class with the given name exists and returns `false` otherwise. @@ -174,7 +174,7 @@ interface IFormNode { * * @throws \InvalidArgumentException if the given class is invalid */ - public function hasClass(string $class): bool; + public function hasClass(string $class); /** * Returns `true` if this node has a dependency with the given id and @@ -185,7 +185,7 @@ interface IFormNode { * * @throws \InvalidArgumentException if the given id is invalid */ - public function hasDependency(string $dependencyId): bool; + public function hasDependency(string $dependencyId); /** * Sets the id of the node. @@ -196,7 +196,7 @@ interface IFormNode { * @throws \BadMethodCallException if id has already been set * @throws \InvalidArgumentException if the given id is invalid */ - public function id(string $id): IFormNode; + public function id(string $id); /** * Returns `true` if this node is available and returns `false` otherwise. @@ -207,7 +207,7 @@ interface IFormNode { * * @see IFormNode::available() */ - public function isAvailable(): bool; + public function isAvailable(); /** * Is called once after all nodes have been added to the document this node belongs to. @@ -219,7 +219,7 @@ interface IFormNode { * * @throws \BadMethodCallException if this node has already been populated */ - public function populate(): IFormNode; + public function populate(); /** * Removes the given CSS class and returns this node. @@ -232,7 +232,7 @@ interface IFormNode { * * @throws \InvalidArgumentException if the given class is invalid */ - public function removeClass(string $class): IFormNode; + public function removeClass(string $class); /** * Removes the dependency with the given id and returns this node. @@ -242,7 +242,7 @@ interface IFormNode { * * @throws \InvalidArgumentException if the given id is invalid or no such dependency exists */ - public function removeDependency(string $dependencyId): IFormNode; + public function removeDependency(string $dependencyId); /** * Validates the node. @@ -260,7 +260,7 @@ interface IFormNode { * * @throws \InvalidArgumentException if the given id is already used by another element or otherwise is invalid */ - public static function create(string $id): IFormNode; + public static function create(string $id); /** * Checks if the given attribute name class a string and a valid attribute name. 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 2949c5ac26..1ced18c695 100644 --- a/wcfsetup/install/files/lib/system/form/builder/IFormParentNode.class.php +++ b/wcfsetup/install/files/lib/system/form/builder/IFormParentNode.class.php @@ -20,7 +20,7 @@ interface IFormParentNode extends \Countable, IFormNode, \RecursiveIterator { * * @throws \InvalidArgumentException if the given child node cannot be appended */ - public function appendChild(IFormChildNode $child): IFormParentNode; + public function appendChild(IFormChildNode $child); /** * Appends the given children to this node and returns this node. @@ -30,14 +30,14 @@ interface IFormParentNode extends \Countable, IFormNode, \RecursiveIterator { * * @throws \InvalidArgumentException if any of the given child nodes is invalid or cannot be appended */ - public function appendChildren(array $children): IFormParentNode; + public function appendChildren(array $children); /** * Returns all child nodes of this node. * * @return IFormChildNode[] children of this node */ - public function children(): array; + public function children(); /** * Returns `true` if this node (or any of the child nodes) contains the node @@ -46,7 +46,7 @@ interface IFormParentNode extends \Countable, IFormNode, \RecursiveIterator { * @param string $nodeId id of searched node * @return bool */ - public function contains(string $nodeId): bool; + public function contains(string $nodeId); /** * Returns a recursive iterator for this node. @@ -55,7 +55,7 @@ interface IFormParentNode extends \Countable, IFormNode, \RecursiveIterator { * * @return \RecursiveIteratorIterator recursive iterator for this node */ - public function getIterator(): \RecursiveIteratorIterator; + public function getIterator(); /** * Returns the node with the given id or `null` if no such node exists. @@ -76,7 +76,7 @@ interface IFormParentNode extends \Countable, IFormNode, \RecursiveIterator { * * @return bool */ - public function hasValidationErrors(): bool; + public function hasValidationErrors(); /** * Inserts the given node before the node with the given id and returns this node. @@ -87,7 +87,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): IFormParentNode; + public function insertBefore(IFormChildNode $child, string $referenceNodeId); /** * Reads the value of this node and its children from request data and @@ -95,7 +95,7 @@ interface IFormParentNode extends \Countable, IFormNode, \RecursiveIterator { * * @return static this node */ - public function readValues(): IFormParentNode; + public function readValues(); /** * Checks if the given node can be added as a child to this node. diff --git a/wcfsetup/install/files/lib/system/form/builder/TFormChildNode.class.php b/wcfsetup/install/files/lib/system/form/builder/TFormChildNode.class.php index 5de462cf5b..80b206ed79 100644 --- a/wcfsetup/install/files/lib/system/form/builder/TFormChildNode.class.php +++ b/wcfsetup/install/files/lib/system/form/builder/TFormChildNode.class.php @@ -25,7 +25,7 @@ trait TFormChildNode { * * @throws \BadMethodCallException if form document is inaccessible for this node */ - public function getDocument(): IFormDocument { + public function getDocument() { $element = $this; while ($element instanceof IFormChildNode) { $element = $element->getParent(); @@ -45,7 +45,7 @@ trait TFormChildNode { * * @throws \BadMethodCallException if the parent node has not been set previously */ - public function getParent(): IFormParentNode { + public function getParent() { if ($this->__parent === null) { throw new \BadMethodCallException("Before getting the parent node of '{$this->getId()}', it must be set."); } @@ -59,7 +59,7 @@ trait TFormChildNode { * @param IFormParentNode $parentNode new parent node of this node * @return static this node */ - public function parent(IFormParentNode $parentNode): IFormChildNode { + public function parent(IFormParentNode $parentNode) { if ($this->__parent !== null) { throw new \BadMethodCallException("The parent node of '{$this->getId()}' has already been set."); } 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 9a099ff8b8..8319b72f61 100644 --- a/wcfsetup/install/files/lib/system/form/builder/TFormElement.class.php +++ b/wcfsetup/install/files/lib/system/form/builder/TFormElement.class.php @@ -38,7 +38,7 @@ trait TFormElement { * * @throws \InvalidArgumentException if the given description is no string or otherwise is invalid */ - public function description(string $languageItem = null, array $variables = []): IFormElement { + public function description(string $languageItem = null, array $variables = []) { if ($languageItem === null) { if (!empty($variables)) { throw new \InvalidArgumentException("Cannot use variables when unsetting description of element '{$this->getId()}'"); @@ -86,7 +86,7 @@ trait TFormElement { * * @throws \InvalidArgumentException if the given label is no string or otherwise is invalid */ - public function label(string $languageItem = null, array $variables = []): IFormElement { + public function label(string $languageItem = null, array $variables = []) { if ($languageItem === null) { if (!empty($variables)) { throw new \InvalidArgumentException("Cannot use variables when unsetting label of element '{$this->getId()}'"); @@ -110,7 +110,7 @@ trait TFormElement { * * @return bool */ - public function requiresLabel(): bool { + public function requiresLabel() { // by default, form elements do not require a label return false; } 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 c607ee8b92..9a82739d6b 100644 --- a/wcfsetup/install/files/lib/system/form/builder/TFormNode.class.php +++ b/wcfsetup/install/files/lib/system/form/builder/TFormNode.class.php @@ -63,7 +63,7 @@ trait TFormNode { * * @throws \InvalidArgumentException if the given class is invalid */ - public function addClass(string $class): IFormNode { + public function addClass(string $class) { static::validateClass($class); if (!in_array($class, $this->__classes)) { @@ -82,9 +82,9 @@ trait TFormNode { * to this node. * * @param IFormFieldDependency $dependency added node dependency - * @return static this node + * @return static this node */ - public function addDependency(IFormFieldDependency $dependency): IFormNode { + public function addDependency(IFormFieldDependency $dependency) { $this->dependencies[] = $dependency; $dependency->dependentNode($this); @@ -103,7 +103,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): IFormNode { + public function attribute(string $name, string $value = null) { static::validateAttribute($name); if ($value !== null && !is_bool($value) && !is_numeric($value) && !is_string($value)) { @@ -135,7 +135,7 @@ trait TFormNode { * @param bool $available determines if node is available * @return static this node */ - public function available(bool $available = true): IFormNode { + public function available(bool $available = true) { $this->__available = $available; return $this; @@ -146,7 +146,7 @@ trait TFormNode { * * @return bool */ - public function checkDependencies(): bool { + public function checkDependencies() { if (!empty($this->dependencies)) { foreach ($this->dependencies as $dependency) { if (!$dependency->checkDependency()) { @@ -195,7 +195,7 @@ trait TFormNode { * * @return array additional node attributes */ - public function getAttributes(): array { + public function getAttributes() { return $this->__attributes; } @@ -204,7 +204,7 @@ trait TFormNode { * * @return string[] CSS classes of node */ - public function getClasses(): array { + public function getClasses() { return $this->__classes; } @@ -213,7 +213,7 @@ trait TFormNode { * * @return IFormFieldDependency[] node's dependencies */ - public function getDependencies(): array { + public function getDependencies() { return $this->dependencies; } @@ -224,7 +224,7 @@ trait TFormNode { * * @throws \BadMethodCallException if form document is inaccessible for this node */ - abstract public function getDocument(): IFormDocument; + abstract public function getDocument(); /** * Returns additional template variables used to generate the html representation @@ -232,7 +232,7 @@ trait TFormNode { * * @return array additional template variables */ - public function getHtmlVariables(): array { + public function getHtmlVariables() { return []; } @@ -243,7 +243,7 @@ trait TFormNode { * * @throws \BadMethodCallException if no id has been set */ - public function getId(): string { + public function getId() { if ($this->__id === null) { throw new \BadMethodCallException("Id has not been set."); } @@ -262,7 +262,7 @@ trait TFormNode { * * @throws \BadMethodCallException if no id has been set or if form document is inaccessible for this node */ - public function getPrefixedId(): string { + public function getPrefixedId() { return $this->getDocument()->getPrefix() . $this->getId(); } @@ -275,7 +275,7 @@ trait TFormNode { * * @throws \InvalidArgumentException if the given attribute name is invalid */ - public function hasAttribute(string $name): bool { + public function hasAttribute(string $name) { static::validateAttribute($name); return isset($this->__attributes[$name]); @@ -289,7 +289,7 @@ trait TFormNode { * * @throws \InvalidArgumentException if the given class is invalid */ - public function hasClass(string $class): bool { + public function hasClass(string $class) { static::validateClass($class); return array_search($class, $this->__classes) !== false; @@ -304,7 +304,7 @@ trait TFormNode { * * @throws \InvalidArgumentException if the given id is invalid */ - public function hasDependency(string $dependencyId): bool { + public function hasDependency(string $dependencyId) { foreach ($this->dependencies as $dependency) { if ($dependency->getId() === $dependencyId) { return true; @@ -323,7 +323,7 @@ trait TFormNode { * @throws \BadMethodCallException if id has already been set * @throws \InvalidArgumentException if the given id is invalid */ - public function id(string $id): IFormNode { + public function id(string $id) { static::validateId($id); if ($this->__id !== null) { @@ -344,7 +344,7 @@ trait TFormNode { * * @see IFormNode::available() */ - public function isAvailable(): bool { + public function isAvailable() { if ($this->__available && $this instanceof IFormParentNode) { /** @var IFormChildNode $child */ foreach ($this as $child) { @@ -369,7 +369,7 @@ trait TFormNode { * * @throws \BadMethodCallException if this node has already been populated */ - public function populate(): IFormNode { + public function populate() { if ($this->isPopulated) { throw new \BadMethodCallException('Node has already been populated'); } @@ -391,7 +391,7 @@ trait TFormNode { * * @throws \InvalidArgumentException if the given class is invalid */ - public function removeClass(string $class): IFormNode { + public function removeClass(string $class) { static::validateClass($class); $index = array_search($class, $this->__classes); @@ -410,7 +410,7 @@ trait TFormNode { * * @throws \InvalidArgumentException if the given id is invalid or no such dependency exists */ - public function removeDependency(string $dependencyId): IFormNode { + public function removeDependency(string $dependencyId) { foreach ($this->dependencies as $key => $dependency) { if ($dependency->getId() === $dependencyId) { unset($this->dependencies[$key]); @@ -430,7 +430,7 @@ trait TFormNode { * * @throws \InvalidArgumentException if the given id is already used by another node, or otherwise is invalid */ - public static function create(string $id): IFormNode { + public static function create(string $id) { return (new static)->id($id); } 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 e37c5edfb1..78a15846ec 100644 --- a/wcfsetup/install/files/lib/system/form/builder/TFormParentNode.class.php +++ b/wcfsetup/install/files/lib/system/form/builder/TFormParentNode.class.php @@ -33,7 +33,7 @@ trait TFormParentNode { * * @throws \InvalidArgumentException if the given child node cannot be appended */ - public function appendChild(IFormChildNode $child): IFormParentNode { + public function appendChild(IFormChildNode $child) { $this->validateChild($child); $this->__children[] = $child; @@ -51,7 +51,7 @@ trait TFormParentNode { * * @throws \InvalidArgumentException if any of the given child nodes is invalid or cannot be appended */ - public function appendChildren(array $children): IFormParentNode { + public function appendChildren(array $children) { foreach ($children as $child) { $this->appendChild($child); } @@ -66,7 +66,7 @@ trait TFormParentNode { * @param string $nodeId id of searched node * @return bool */ - public function contains(string $nodeId): bool { + public function contains(string $nodeId) { static::validateId($nodeId); foreach ($this->children() as $child) { @@ -87,7 +87,7 @@ trait TFormParentNode { * * @return IFormChildNode[] children of this node */ - public function children(): array { + public function children() { return $this->__children; } @@ -96,7 +96,7 @@ trait TFormParentNode { * * @return int number of children */ - public function count(): int { + public function count() { return count($this->__children); } @@ -105,7 +105,7 @@ trait TFormParentNode { * * @return IFormChildNode current child node */ - public function current(): IFormChildNode { + public function current() { return $this->__children[$this->index]; } @@ -131,7 +131,7 @@ trait TFormParentNode { * * @return \RecursiveIteratorIterator recursive iterator for this node */ - public function getIterator(): \RecursiveIteratorIterator { + public function getIterator() { return new \RecursiveIteratorIterator($this, \RecursiveIteratorIterator::SELF_FIRST, \RecursiveIteratorIterator::CATCH_GET_CHILD); } @@ -170,7 +170,7 @@ trait TFormParentNode { * * @return bool */ - public function hasChildren(): bool { + public function hasChildren() { return !empty($this->__children); } @@ -180,7 +180,7 @@ trait TFormParentNode { * * @return bool */ - public function hasValidationErrors(): bool { + public function hasValidationErrors() { foreach ($this->children() as $child) { if ($child instanceof IFormField) { if (!empty($child->getValidationErrors())) { @@ -206,7 +206,7 @@ trait TFormParentNode { * * @throws \InvalidArgumentException if given node cannot be inserted or reference node id is invalid */ - public function insertBefore(IFormChildNode $child, string $referenceNodeId): IFormParentNode { + public function insertBefore(IFormChildNode $child, string $referenceNodeId) { $didInsertNode = false; foreach ($this->children() as $index => $existingChild) { if ($existingChild->getId() === $referenceNodeId) { @@ -231,7 +231,7 @@ trait TFormParentNode { * * @return int element key during the iteration */ - public function key(): int { + public function key() { return $this->index; } @@ -248,7 +248,7 @@ trait TFormParentNode { * * @return IFormParentNode this node */ - public function readValues(): IFormParentNode { + public function readValues() { if ($this->isAvailable()) { foreach ($this->children() as $child) { if ($child instanceof IFormParentNode) { @@ -276,7 +276,7 @@ trait TFormParentNode { * * @return bool */ - public function valid(): bool { + public function valid() { return isset($this->__children[$this->index]); } diff --git a/wcfsetup/install/files/lib/system/form/builder/container/FormContainer.class.php b/wcfsetup/install/files/lib/system/form/builder/container/FormContainer.class.php index 9f80e91110..51a7e9cbfc 100644 --- a/wcfsetup/install/files/lib/system/form/builder/container/FormContainer.class.php +++ b/wcfsetup/install/files/lib/system/form/builder/container/FormContainer.class.php @@ -33,7 +33,7 @@ class FormContainer implements IFormContainer { /** * @inheritDoc */ - public function getHtml(): string { + public function getHtml() { return WCF::getTPL()->fetch($this->templateName, 'wcf', array_merge($this->getHtmlVariables(), [ 'container' => $this ]), true); 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 6430d938c3..916adf3f45 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 @@ -73,7 +73,7 @@ abstract class AbstractFormField implements IFormField { /** * @inheritDoc */ - public function addValidationError(IFormFieldValidationError $error): IFormField { + public function addValidationError(IFormFieldValidationError $error) { if (empty($this->validationErrors)) { $this->addClass('formError'); } @@ -86,7 +86,7 @@ abstract class AbstractFormField implements IFormField { /** * @inheritDoc */ - public function addValidator(IFormFieldValidator $validator): IFormField { + public function addValidator(IFormFieldValidator $validator) { if ($this->hasValidator($validator->getId())) { throw new \InvalidArgumentException("Validator with id '{$validator->getId()}' already exists."); } @@ -99,7 +99,7 @@ abstract class AbstractFormField implements IFormField { /** * @inheritDoc */ - public function autoFocus(bool $autoFocus = true): IFormField { + public function autoFocus(bool $autoFocus = true) { $this->__autoFocus = $autoFocus; return $this; @@ -108,7 +108,7 @@ abstract class AbstractFormField implements IFormField { /** * @inheritDoc */ - public function getHtml(): string { + public function getHtml() { if ($this->templateName === null) { throw new \LogicException("\$templateName property has not been set."); } @@ -128,7 +128,7 @@ abstract class AbstractFormField implements IFormField { /** * @inheritDoc */ - public function getObjectProperty(): string { + public function getObjectProperty() { if ($this->__objectProperty !== null) { return $this->__objectProperty; } @@ -146,14 +146,14 @@ abstract class AbstractFormField implements IFormField { /** * @inheritDoc */ - public function getValidationErrors(): array { + public function getValidationErrors() { return $this->validationErrors; } /** * @inheritDoc */ - public function getValidators(): array { + public function getValidators() { return $this->validators; } @@ -167,7 +167,7 @@ abstract class AbstractFormField implements IFormField { /** * @inheritDoc */ - public function hasValidator(string $validatorId): bool { + public function hasValidator(string $validatorId) { FormFieldValidator::validateId($validatorId); return isset($this->validators[$validatorId]); @@ -176,14 +176,14 @@ abstract class AbstractFormField implements IFormField { /** * @inheritDoc */ - public function hasSaveValue(): bool { + public function hasSaveValue() { return true; } /** * @inheritDoc */ - public function immutable(bool $immutable = true): IFormField { + public function immutable(bool $immutable = true) { $this->__immutable = $immutable; return $this; @@ -192,28 +192,28 @@ abstract class AbstractFormField implements IFormField { /** * @inheritDoc */ - public function isAutoFocused(): bool { + public function isAutoFocused() { return $this->__autoFocus; } /** * @inheritDoc */ - public function isImmutable(): bool { + public function isImmutable() { return $this->__immutable; } /** * @inheritDoc */ - public function isRequired(): bool { + public function isRequired() { return $this->__required; } /** * @inheritDoc */ - public function loadValueFromObject(IStorableObject $object): IFormField { + public function loadValueFromObject(IStorableObject $object) { if (isset($object->{$this->getObjectProperty()})) { $this->value($object->{$this->getObjectProperty()}); } @@ -225,7 +225,7 @@ abstract class AbstractFormField implements IFormField { * @inheritDoc * @return static */ - public function objectProperty(string $objectProperty): IFormField { + public function objectProperty(string $objectProperty) { if ($objectProperty === '') { $this->__objectProperty = null; } @@ -241,7 +241,7 @@ abstract class AbstractFormField implements IFormField { /** * @inheritDoc */ - public function removeValidator(string $validatorId): IFormField { + public function removeValidator(string $validatorId) { if (!$this->hasValidator($validatorId)) { throw new \InvalidArgumentException("Unknown validator with id '{$validatorId}'"); } @@ -255,7 +255,7 @@ abstract class AbstractFormField implements IFormField { * @inheritDoc * @return static */ - public function required(bool $required = true): IFormField { + public function required(bool $required = true) { $this->__required = $required; return $this; @@ -264,7 +264,7 @@ abstract class AbstractFormField implements IFormField { /** * @inheritDoc */ - public function value($value): IFormField { + public function value($value) { $this->__value = $value; 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 69520cf808..e80756173a 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 @@ -86,7 +86,7 @@ abstract class AbstractNumericFormField extends AbstractFormField implements IMa /** * @inheritDoc */ - public function readValue(): IFormField { + public function readValue() { if ($this->getDocument()->hasRequestData($this->getPrefixedId())) { $value = $this->getDocument()->getRequestData($this->getPrefixedId()); @@ -111,7 +111,7 @@ abstract class AbstractNumericFormField extends AbstractFormField implements IMa * * @throws \InvalidArgumentException if the given step value is invalid */ - public function step($step = null): AbstractNumericFormField { + public function step($step = null) { if ($step !== null) { if ($this->integerValues) { if (!is_int($step)) { @@ -164,9 +164,8 @@ abstract class AbstractNumericFormField extends AbstractFormField implements IMa /** * @inheritDoc - * @return static this field */ - public function value($value): IFormField { + public function value($value) { if ($value !== null) { if (is_string($value) && is_numeric($value)) { if (preg_match('~^\d+$~', $value)) { 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 77164acc7e..5b6ea9c494 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 @@ -5,7 +5,6 @@ use wcf\data\IStorableObject; use wcf\system\acl\ACLHandler; use wcf\system\form\builder\field\data\CustomFormFieldDataProcessor; use wcf\system\form\builder\IFormDocument; -use wcf\system\form\builder\IFormNode; /** * Implementation of a form field for setting acl option values. @@ -52,7 +51,7 @@ class AclFormField extends AbstractFormField implements IObjectTypeFormField { * * @throws \InvalidArgumentException if given category name is invalid */ - public function categoryName(string $categoryName): AclFormField { + public function categoryName(string $categoryName) { // TODO: validation $this->__categoryName = $categoryName; @@ -73,7 +72,7 @@ class AclFormField extends AbstractFormField implements IObjectTypeFormField { /** * @inheritDoc */ - public function getHtmlVariables(): array { + public function getHtmlVariables() { ACLHandler::getInstance()->assignVariables($this->getObjectType()->objectTypeID); $includeAclJavaScript = !static::$includedAclJavaScript; @@ -98,21 +97,21 @@ class AclFormField extends AbstractFormField implements IObjectTypeFormField { /** * @inheritDoc */ - public function getObjectTypeDefinition(): string { + public function getObjectTypeDefinition() { return 'com.woltlab.wcf.acl'; } /** * @inheritDoc */ - public function hasSaveValue(): bool { + public function hasSaveValue() { return false; } /** * @inheritDoc */ - public function loadValueFromObject(IStorableObject $object): IFormField { + public function loadValueFromObject(IStorableObject $object) { $this->objectID = $object->{$object::getDatabaseTableIndexName()}; if ($this->objectID === null) { @@ -125,7 +124,7 @@ class AclFormField extends AbstractFormField implements IObjectTypeFormField { /** * @inheritDoc */ - public function populate(): IFormNode { + public function populate() { parent::populate(); $this->getDocument()->getDataHandler()->add(new CustomFormFieldDataProcessor('acl', function(IFormDocument $document, array $parameters) { @@ -140,7 +139,7 @@ class AclFormField extends AbstractFormField implements IObjectTypeFormField { /** * @inheritDoc */ - public function readValue(): IFormField { + public function readValue() { ACLHandler::getInstance()->readValues($this->getObjectType()->objectTypeID); return $this; diff --git a/wcfsetup/install/files/lib/system/form/builder/field/BooleanFormField.class.php b/wcfsetup/install/files/lib/system/form/builder/field/BooleanFormField.class.php index b90d609086..c44fd7006c 100644 --- a/wcfsetup/install/files/lib/system/form/builder/field/BooleanFormField.class.php +++ b/wcfsetup/install/files/lib/system/form/builder/field/BooleanFormField.class.php @@ -28,7 +28,7 @@ class BooleanFormField extends AbstractFormField { /** * @inheritDoc */ - public function readValue(): IFormField { + public function readValue() { if ($this->getDocument()->hasRequestData($this->getPrefixedId())) { $this->__value = $this->getDocument()->getRequestData($this->getPrefixedId()) === '1'; } @@ -39,7 +39,7 @@ class BooleanFormField extends AbstractFormField { /** * @inheritDoc */ - public function requiresLabel(): bool { + public function requiresLabel() { return true; } @@ -56,9 +56,8 @@ class BooleanFormField extends AbstractFormField { /** * @inheritDoc - * @return static this field */ - public function value($value): IFormField { + public function value($value) { if (is_string($value) && in_array($value, ['0', '1', 'true', 'false'])) { $value = ($value === '1' || $value === 'true'); } 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 4a6f09d3dd..60806e1ebc 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 @@ -57,7 +57,7 @@ class ClassNameFormField extends TextFormField { * @param bool $classExists determines if entered class must exist * @return static this field */ - public function classExists(bool $classExists = true): ClassNameFormField { + public function classExists(bool $classExists = true) { $this->__classExists = $classExists; return $this; @@ -69,7 +69,7 @@ class ClassNameFormField extends TextFormField { * * @return bool */ - public function getClassExists(): bool { + public function getClassExists() { return $this->__classExists; } @@ -80,7 +80,7 @@ class ClassNameFormField extends TextFormField { * * @return string */ - public function getImplementedInterface(): string { + public function getImplementedInterface() { return $this->__implementedInterface; } @@ -91,7 +91,7 @@ class ClassNameFormField extends TextFormField { * * @return string */ - public function getParentClass(): string { + public function getParentClass() { return $this->__parentClass; } @@ -107,7 +107,7 @@ class ClassNameFormField extends TextFormField { * * @throws \InvalidArgumentException if the entered interface does not exists */ - public function implementedInterface(string $interface): ClassNameFormField { + public function implementedInterface(string $interface) { if (!interface_exists($interface)) { throw new \InvalidArgumentException("Interface '{$interface}' does not exist."); } @@ -130,7 +130,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): ClassNameFormField { + public function instantiable(bool $instantiable = true) { $this->__instantiable = $instantiable; return $this; @@ -142,7 +142,7 @@ class ClassNameFormField extends TextFormField { * * @return bool */ - public function isInstantiable(): bool { + public function isInstantiable() { return $this->__instantiable; } @@ -154,7 +154,7 @@ class ClassNameFormField extends TextFormField { * * @throws \InvalidArgumentException if the entered class does not exists */ - public function parentClass(string $parentClass): ClassNameFormField { + public function parentClass(string $parentClass) { if (!class_exists($parentClass)) { throw new \InvalidArgumentException("Class '{$parentClass}' does not exist."); } @@ -236,7 +236,7 @@ class ClassNameFormField extends TextFormField { /** * @inheritDoc */ - protected static function getDefaultId(): string { + protected static function getDefaultId() { return 'className'; } } diff --git a/wcfsetup/install/files/lib/system/form/builder/field/DescriptionFormField.class.php b/wcfsetup/install/files/lib/system/form/builder/field/DescriptionFormField.class.php index 4b794f0262..9cd3a02106 100644 --- a/wcfsetup/install/files/lib/system/form/builder/field/DescriptionFormField.class.php +++ b/wcfsetup/install/files/lib/system/form/builder/field/DescriptionFormField.class.php @@ -24,7 +24,7 @@ class DescriptionFormField extends MultilineTextFormField { /** * @inheritDoc */ - protected static function getDefaultId(): string { + protected static function getDefaultId() { return 'description'; } } 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 ea313d42b7..93f539614e 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 @@ -23,7 +23,7 @@ interface IFormField extends IFormChildNode, IFormElement { * @param IFormFieldValidationError $error validation error * @return static this field */ - public function addValidationError(IFormFieldValidationError $error): IFormField; + public function addValidationError(IFormFieldValidationError $error); /** * Sets whether this field is auto-focused and returns this field. @@ -31,7 +31,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): IFormField; + public function autoFocus(bool $autoFocus = true); /** * Adds the given validation error to this field and returns this field. @@ -39,7 +39,7 @@ interface IFormField extends IFormChildNode, IFormElement { * @param IFormFieldValidator $validator * @return static this field */ - public function addValidator(IFormFieldValidator $validator): IFormField; + public function addValidator(IFormFieldValidator $validator); /** * Returns the name of the object property this field represents. @@ -48,7 +48,7 @@ interface IFormField extends IFormChildNode, IFormElement { * * @return string */ - public function getObjectProperty(): string; + public function getObjectProperty(); /** * Returns the field value saved in the database. @@ -68,14 +68,14 @@ interface IFormField extends IFormChildNode, IFormElement { * * @return IFormFieldValidationError[] field validation errors */ - public function getValidationErrors(): array; + public function getValidationErrors(); /** * Returns all field value validators of this field. * * @return IFormFieldValidator[] field value validators of this field */ - public function getValidators(): array; + public function getValidators(); /** * Returns the value of this field or `null` if no value has been set. @@ -93,7 +93,7 @@ interface IFormField extends IFormChildNode, IFormElement { * * @throws \InvalidArgumentException if the given id is invalid */ - public function hasValidator(string $validatorId): bool; + public function hasValidator(string $validatorId); /** * Returns `true` if this field provides a value that can simply be stored @@ -106,7 +106,7 @@ interface IFormField extends IFormChildNode, IFormElement { * * @return bool */ - public function hasSaveValue(): bool; + public function hasSaveValue(); /** * Sets whether the value of this field is immutable and returns this field. @@ -114,7 +114,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): IFormField; + public function immutable(bool $immutable = true); /** * Returns `true` if this field is auto-focused and returns `false` otherwise. @@ -122,7 +122,7 @@ interface IFormField extends IFormChildNode, IFormElement { * * @return bool */ - public function isAutoFocused(): bool; + public function isAutoFocused(); /** * Returns `true` if the value of this field is immutable and returns `false` @@ -130,7 +130,7 @@ interface IFormField extends IFormChildNode, IFormElement { * * @return bool */ - public function isImmutable(): bool; + public function isImmutable(); /** * Returns `true` if this field has to be filled out and returns `false` otherwise. @@ -138,7 +138,7 @@ interface IFormField extends IFormChildNode, IFormElement { * * @return bool */ - public function isRequired(): bool; + public function isRequired(); /** * Loads the field value from the given object and returns this field. @@ -146,7 +146,7 @@ interface IFormField extends IFormChildNode, IFormElement { * @param IStorableObject $object object used to load field value * @return static this field */ - public function loadValueFromObject(IStorableObject $object): IFormField; + public function loadValueFromObject(IStorableObject $object); /** * Sets the name of the object property this field represents. If an empty @@ -163,14 +163,14 @@ interface IFormField extends IFormChildNode, IFormElement { * * @throws \InvalidArgumentException if the passed object property is no valid id */ - public function objectProperty(string $objectProperty): IFormField; + public function objectProperty(string $objectProperty); /** * Reads the value of this field from request data and return this field. * * @return static this field */ - public function readValue(): IFormField; + public function readValue(); /** * Removes the field value validator with the given id and returns this field. @@ -180,7 +180,7 @@ interface IFormField extends IFormChildNode, IFormElement { * * @throws \InvalidArgumentException if the given id is invalid or no such validator exists */ - public function removeValidator(string $validatorId): IFormField; + public function removeValidator(string $validatorId); /** * Sets whether it is required to fill out this field and returns this field. @@ -188,7 +188,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): IFormField; + public function required(bool $required = true); /** * Sets the value of this field and returns this field. @@ -198,5 +198,5 @@ interface IFormField extends IFormChildNode, IFormElement { * * @throws \InvalidArgumentException if the given value is of an invalid type or otherwise is invalid */ - public function value($value): IFormField; + public function value($value); } 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 4809655fa3..f118c95e44 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 @@ -19,7 +19,7 @@ interface II18nFormField extends IFormField { * * @throws \BadMethodCallException if i18n is disabled for this field or no language item has been set */ - public function getLanguageItemPattern(): string; + public function getLanguageItemPattern(); /** * Returns `true` if the current field value is a i18n value and returns `false` @@ -27,7 +27,7 @@ interface II18nFormField extends IFormField { * * @return bool */ - public function hasI18nValues(): bool; + public function hasI18nValues(); /** * Returns `true` if the current field value is a plain value and returns `false` @@ -35,7 +35,7 @@ interface II18nFormField extends IFormField { * * @return bool */ - public function hasPlainValue(): bool; + public function hasPlainValue(); /** * Sets whether this field is supports i18n input and returns this field. @@ -43,7 +43,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): II18nFormField; + public function i18n(bool $i18n = true); /** * Sets whether this field's value must be i18n input and returns this field. @@ -54,7 +54,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): II18nFormField; + public function i18nRequired(bool $i18nRequired = true); /** * Returns `true` if this field supports i18n input and returns `false` otherwise. @@ -62,7 +62,7 @@ interface II18nFormField extends IFormField { * * @return bool */ - public function isI18n(): bool; + public function isI18n(); /** * Returns `true` if this field's value must be i18n input and returns `false` otherwise. @@ -70,7 +70,7 @@ interface II18nFormField extends IFormField { * * @return bool */ - public function isI18nRequired(): bool; + public function isI18nRequired(); /** * Sets the pattern for the language item used to save the i18n values @@ -82,5 +82,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): II18nFormField; + public function languageItemPattern(string $pattern); } diff --git a/wcfsetup/install/files/lib/system/form/builder/field/IMaximumFormField.class.php b/wcfsetup/install/files/lib/system/form/builder/field/IMaximumFormField.class.php index 176311da3e..fdfca03106 100644 --- a/wcfsetup/install/files/lib/system/form/builder/field/IMaximumFormField.class.php +++ b/wcfsetup/install/files/lib/system/form/builder/field/IMaximumFormField.class.php @@ -29,5 +29,5 @@ interface IMaximumFormField { * * @throws \InvalidArgumentException if the given maximum is no number or otherwise invalid */ - public function maximum($maximum = null): IMaximumFormField; + public function maximum($maximum = null); } 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 fb1ae5432d..f1cee1c30c 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 @@ -30,7 +30,7 @@ interface IMaximumLengthFormField { * * @throws \InvalidArgumentException if the given maximum length is no integer or otherwise invalid */ - public function maximumLength(int $maximumLength = null): IMaximumLengthFormField; + public function maximumLength(int $maximumLength = null); /** * Validates the maximum length of the given text. diff --git a/wcfsetup/install/files/lib/system/form/builder/field/IMinimumFormField.class.php b/wcfsetup/install/files/lib/system/form/builder/field/IMinimumFormField.class.php index 43931745af..67c03a2c7d 100644 --- a/wcfsetup/install/files/lib/system/form/builder/field/IMinimumFormField.class.php +++ b/wcfsetup/install/files/lib/system/form/builder/field/IMinimumFormField.class.php @@ -29,5 +29,5 @@ interface IMinimumFormField { * * @throws \InvalidArgumentException if the given minimum is no number or otherwise invalid */ - public function minimum($minimum = null): IMinimumFormField; + public function minimum($minimum = 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 d5c21e3ba8..99cd230373 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 @@ -30,7 +30,7 @@ interface IMinimumLengthFormField { * * @throws \InvalidArgumentException if the given minimum length is no integer or otherwise invalid */ - public function minimumLength(int $minimumLength = null): IMinimumLengthFormField; + public function minimumLength(int $minimumLength = null); /** * Validates the minimum length of the given text. 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 e315f4fc1b..ae6e4d7b75 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 @@ -26,7 +26,7 @@ interface IMultipleFormField { * * @return bool */ - public function allowsMultiple(): bool; + public function allowsMultiple(); /** * Returns the maximum number of values that can be selected or set. @@ -35,7 +35,7 @@ interface IMultipleFormField { * * @return int maximum number of values */ - public function getMaximumMultiples(): int; + public function getMaximumMultiples(); /** * Returns the minimum number of values that can be selected or set. @@ -44,7 +44,7 @@ interface IMultipleFormField { * * @return int minimum number of values */ - public function getMinimumMultiples(): int; + public function getMinimumMultiples(); /** * Sets the maximum number of values that can be selected or set and returns @@ -55,18 +55,18 @@ interface IMultipleFormField { * * @throws \InvalidArgumentException if the given maximum number of values is invalid */ - public function maximumMultiples(int $maximum): IMultipleFormField; + public function maximumMultiples(int $maximum); /** * Sets the minimum number of values that can be selected or set and returns * this field. * - * @param int $maximum maximum number of values + * @param int $minimum maximum number of values * @return static this field * * @throws \InvalidArgumentException if the given minimum number of values is invalid */ - public function minimumMultiples(int $minimum): IMultipleFormField; + public function minimumMultiples(int $minimum); /** * Sets whether multiple values can be selected or set and returns this field. @@ -74,5 +74,5 @@ interface IMultipleFormField { * @param bool $multiple determines if multiple values can be selected/set * @return static this field */ - public function multiple(bool $multiple = true): IMultipleFormField; + public function multiple(bool $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 7b579762f2..8f2c583de4 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 @@ -20,7 +20,7 @@ interface INullableFormField { * * @return bool */ - public function isNullable(): bool; + public function isNullable(); /** * Sets whether this field supports `null` as its value and returns this field. @@ -28,5 +28,5 @@ interface INullableFormField { * @param bool $nullable determines if field supports `null` as its value * @return static this node */ - public function nullable(bool $nullable = true): INullableFormField; + public function nullable(bool $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 275496123c..734c6d9de8 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 @@ -21,7 +21,7 @@ interface IObjectTypeFormField { * * @throws \BadMethodCallException if object type has not been set */ - public function getObjectType(): ObjectType; + public function getObjectType(); /** * Sets the name of the object type and returns this field. @@ -33,12 +33,12 @@ 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): IObjectTypeFormField; + public function objectType(string $objectType); /** * Returns the name of the object type definition the set object type must be of. * * @return string name of object type's definition */ - public function getObjectTypeDefinition(): string; + public function getObjectTypeDefinition(); } 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 461a02486a..faf39ffdd0 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 @@ -31,5 +31,5 @@ interface IPlaceholderFormField { * * @throws \InvalidArgumentException if the given value is invalid */ - public function placeholder(string $languageItem = null, array $variables = []): IPlaceholderFormField; + public function placeholder(string $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 ba561657f0..57254a5844 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 @@ -21,7 +21,7 @@ interface ISelectionFormField { * @return array * @throws \BadMethodCallException if nested options are not supported */ - public function getNestedOptions(): array; + public function getNestedOptions(); /** * Returns the possible options of this field. @@ -30,7 +30,7 @@ interface ISelectionFormField { * * @throws \BadMethodCallException if no options have been set */ - public function getOptions(): array; + public function getOptions(); /** * Sets the possible options of this field and returns this field. @@ -58,12 +58,12 @@ 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): ISelectionFormField; + public function options($options, bool $nestedOptions = false); /** * Returns `true` if the field class supports nested options and `false` otherwise. * * @return bool */ - public function supportsNestedOptions(): bool; + public function supportsNestedOptions(); } 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 a43e022801..5403fb58c1 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 @@ -29,5 +29,5 @@ interface ISuffixedFormField { * * @throws \InvalidArgumentException if the given language item is invalid */ - public function suffix(string $languageItem = null, array $variables = []): ISuffixedFormField; + public function suffix(string $languageItem = null, array $variables = []); } diff --git a/wcfsetup/install/files/lib/system/form/builder/field/IconFormField.class.php b/wcfsetup/install/files/lib/system/form/builder/field/IconFormField.class.php index ceaabe848f..847406af71 100644 --- a/wcfsetup/install/files/lib/system/form/builder/field/IconFormField.class.php +++ b/wcfsetup/install/files/lib/system/form/builder/field/IconFormField.class.php @@ -29,7 +29,7 @@ class IconFormField extends AbstractFormField { /** * @inheritDoc */ - public function getHtmlVariables(): array { + public function getHtmlVariables() { $value = static::$includeJavaScript; if (static::$includeJavaScript) { static::$includeJavaScript = false; @@ -54,7 +54,7 @@ class IconFormField extends AbstractFormField { /** * @inheritDoc */ - public function readValue(): IFormField { + public function readValue() { if ($this->getDocument()->hasRequestData($this->getPrefixedId())) { $this->__value = $this->getDocument()->getRequestData($this->getPrefixedId()); } @@ -84,7 +84,7 @@ class IconFormField extends AbstractFormField { /** * @inheritDoc */ - public function value($value): IFormField { + public function value($value) { $value = preg_replace('~^fa-~', '', $value); return parent::value($value); diff --git a/wcfsetup/install/files/lib/system/form/builder/field/IsDisabledFormField.class.php b/wcfsetup/install/files/lib/system/form/builder/field/IsDisabledFormField.class.php index bb897b2a54..29ae7b1083 100644 --- a/wcfsetup/install/files/lib/system/form/builder/field/IsDisabledFormField.class.php +++ b/wcfsetup/install/files/lib/system/form/builder/field/IsDisabledFormField.class.php @@ -17,7 +17,7 @@ class IsDisabledFormField extends BooleanFormField { /** * @inheritDoc */ - protected static function getDefaultId(): string { + protected static function getDefaultId() { return 'isDisabled'; } } 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 6f553b582b..705ecd0c3b 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 @@ -4,7 +4,6 @@ namespace wcf\system\form\builder\field; use wcf\system\form\builder\field\data\CustomFormFieldDataProcessor; use wcf\system\form\builder\field\validation\FormFieldValidationError; use wcf\system\form\builder\IFormDocument; -use wcf\system\form\builder\IFormNode; use wcf\util\ArrayUtil; /** @@ -74,7 +73,7 @@ class ItemListFormField extends AbstractFormField { * * @return string */ - public function getSaveValueType(): string { + public function getSaveValueType() { if ($this->saveValueType === null) { $this->saveValueType = self::SAVE_VALUE_TYPE_CSV; } @@ -85,7 +84,7 @@ class ItemListFormField extends AbstractFormField { /** * @inheritDoc */ - public function hasSaveValue(): bool { + public function hasSaveValue() { // arrays cannot be returned as a simple save value return $this->getSaveValueType() !== self::SAVE_VALUE_TYPE_ARRAY; } @@ -93,7 +92,7 @@ class ItemListFormField extends AbstractFormField { /** * @inheritDoc */ - public function populate(): IFormNode { + public function populate() { parent::populate(); // an array should be passed as a parameter outside of the `data` array @@ -113,7 +112,7 @@ class ItemListFormField extends AbstractFormField { /** * @inheritDoc */ - public function readValue(): IFormField { + public function readValue() { if ($this->getDocument()->hasRequestData($this->getPrefixedId())) { $value = $this->getDocument()->getRequestData($this->getPrefixedId()); @@ -133,7 +132,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): ItemListFormField { + public function saveValueType(string $saveValueType) { if ($this->saveValueType !== null) { throw new \BadMethodCallException("Save value type has already been set."); } @@ -150,7 +149,7 @@ class ItemListFormField extends AbstractFormField { /** * @inheritDoc */ - public function value($value): IFormField { + public function value($value) { switch ($this->getSaveValueType()) { case self::SAVE_VALUE_TYPE_ARRAY: if (is_array($value)) { 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 afa95f01dc..54e7ac8e11 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 @@ -29,7 +29,7 @@ class MultilineTextFormField extends TextFormField { * * @return int number of textarea rows */ - public function getRows(): int { + public function getRows() { return $this->__rows; } @@ -41,7 +41,7 @@ class MultilineTextFormField extends TextFormField { * * @throws \InvalidArgumentException if given number of rows is invalid */ - public function rows(int $rows): MultilineTextFormField { + public function rows(int $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/MultipleSelectionFormField.class.php b/wcfsetup/install/files/lib/system/form/builder/field/MultipleSelectionFormField.class.php index 3dbd23f48c..f2661aabdb 100644 --- a/wcfsetup/install/files/lib/system/form/builder/field/MultipleSelectionFormField.class.php +++ b/wcfsetup/install/files/lib/system/form/builder/field/MultipleSelectionFormField.class.php @@ -24,7 +24,7 @@ class MultipleSelectionFormField extends AbstractFormField implements INullableF /** * @inheritDoc */ - public function readValue(): IFormField { + public function readValue() { if ($this->getDocument()->hasRequestData($this->getPrefixedId())) { $value = $this->getDocument()->getRequestData($this->getPrefixedId()); @@ -56,7 +56,7 @@ class MultipleSelectionFormField extends AbstractFormField implements INullableF /** * @inheritDoc */ - public function value($value): IFormField { + public function value($value) { // ignore `null` as value which can be passed either for nullable // fields or as value if no options are available if ($value === null) { diff --git a/wcfsetup/install/files/lib/system/form/builder/field/RadioButtonFormField.class.php b/wcfsetup/install/files/lib/system/form/builder/field/RadioButtonFormField.class.php index 25f0c412f2..f4b2120fec 100644 --- a/wcfsetup/install/files/lib/system/form/builder/field/RadioButtonFormField.class.php +++ b/wcfsetup/install/files/lib/system/form/builder/field/RadioButtonFormField.class.php @@ -22,7 +22,7 @@ class RadioButtonFormField extends AbstractFormField implements ISelectionFormFi /** * @inheritDoc */ - public function readValue(): IFormField { + public function readValue() { if ($this->getDocument()->hasRequestData($this->getPrefixedId())) { $value = $this->getDocument()->getRequestData($this->getPrefixedId()); @@ -37,7 +37,7 @@ class RadioButtonFormField extends AbstractFormField implements ISelectionFormFi /** * @inheritDoc */ - public function supportsNestedOptions(): bool { + public function supportsNestedOptions() { return false; } } 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 015c2820a6..d95e30623c 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 @@ -64,7 +64,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): ISelectionFormField { + public function options($options, bool $nestedOptions = false) { parent::options($options, $nestedOptions); $this->__options = [0 => WCF::getLanguage()->get('wcf.form.field.showOrder.firstPosition')] + $this->__options; @@ -82,7 +82,7 @@ class ShowOrderFormField extends SingleSelectionFormField { /** * @inheritDoc */ - public function value($value): IFormField { + public function value($value) { $keys = array_keys($this->getOptions()); // when editing an objects, the value has to be reduced by one to determine the @@ -101,7 +101,7 @@ class ShowOrderFormField extends SingleSelectionFormField { /** * @inheritDoc */ - protected static function getDefaultId(): string { + protected static function getDefaultId() { return 'showOrder'; } } diff --git a/wcfsetup/install/files/lib/system/form/builder/field/SimpleAclFormField.class.php b/wcfsetup/install/files/lib/system/form/builder/field/SimpleAclFormField.class.php index b4f62df815..b8daa95454 100644 --- a/wcfsetup/install/files/lib/system/form/builder/field/SimpleAclFormField.class.php +++ b/wcfsetup/install/files/lib/system/form/builder/field/SimpleAclFormField.class.php @@ -4,7 +4,6 @@ namespace wcf\system\form\builder\field; use wcf\system\acl\simple\SimpleAclHandler; use wcf\system\form\builder\field\data\CustomFormFieldDataProcessor; use wcf\system\form\builder\IFormDocument; -use wcf\system\form\builder\IFormNode; /** * Implementation of a form field for setting simple acl. @@ -27,7 +26,7 @@ class SimpleAclFormField extends AbstractFormField { /** * @inheritDoc */ - public function getHtmlVariables(): array { + public function getHtmlVariables() { return [ '__aclSimplePrefix' => $this->getPrefixedId(), '__aclInputName' => $this->getPrefixedId(), @@ -38,14 +37,14 @@ class SimpleAclFormField extends AbstractFormField { /** * @inheritDoc */ - public function hasSaveValue(): bool { + public function hasSaveValue() { return false; } /** * @inheritDoc */ - public function populate(): IFormNode { + public function populate() { parent::populate(); $this->getDocument()->getDataHandler()->add(new CustomFormFieldDataProcessor('i18n', function(IFormDocument $document, array $parameters) { @@ -62,7 +61,7 @@ class SimpleAclFormField extends AbstractFormField { /** * @inheritDoc */ - public function readValue(): IFormField { + public function readValue() { if ($this->getDocument()->hasRequestData($this->getPrefixedId())) { $value = $this->getDocument()->getRequestData($this->getPrefixedId()); diff --git a/wcfsetup/install/files/lib/system/form/builder/field/SingleSelectionFormField.class.php b/wcfsetup/install/files/lib/system/form/builder/field/SingleSelectionFormField.class.php index 7e542a628b..f29f224cf0 100644 --- a/wcfsetup/install/files/lib/system/form/builder/field/SingleSelectionFormField.class.php +++ b/wcfsetup/install/files/lib/system/form/builder/field/SingleSelectionFormField.class.php @@ -35,7 +35,7 @@ class SingleSelectionFormField extends AbstractFormField implements INullableFor /** * @inheritDoc */ - public function readValue(): IFormField { + public function readValue() { if ($this->getDocument()->hasRequestData($this->getPrefixedId())) { $value = $this->getDocument()->getRequestData($this->getPrefixedId()); @@ -64,7 +64,7 @@ class SingleSelectionFormField extends AbstractFormField implements INullableFor /** * @inheritDoc */ - public function value($value): IFormField { + public function value($value) { // ignore `null` as value which can be passed either for nullable // fields or as value if no options are available if ($value === null) { diff --git a/wcfsetup/install/files/lib/system/form/builder/field/SortOrderFormField.class.php b/wcfsetup/install/files/lib/system/form/builder/field/SortOrderFormField.class.php index fc934594e8..2712bf1c81 100644 --- a/wcfsetup/install/files/lib/system/form/builder/field/SortOrderFormField.class.php +++ b/wcfsetup/install/files/lib/system/form/builder/field/SortOrderFormField.class.php @@ -31,7 +31,7 @@ class SortOrderFormField extends SingleSelectionFormField { /** * @inheritDoc */ - protected static function getDefaultId(): string { + protected static function getDefaultId() { return 'sortOrder'; } } 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 df7be8350b..26e9c9af85 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 @@ -1,7 +1,6 @@ isI18n()) { I18nHandler::getInstance()->assignVariables(); @@ -68,7 +68,7 @@ trait TI18nFormField { * * @throws \BadMethodCallException if i18n is disabled for this field or no language item has been set */ - public function getLanguageItemPattern(): string { + public function getLanguageItemPattern() { if (!$this->isI18n()) { throw new \BadMethodCallException("You can only get the language item pattern for fields with i18n enabled."); } @@ -128,7 +128,7 @@ trait TI18nFormField { * * @return bool */ - public function hasI18nValues(): bool { + public function hasI18nValues() { return I18nHandler::getInstance()->hasI18nValues($this->getPrefixedId()); } @@ -138,7 +138,7 @@ trait TI18nFormField { * * @return bool */ - public function hasPlainValue(): bool { + public function hasPlainValue() { return I18nHandler::getInstance()->isPlainValue($this->getPrefixedId()); } @@ -153,7 +153,7 @@ trait TI18nFormField { * * @return bool */ - public function hasSaveValue(): bool { + public function hasSaveValue() { return !$this->isI18n() || $this->hasPlainValue(); } @@ -163,7 +163,7 @@ trait TI18nFormField { * @param bool $i18n determines if field supports i18n input * @return II18nFormField this field */ - public function i18n(bool $i18n = true): II18nFormField { + public function i18n(bool $i18n = true) { $this->__i18n = $i18n; return $this; @@ -178,7 +178,7 @@ trait TI18nFormField { * @param bool $i18nRequired determines if field value must be i18n input * @return static this field */ - public function i18nRequired(bool $i18nRequired = true): II18nFormField { + public function i18nRequired(bool $i18nRequired = true) { $this->__i18nRequired = $i18nRequired; $this->i18n(); @@ -191,7 +191,7 @@ trait TI18nFormField { * * @return bool */ - public function isI18n(): bool { + public function isI18n() { return $this->__i18n; } @@ -201,7 +201,7 @@ trait TI18nFormField { * * @return bool */ - public function isI18nRequired(): bool { + public function isI18nRequired() { return $this->__i18nRequired; } @@ -215,7 +215,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): II18nFormField { + public function languageItemPattern(string $pattern) { if (!$this->isI18n()) { throw new \BadMethodCallException("The language item pattern can only be set for fields with i18n enabled."); } @@ -232,7 +232,7 @@ trait TI18nFormField { /** * @inheritDoc */ - public function loadValueFromObject(IStorableObject $object): IFormField { + public function loadValueFromObject(IStorableObject $object) { if (isset($object->{$this->getId()})) { $value = $object->{$this->getId()}; @@ -260,7 +260,7 @@ trait TI18nFormField { * * @throws \BadMethodCallException if this node has already been populated */ - public function populate(): IFormNode { + public function populate() { parent::populate(); if ($this->isI18n()) { @@ -286,7 +286,7 @@ trait TI18nFormField { * * @return IFormField this field */ - public function readValue(): IFormField { + public function readValue() { if ($this->isI18n()) { I18nHandler::getInstance()->readValues(); } @@ -335,7 +335,7 @@ trait TI18nFormField { * * @throws \InvalidArgumentException if the given value is of an invalid type or otherwise is invalid */ - public function value($value): IFormField { + public function value($value) { if ($this->isI18n()) { if (is_string($value)) { $this->setStringValue($value); diff --git a/wcfsetup/install/files/lib/system/form/builder/field/TMaximumFormField.class.php b/wcfsetup/install/files/lib/system/form/builder/field/TMaximumFormField.class.php index 858af5b8b6..126685acd5 100644 --- a/wcfsetup/install/files/lib/system/form/builder/field/TMaximumFormField.class.php +++ b/wcfsetup/install/files/lib/system/form/builder/field/TMaximumFormField.class.php @@ -37,7 +37,7 @@ trait TMaximumFormField { * * @throws \InvalidArgumentException if the given maximum is no number or otherwise invalid */ - public function maximum($maximum = null): IMaximumFormField { + public function maximum($maximum = null) { if ($maximum !== null) { if (!is_numeric($maximum)) { throw new \InvalidArgumentException("Given maximum is no int, '" . gettype($maximum) . "' given."); 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 776f341c5a..04b3bb1e66 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 @@ -39,7 +39,7 @@ trait TMaximumLengthFormField { * * @throws \InvalidArgumentException if the given maximum length is no integer or otherwise invalid */ - public function maximumLength(int $maximumLength = null): IMaximumLengthFormField { + public function maximumLength(int $maximumLength = null) { if ($maximumLength !== null) { if (!is_int($maximumLength)) { throw new \InvalidArgumentException("Given maximum length is no int, '" . gettype($maximumLength) . "' given."); diff --git a/wcfsetup/install/files/lib/system/form/builder/field/TMinimumFormField.class.php b/wcfsetup/install/files/lib/system/form/builder/field/TMinimumFormField.class.php index 90d0dbf738..eca635a280 100644 --- a/wcfsetup/install/files/lib/system/form/builder/field/TMinimumFormField.class.php +++ b/wcfsetup/install/files/lib/system/form/builder/field/TMinimumFormField.class.php @@ -37,7 +37,7 @@ trait TMinimumFormField { * * @throws \InvalidArgumentException if the given minimum is no number or otherwise invalid */ - public function minimum($minimum = null): IMinimumFormField { + public function minimum($minimum = null) { if ($minimum !== null) { if (!is_numeric($minimum)) { throw new \InvalidArgumentException("Given minimum is no int, '" . gettype($minimum) . "' given."); 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 0a1fb92aa8..154e10b582 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 @@ -39,7 +39,7 @@ trait TMinimumLengthFormField { * * @throws \InvalidArgumentException if the given minimum length is no integer or otherwise invalid */ - public function minimumLength(int $minimumLength = null): IMinimumLengthFormField { + public function minimumLength(int $minimumLength = null) { if ($minimumLength !== null) { if (!is_int($minimumLength)) { throw new \InvalidArgumentException("Given minimum length is no int, '" . gettype($minimumLength) . "' given."); 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 49d98364d1..41f2c4a6e4 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 @@ -3,7 +3,6 @@ declare(strict_types=1); namespace wcf\system\form\builder\field; use wcf\system\form\builder\field\data\CustomFormFieldDataProcessor; use wcf\system\form\builder\IFormDocument; -use wcf\system\form\builder\IFormNode; /** * Provides default implementations of `IMultipleFormField` methods. @@ -41,7 +40,7 @@ trait TMultipleFormField { * * @return bool */ - public function allowsMultiple(): bool { + public function allowsMultiple() { return $this->__multiple; } @@ -52,7 +51,7 @@ trait TMultipleFormField { * * @return int maximum number of values */ - public function getMaximumMultiples(): int { + public function getMaximumMultiples() { return $this->__maximumMultiples; } @@ -63,7 +62,7 @@ trait TMultipleFormField { * * @return int minimum number of values */ - public function getMinimumMultiples(): int { + public function getMinimumMultiples() { return $this->__minimumMultiples; } @@ -78,7 +77,7 @@ trait TMultipleFormField { * * @return bool */ - public function hasSaveValue(): bool { + public function hasSaveValue() { return !$this->allowsMultiple(); } @@ -91,7 +90,7 @@ trait TMultipleFormField { * * @throws \InvalidArgumentException if the given maximum number of values is invalid */ - public function maximumMultiples(int $maximum): IMultipleFormField { + public function maximumMultiples(int $maximum) { if ($maximum !== IMultipleFormField::NO_MAXIMUM_MULTIPLES) { if ($maximum <= 0) { throw new \InvalidArgumentException("The maximum number of values has to be positive, '{$maximum}' given."); @@ -116,7 +115,7 @@ trait TMultipleFormField { * * @throws \InvalidArgumentException if the given minimum number of values is invalid */ - public function minimumMultiples(int $minimum): IMultipleFormField { + public function minimumMultiples(int $minimum) { if ($minimum < 0) { throw new \InvalidArgumentException("The minimum number of values has to be non-negative, '{$minimum}' given."); } @@ -136,7 +135,7 @@ trait TMultipleFormField { * @param bool $multiple determines if multiple values can be selected/set * @return static this field */ - public function multiple(bool $multiple = true): IMultipleFormField { + public function multiple(bool $multiple = true) { $this->__multiple = $multiple; return $this; @@ -152,7 +151,7 @@ trait TMultipleFormField { * * @throws \BadMethodCallException if this node has already been populated */ - public function populate(): IFormNode { + public function populate() { parent::populate(); if ($this->allowsMultiple()) { @@ -176,7 +175,7 @@ trait TMultipleFormField { * * @throws \InvalidArgumentException if the given value is of an invalid type or otherwise is invalid */ - public function value($value): IFormField { + public function value($value) { // ensure array value for form fields that actually support multiple values; // allows enabling support for multiple values for existing fields if ($this->allowsMultiple() && !is_array($value)) { 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 4c670d5f1f..52221b8f5e 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 @@ -26,7 +26,7 @@ trait TNullableFormField { * * @return bool */ - public function isNullable(): bool { + public function isNullable() { return $this->__nullable; } @@ -36,7 +36,7 @@ trait TNullableFormField { * @param bool $nullable determines if field supports `null` as its value * @return static this node */ - public function nullable(bool $nullable = true): INullableFormField { + public function nullable(bool $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 bb30a6a55c..394454460d 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 @@ -28,7 +28,7 @@ trait TObjectTypeFormField { * * @throws \BadMethodCallException if object type has not been set */ - public function getObjectType(): ObjectType { + public function getObjectType() { if ($this->__objectType === null) { throw new \BadMethodCallException("Object type has not been set."); } @@ -46,7 +46,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): IObjectTypeFormField { + public function objectType(string $objectType) { if ($this->__objectType !== null) { throw new \BadMethodCallException("Object type has already been set."); } @@ -68,5 +68,5 @@ trait TObjectTypeFormField { * * @return string name of object type's definition */ - abstract public function getObjectTypeDefinition(): string; + abstract public function getObjectTypeDefinition(); } 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 79ddce00ef..4ef3baf0f0 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 @@ -40,7 +40,7 @@ trait TPlaceholderFormField { * * @throws \InvalidArgumentException if the given value is no string or otherwise invalid */ - public function placeholder(string $languageItem = null, array $variables = []): IPlaceholderFormField { + public function placeholder(string $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 c809bf99a2..ba2cacb74e 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 @@ -42,7 +42,7 @@ trait TSelectionFormField { * @param bool $filterable determines if field's options are filterable by user * @return static this node */ - public function filterable($filterable = true): ISelectionFormField { + public function filterable($filterable = true) { $this->__filterable = $filterable; return $this; @@ -56,7 +56,7 @@ trait TSelectionFormField { * @return array * @throws \BadMethodCallException if nested options are not supported */ - public function getNestedOptions(): array { + public function getNestedOptions() { if (!$this->supportsNestedOptions()) { throw new \BadMethodCallException("Nested options are not supported."); } @@ -71,7 +71,7 @@ trait TSelectionFormField { * * @throws \BadMethodCallException if no options have been set */ - public function getOptions(): array { + public function getOptions() { return $this->__options; } @@ -84,7 +84,7 @@ trait TSelectionFormField { * * @see IFormNode::available() */ - public function isAvailable(): bool { + public function isAvailable() { // selections without any possible values are not available return !empty($this->__options) && parent::isAvailable(); } @@ -98,7 +98,7 @@ trait TSelectionFormField { * * @return bool */ - public function isFilterable(): bool { + public function isFilterable() { return $this->__filterable; } @@ -116,7 +116,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): ISelectionFormField { + public function options($options, bool $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."); @@ -266,7 +266,7 @@ trait TSelectionFormField { * * @return bool */ - public function supportsNestedOptions(): bool { + public function supportsNestedOptions() { return true; } } 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 c5ea8684c1..a0c6d22e0c 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 @@ -38,7 +38,7 @@ trait TSuffixedFormField { * * @throws \InvalidArgumentException if the given language item is no string or otherwise invalid */ - public function suffix(string $languageItem = null, array $variables = []): ISuffixedFormField { + public function suffix(string $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/TagFormField.class.php b/wcfsetup/install/files/lib/system/form/builder/field/TagFormField.class.php index 3e8fde09a3..694634b36c 100644 --- a/wcfsetup/install/files/lib/system/form/builder/field/TagFormField.class.php +++ b/wcfsetup/install/files/lib/system/form/builder/field/TagFormField.class.php @@ -5,7 +5,6 @@ use wcf\data\tag\Tag; use wcf\data\IStorableObject; use wcf\system\form\builder\field\data\CustomFormFieldDataProcessor; use wcf\system\form\builder\IFormDocument; -use wcf\system\form\builder\IFormNode; use wcf\system\tagging\TagEngine; use wcf\util\ArrayUtil; @@ -40,21 +39,21 @@ class TagFormField extends AbstractFormField implements IObjectTypeFormField { /** * @inheritDoc */ - public function getObjectTypeDefinition(): string { + public function getObjectTypeDefinition() { return 'com.woltlab.wcf.tagging.taggableObject'; } /** * @inheritDoc */ - public function hasSaveValue(): bool { + public function hasSaveValue() { return false; } /** * @inheritDoc */ - public function loadValueFromObject(IStorableObject $object): IFormField { + public function loadValueFromObject(IStorableObject $object) { $objectID = $object->{$object::getDatabaseTableIndexName()}; if ($objectID === null) { @@ -83,7 +82,7 @@ class TagFormField extends AbstractFormField implements IObjectTypeFormField { /** * @inheritDoc */ - public function populate(): IFormNode { + public function populate() { parent::populate(); $this->getDocument()->getDataHandler()->add(new CustomFormFieldDataProcessor('acl', function(IFormDocument $document, array $parameters) { @@ -100,7 +99,7 @@ class TagFormField extends AbstractFormField implements IObjectTypeFormField { /** * @inheritDoc */ - public function readValue(): IFormField { + public function readValue() { if ($this->getDocument()->hasRequestData($this->getPrefixedId())) { $value = $this->getDocument()->getRequestData($this->getPrefixedId()); @@ -114,9 +113,8 @@ class TagFormField extends AbstractFormField implements IObjectTypeFormField { /** * @inheritDoc - * @return static this field */ - public function value($value): IFormField { + public function value($value) { if (!is_array($value)) { throw new \InvalidArgumentException("Given value is no array, " . gettype($value) . " given."); } diff --git a/wcfsetup/install/files/lib/system/form/builder/field/TitleFormField.class.php b/wcfsetup/install/files/lib/system/form/builder/field/TitleFormField.class.php index d0bb611b62..4f4c5d8b78 100644 --- a/wcfsetup/install/files/lib/system/form/builder/field/TitleFormField.class.php +++ b/wcfsetup/install/files/lib/system/form/builder/field/TitleFormField.class.php @@ -24,7 +24,7 @@ class TitleFormField extends TextFormField { /** * @inheritDoc */ - protected static function getDefaultId(): string { + protected static function getDefaultId() { return 'title'; } } diff --git a/wcfsetup/install/files/lib/system/form/builder/field/UserFormField.class.php b/wcfsetup/install/files/lib/system/form/builder/field/UserFormField.class.php index ce7363cf97..65d6853334 100644 --- a/wcfsetup/install/files/lib/system/form/builder/field/UserFormField.class.php +++ b/wcfsetup/install/files/lib/system/form/builder/field/UserFormField.class.php @@ -27,7 +27,7 @@ class UserFormField extends AbstractFormField implements IMultipleFormField, INu /** * @inheritDoc */ - public function readValue(): IFormField { + public function readValue() { if ($this->getDocument()->hasRequestData($this->getPrefixedId())) { $value = $this->getDocument()->getRequestData($this->getPrefixedId()); diff --git a/wcfsetup/install/files/lib/system/form/builder/field/UsernameFormField.class.php b/wcfsetup/install/files/lib/system/form/builder/field/UsernameFormField.class.php index aedaaa39fa..387e1669ea 100644 --- a/wcfsetup/install/files/lib/system/form/builder/field/UsernameFormField.class.php +++ b/wcfsetup/install/files/lib/system/form/builder/field/UsernameFormField.class.php @@ -48,7 +48,7 @@ class UsernameFormField extends AbstractFormField implements IMaximumLengthFormF /** * @inheritDoc */ - public function readValue(): IFormField { + public function readValue() { if ($this->getDocument()->hasRequestData($this->getPrefixedId())) { $value = $this->getDocument()->getRequestData($this->getPrefixedId()); 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 4e20233cec..fb564e0cfd 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 @@ -4,7 +4,6 @@ namespace wcf\system\form\builder\field; use wcf\system\form\builder\field\data\CustomFormFieldDataProcessor; use wcf\system\form\builder\field\validation\FormFieldValidationError; use wcf\system\form\builder\IFormDocument; -use wcf\system\form\builder\IFormNode; use wcf\system\html\input\HtmlInputProcessor; use wcf\util\StringUtil; @@ -51,7 +50,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): WysiwygFormField { + public function autosaveId(string $autosaveId) { $this->__autosaveId = $autosaveId; return $this; @@ -63,14 +62,14 @@ class WysiwygFormField extends AbstractFormField implements IMaximumLengthFormFi * * @return string */ - public function getAutosaveId(): string { + public function getAutosaveId() { return $this->__autosaveId; } /** * @inheritDoc */ - public function getObjectTypeDefinition(): string { + public function getObjectTypeDefinition() { return 'com.woltlab.wcf.message'; } @@ -80,14 +79,14 @@ class WysiwygFormField extends AbstractFormField implements IMaximumLengthFormFi * * @return int */ - public function getLastEditTime(): int { + public function getLastEditTime() { return $this->__lastEditTime; } /** * @inheritDoc */ - public function hasSaveValue(): bool { + public function hasSaveValue() { return false; } @@ -97,7 +96,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): WysiwygFormField { + public function lastEditTime(int $lastEditTime) { $this->__lastEditTime = $lastEditTime; return $this; @@ -106,7 +105,7 @@ class WysiwygFormField extends AbstractFormField implements IMaximumLengthFormFi /** * @inheritDoc */ - public function populate(): IFormNode { + public function populate() { parent::populate(); $this->getDocument()->getDataHandler()->add(new CustomFormFieldDataProcessor('wysiwyg', function(IFormDocument $document, array $parameters) { @@ -123,7 +122,7 @@ class WysiwygFormField extends AbstractFormField implements IMaximumLengthFormFi /** * @inheritDoc */ - public function readValue(): IFormField { + public function readValue() { if ($this->getDocument()->hasRequestData($this->getPrefixedId())) { $value = $this->getDocument()->getRequestData($this->getPrefixedId()); 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 ae6db9288d..9704162c0d 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 @@ -65,7 +65,7 @@ class CustomFormFieldDataProcessor implements IFormFieldDataProcessor { /** * @inheritDoc */ - public function __invoke(IFormDocument $document, array $parameters): array { + public function __invoke(IFormDocument $document, array $parameters) { $parameters = call_user_func($this->processor, $document, $parameters); if (!is_array($parameters)) { diff --git a/wcfsetup/install/files/lib/system/form/builder/field/data/DefaultFormFieldDataProcessor.class.php b/wcfsetup/install/files/lib/system/form/builder/field/data/DefaultFormFieldDataProcessor.class.php index 053e0965ba..bc8dfe46da 100644 --- a/wcfsetup/install/files/lib/system/form/builder/field/data/DefaultFormFieldDataProcessor.class.php +++ b/wcfsetup/install/files/lib/system/form/builder/field/data/DefaultFormFieldDataProcessor.class.php @@ -21,7 +21,7 @@ class DefaultFormFieldDataProcessor implements IFormFieldDataProcessor { /** * @inheritDoc */ - public function __invoke(IFormDocument $document, array $parameters): array { + public function __invoke(IFormDocument $document, array $parameters) { $parameters['data'] = []; $this->getData($document, $parameters['data']); diff --git a/wcfsetup/install/files/lib/system/form/builder/field/data/IFormFieldDataProcessor.class.php b/wcfsetup/install/files/lib/system/form/builder/field/data/IFormFieldDataProcessor.class.php index 4db2a412fa..0c9bd7b0bc 100644 --- a/wcfsetup/install/files/lib/system/form/builder/field/data/IFormFieldDataProcessor.class.php +++ b/wcfsetup/install/files/lib/system/form/builder/field/data/IFormFieldDataProcessor.class.php @@ -21,5 +21,5 @@ interface IFormFieldDataProcessor { * @param array $parameters parameters before processing * @return array parameters after processing */ - public function __invoke(IFormDocument $document, array $parameters): array; + public function __invoke(IFormDocument $document, array $parameters); } 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 be66ebeed2..833fb2334e 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 @@ -42,7 +42,7 @@ abstract class AbstractFormFieldDependency implements IFormFieldDependency { /** * @inheritDoc */ - public function dependentNode(IFormNode $node): IFormFieldDependency { + public function dependentNode(IFormNode $node) { $this->__dependentNode = $node; return $this; @@ -51,7 +51,7 @@ abstract class AbstractFormFieldDependency implements IFormFieldDependency { /** * @inheritDoc */ - public function field(IFormField $field): IFormFieldDependency { + public function field(IFormField $field) { $this->__field = $field; return $this; @@ -60,7 +60,7 @@ abstract class AbstractFormFieldDependency implements IFormFieldDependency { /** * @inheritDoc */ - public function getDependentNode(): IFormNode { + public function getDependentNode() { if ($this->__dependentNode === null) { throw new \BadMethodCallException("Dependent node has not been set."); } @@ -71,7 +71,7 @@ abstract class AbstractFormFieldDependency implements IFormFieldDependency { /** * @inheritDoc */ - public function getField(): IFormField { + public function getField() { if ($this->__field === null) { throw new \BadMethodCallException("Field has not been set."); } @@ -82,14 +82,14 @@ abstract class AbstractFormFieldDependency implements IFormFieldDependency { /** * @inheritDoc */ - public function getId(): string { + public function getId() { return $this->__id; } /** * @inheritDoc */ - public function getHtml(): string { + public function getHtml() { if ($this->templateName === null) { throw new \LogicException("Template name is not set."); } @@ -107,7 +107,7 @@ abstract class AbstractFormFieldDependency implements IFormFieldDependency { * * @throws \InvalidArgumentException if given id no string or otherwise invalid */ - protected function id(string $id): IFormFieldDependency { + protected function id(string $id) { if (preg_match('~^[a-z][A-z0-9-]*$~', $id) !== 1) { throw new \InvalidArgumentException("Invalid id '{$id}' given."); } @@ -121,7 +121,7 @@ abstract class AbstractFormFieldDependency implements IFormFieldDependency { * @inheritDoc * @return static */ - public static function create(string $id): IFormFieldDependency { + public static function create(string $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 fcef9e8124..e0656011ee 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 @@ -20,7 +20,7 @@ interface IFormFieldDependency { * * @return bool */ - public function checkDependency(): bool; + public function checkDependency(); /** * Sets the node whose availability depends on the value of a field. @@ -30,7 +30,7 @@ interface IFormFieldDependency { * * @throws \BadMethodCallException if no dependent node has been set */ - public function dependentNode(IFormNode $node): IFormFieldDependency; + public function dependentNode(IFormNode $node); /** * Sets the field the availability of the node dependents on. @@ -40,35 +40,35 @@ interface IFormFieldDependency { * * @throws \BadMethodCallException if no field has been set */ - public function field(IFormField $field): IFormFieldDependency; + public function field(IFormField $field); /** * Returns the node whose availability depends on the value of a field. * * @return IFormNode dependent node */ - public function getDependentNode(): IFormNode; + public function getDependentNode(); /** * Returns the field the availability of the element dependents on. * * @return IFormField field controlling element availability */ - public function getField(): IFormField; + public function getField(); /** * Returns the JavaScript code required to ensure this dependency in the template. * * @return string dependency JavaScript code */ - public function getHtml(): string; + public function getHtml(); /** * Returns the id of this dependency. * * @return string id of the dependency */ - public function getId(): string; + public function getId(); /** * Creates a new dependency with the given id. @@ -78,5 +78,5 @@ interface IFormFieldDependency { * * @throws \InvalidArgumentException if the given id is invalid */ - public static function create(string $id): IFormFieldDependency; + public static function create(string $id); } diff --git a/wcfsetup/install/files/lib/system/form/builder/field/dependency/NonEmptyFormFieldDependency.class.php b/wcfsetup/install/files/lib/system/form/builder/field/dependency/NonEmptyFormFieldDependency.class.php index fadd520762..29155f287f 100644 --- a/wcfsetup/install/files/lib/system/form/builder/field/dependency/NonEmptyFormFieldDependency.class.php +++ b/wcfsetup/install/files/lib/system/form/builder/field/dependency/NonEmptyFormFieldDependency.class.php @@ -20,7 +20,7 @@ class NonEmptyFormFieldDependency extends AbstractFormFieldDependency { /** * @inheritDoc */ - public function checkDependency(): bool { + public function checkDependency() { return !empty($this->getField()->getValue()); } } 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 d80ac0b262..db7dbce669 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 @@ -33,7 +33,7 @@ class ValueFormFieldDependency extends AbstractFormFieldDependency { /** * @inheritDoc */ - public function checkDependency(): bool { + public function checkDependency() { $inArray = in_array($this->getField()->getValue(), $this->getValues()); if ($this->isNegated()) { @@ -50,7 +50,7 @@ class ValueFormFieldDependency extends AbstractFormFieldDependency { * * @throws \BadMethodCallException if no values have been set */ - public function getValues(): array { + public function getValues() { if ($this->__values === null) { throw new \BadMethodCallException("Values have not been set for dependency '{$this->getId()}' on node '{$this->getDependentNode()->getId()}'."); } @@ -64,7 +64,7 @@ class ValueFormFieldDependency extends AbstractFormFieldDependency { * * @return bool */ - public function isNegated(): bool { + public function isNegated() { return $this->__isNegated; } @@ -74,7 +74,7 @@ class ValueFormFieldDependency extends AbstractFormFieldDependency { * @param bool $negate * @return static $this this dependency */ - public function negate(bool $negate = true): ValueFormFieldDependency { + public function negate(bool $negate = true) { $this->__isNegated = $negate; return $this; @@ -88,7 +88,7 @@ class ValueFormFieldDependency extends AbstractFormFieldDependency { * * @throws \InvalidArgumentException if given values are invalid */ - public function values(array $values): ValueFormFieldDependency { + public function values(array $values) { if (empty($values)) { throw new \InvalidArgumentException("Given values are empty."); } 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 f43f5400a2..3bb87f7246 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 @@ -50,7 +50,7 @@ class FormFieldValidationError implements IFormFieldValidationError { /** * @inheritDoc */ - public function getHtml(): string { + public function getHtml() { return WCF::getTPL()->fetch('__formFieldError', 'wcf', [ 'error' => $this ]); @@ -59,21 +59,21 @@ class FormFieldValidationError implements IFormFieldValidationError { /** * @inheritDoc */ - public function getInformation(): array { + public function getInformation() { return $this->information; } /** * @inheritDoc */ - public function getMessage(): string { + public function getMessage() { return WCF::getLanguage()->getDynamicVariable($this->languageItem, $this->information); } /** * @inheritDoc */ - public function getType(): string { + public function getType() { return $this->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 a35380562e..2ab7e1886b 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 @@ -59,7 +59,7 @@ class FormFieldValidator implements IFormFieldValidator { /** * @inheritDoc */ - public function getId(): string { + public function getId() { return $this->id; } 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 d08161fc41..d4156e022f 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 @@ -24,7 +24,7 @@ abstract class FormFieldValidatorUtil { * * @throws \InvalidArgumentException if regular expression is invalid */ - public static function getRegularExpressionValidator(string $regularExpression, string $languageItemPrefix): IFormFieldValidator { + public static function getRegularExpressionValidator(string $regularExpression, string $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 83f3c790e5..1647f5cb7f 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 @@ -30,26 +30,26 @@ interface IFormFieldValidationError { * * @return string */ - public function getHtml(): string; + public function getHtml(); /** * Returns additional information about the error. * * @return array additional error information */ - public function getInformation(): array; + public function getInformation(); /** * Returns the message describing the validation error. * * @return string error message */ - public function getMessage(): string; + public function getMessage(); /** * Returns the type of the validation error. * * @return string error type */ - public function getType(): string; + public function getType(); } 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 9353d68ed8..7d102f99a0 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 @@ -35,7 +35,7 @@ interface IFormFieldValidator { * * @return string id of the dependency */ - public function getId(): string; + public function getId(); /** * Checks if the given parameter is a string and a valid validator id.