* @param bool $cancelable determines if dialog from can be canceled
* @return static this document
*/
- public function cancelable(bool $cancelable = true) {
+ public function cancelable($cancelable = true) {
$this->__isCancelable = $cancelable;
return $this;
/**
* encoding type of this form
- * @var null|string
+ * @var null|
*/
protected $enctype = '';
/**
* @inheritDoc
*/
- public function action(string $action) {
+ public function action($action) {
$this->__action = $action;
return $this;
/**
* @inheritDoc
*/
- public function formMode(string $formMode) {
+ public function formMode($formMode) {
if ($this->__formMode !== null) {
throw new \BadMethodCallException("Form mode has already been set");
}
/**
* @inheritDoc
*/
- public function getRequestData(string $index = null) {
+ public function getRequestData($index = null) {
if ($this->__requestData === null) {
$this->__requestData = $_POST;
}
/**
* @inheritDoc
*/
- public function hasRequestData(string $index = null) {
+ public function hasRequestData($index = null) {
$requestData = $this->getRequestData();
if ($index !== null) {
/**
* @inheritDoc
*/
- public function method(string $method) {
+ public function method($method) {
if ($method !== 'get' && $method !== 'post') {
throw new \InvalidArgumentException("Invalid method '{$method}' given.");
}
/**
* @inheritDoc
*/
- public function prefix(string $prefix) {
+ public function prefix($prefix) {
static::validateId($prefix);
$this->__prefix = $prefix;
*
* @throws \InvalidArgumentException if the given action is invalid
*/
- public function action(string $action);
+ public function action($action);
/**
* Is called once after all nodes have been added to this document.
* @throws \BadMethodCallException if the form mode has already been set
* @throws \InvalidArgumentException if the given form mode is invalid
*/
- public function formMode(string $formMode);
+ public function formMode($formMode);
/**
* Returns the `action` property of the HTML `form` element.
/**
* Returns the global form prefix that is prepended to form elements' names and ids to
- * avoid conflicts with other forms. If no prefix has been set, an empty string is returned.
+ * avoid conflicts with other forms. If no prefix has been set, an empty is returned.
*
* Note: If a prefix `foo` has been set, this method returns `foo_`.
*
*
* @throws \InvalidArgumentException if invalid index is given
*/
- public function getRequestData(string $index = null);
+ public function getRequestData($index = null);
/**
* Returns `true` if there is any request data or, if a parameter is given, if
* @param null|string $index array index of the returned data
* @return bool `tu
*/
- public function hasRequestData(string $index = null);
+ public function hasRequestData($index = null);
/**
* Loads the field values from the given object and returns this document.
*
* @throws \InvalidArgumentException if the given method is invalid
*/
- public function method(string $method);
+ public function method($method);
/**
* Sets the global form prefix that is prepended to form elements' names and ids to
*
* @throws \InvalidArgumentException if the given prefix is invalid
*/
- public function prefix(string $prefix);
+ public function prefix($prefix);
/**
* Sets the request data of the form's fields.
*
* @throws \InvalidArgumentException if the given description is invalid
*/
- public function description(string $languageItem = null, array $variables = []);
+ public function description($languageItem = null, array $variables = []);
/**
* Returns the description of this element or `null` if no description has been set.
*
* @throws \InvalidArgumentException if the given label is invalid
*/
- public function label(string $languageItem = null, array $variables = []);
+ public function label($languageItem = null, array $variables = []);
/**
* Returns `true` if this element requires a label to be set.
*
* @throws \InvalidArgumentException if the given class is invalid
*/
- public function addClass(string $class);
+ public function addClass($class);
/**
* Adds a dependency on the value of a `IFormField` so that this node is
*
* @throws \InvalidArgumentException if an invalid name or value is given (some attribute names are invalid as there are specific methods for setting that attribute)
*/
- public function attribute(string $name, string $value = null);
+ public function attribute($name, $value = null);
/**
* Sets if this node is available and returns this node.
* @param bool $available determines if node is available
* @return static this node
*/
- public function available(bool $available = true);
+ public function available($available = true);
/**
* Returns `true` if the node's dependencies are met and returns `false` otherwise.
*
* @throws \InvalidArgumentException if the given name is invalid or no such attribute exists
*/
- public function getAttribute(string $name);
+ public function getAttribute($name);
/**
* Returns additional attributes of this node.
*
* @throws \InvalidArgumentException if the given attribute name is invalid
*/
- public function hasAttribute(string $name);
+ public function hasAttribute($name);
/**
* Returns `true` if a CSS class with the given name exists and returns `false` otherwise.
*
* @throws \InvalidArgumentException if the given class is invalid
*/
- public function hasClass(string $class);
+ public function hasClass($class);
/**
* Returns `true` if this node has a dependency with the given id and
*
* @throws \InvalidArgumentException if the given id is invalid
*/
- public function hasDependency(string $dependencyId);
+ public function hasDependency($dependencyId);
/**
* Sets the id of the node.
* @throws \BadMethodCallException if id has already been set
* @throws \InvalidArgumentException if the given id is invalid
*/
- public function id(string $id);
+ public function id($id);
/**
* Returns `true` if this node is available and returns `false` otherwise.
*
* @throws \InvalidArgumentException if the given class is invalid
*/
- public function removeClass(string $class);
+ public function removeClass($class);
/**
* Removes the dependency with the given id and returns this node.
*
* @throws \InvalidArgumentException if the given id is invalid or no such dependency exists
*/
- public function removeDependency(string $dependencyId);
+ public function removeDependency($dependencyId);
/**
* Validates the node.
*
* @throws \InvalidArgumentException if the given id is already used by another element or otherwise is invalid
*/
- public static function create(string $id);
+ public static function create($id);
/**
- * Checks if the given attribute name class a string and a valid attribute name.
+ * Checks if the given attribute name class a and a valid attribute name.
*
* @param string $name checked argument name
*
* @throws \InvalidArgumentException if the given attribute name is invalid
*/
- public static function validateAttribute(string $name);
+ public static function validateAttribute($name);
/**
- * Checks if the given parameter class a string and a valid node class.
+ * Checks if the given parameter class a and a valid node class.
*
* @param string $class checked class
*
* @throws \InvalidArgumentException if the given id is invalid
*/
- public static function validateClass(string $class);
+ public static function validateClass($class);
/**
- * Checks if the given parameter is a string and a valid node id.
+ * Checks if the given parameter is a and a valid node id.
*
* @param string $id checked id
*
* @throws \InvalidArgumentException if the given id is invalid
*/
- public static function validateId(string $id);
+ public static function validateId($id);
}
* @param string $nodeId id of searched node
* @return bool
*/
- public function contains(string $nodeId);
+ public function contains($nodeId);
/**
* Returns a recursive iterator for this node.
*
* @throws \InvalidArgumentException if the given id is invalid
*/
- public function getNodeById(string $nodeId);
+ public function getNodeById($nodeId);
/**
* Returns `true` if this node or any of its children has a validation error and
*
* @throws \InvalidArgumentException if given node cannot be inserted or reference node id is invalid
*/
- public function insertBefore(IFormChildNode $child, string $referenceNodeId);
+ public function insertBefore(IFormChildNode $child, $referenceNodeId);
/**
* Reads the value of this node and its children from request data and
* @param array $variables additional variables used when resolving the language item
* @return static this element
*
- * @throws \InvalidArgumentException if the given description is no string or otherwise is invalid
+ * @throws \InvalidArgumentException if the given description is no or otherwise is invalid
*/
- public function description(string $languageItem = null, array $variables = []) {
+ public function description($languageItem = null, array $variables = []) {
if ($languageItem === null) {
if (!empty($variables)) {
throw new \InvalidArgumentException("Cannot use variables when unsetting description of element '{$this->getId()}'");
* @param array $variables additional variables used when resolving the language item
* @return static this element
*
- * @throws \InvalidArgumentException if the given label is no string or otherwise is invalid
+ * @throws \InvalidArgumentException if the given label is no or otherwise is invalid
*/
- public function label(string $languageItem = null, array $variables = []) {
+ public function label($languageItem = null, array $variables = []) {
if ($languageItem === null) {
if (!empty($variables)) {
throw new \InvalidArgumentException("Cannot use variables when unsetting label of element '{$this->getId()}'");
*
* @throws \InvalidArgumentException if the given class is invalid
*/
- public function addClass(string $class) {
+ public function addClass($class) {
static::validateClass($class);
if (!in_array($class, $this->__classes)) {
*
* @throws \InvalidArgumentException if an invalid name or value is given (some attribute names are invalid as there are specific methods for setting that attribute)
*/
- public function attribute(string $name, string $value = null) {
+ public function attribute($name, $value = null) {
static::validateAttribute($name);
if ($value !== null && !is_bool($value) && !is_numeric($value) && !is_string($value)) {
* @param bool $available determines if node is available
* @return static this node
*/
- public function available(bool $available = true) {
+ public function available($available = true) {
$this->__available = $available;
return $this;
*
* @throws \InvalidArgumentException if the given name is invalid or no such attribute exists
*/
- public function getAttribute(string $name) {
+ public function getAttribute($name) {
if (!$this->hasAttribute($name)) {
throw new \InvalidArgumentException("Unknown attribute '{$name}' requested.");
}
*
* @throws \InvalidArgumentException if the given attribute name is invalid
*/
- public function hasAttribute(string $name) {
+ public function hasAttribute($name) {
static::validateAttribute($name);
return isset($this->__attributes[$name]);
*
* @throws \InvalidArgumentException if the given class is invalid
*/
- public function hasClass(string $class) {
+ public function hasClass($class) {
static::validateClass($class);
return array_search($class, $this->__classes) !== false;
*
* @throws \InvalidArgumentException if the given id is invalid
*/
- public function hasDependency(string $dependencyId) {
+ public function hasDependency($dependencyId) {
foreach ($this->dependencies as $dependency) {
if ($dependency->getId() === $dependencyId) {
return true;
* @throws \BadMethodCallException if id has already been set
* @throws \InvalidArgumentException if the given id is invalid
*/
- public function id(string $id) {
+ public function id($id) {
static::validateId($id);
if ($this->__id !== null) {
*
* @throws \InvalidArgumentException if the given class is invalid
*/
- public function removeClass(string $class) {
+ public function removeClass($class) {
static::validateClass($class);
$index = array_search($class, $this->__classes);
*
* @throws \InvalidArgumentException if the given id is invalid or no such dependency exists
*/
- public function removeDependency(string $dependencyId) {
+ public function removeDependency($dependencyId) {
foreach ($this->dependencies as $key => $dependency) {
if ($dependency->getId() === $dependencyId) {
unset($this->dependencies[$key]);
*
* @throws \InvalidArgumentException if the given id is already used by another node, or otherwise is invalid
*/
- public static function create(string $id) {
+ public static function create($id) {
return (new static)->id($id);
}
/**
- * Checks if the given attribute name class a string and a valid attribute name.
+ * Checks if the given attribute name class a and a valid attribute name.
*
* @param string $name checked argument name
*
* @throws \InvalidArgumentException if the given attribute name is invalid
*/
- public static function validateAttribute(string $name) {
+ public static function validateAttribute($name) {
if (preg_match('~^[_A-z][_A-z0-9-]*$~', $name) !== 1) {
throw new \InvalidArgumentException("Invalid name '{$name}' given.");
}
}
/**
- * Checks if the given parameter class a string and a valid node class.
+ * Checks if the given parameter class a and a valid node class.
*
* @param string $class checked id
*
* @throws \InvalidArgumentException if the given id is invalid
*/
- public static function validateClass(string $class) {
+ public static function validateClass($class) {
// regular expression is a more restrictive version of
// (https://www.w3.org/TR/2011/REC-css3-selectors-20110929/#w3cselgrammar)
if (preg_match('~^-?[_A-z][_A-z0-9-]*$~', $class) !== 1) {
}
/**
- * Checks if the given parameter is a string and a valid node id.
+ * Checks if the given parameter is a and a valid node id.
*
* @param string $id checked id
*
* @throws \InvalidArgumentException if the given id is invalid
*/
- public static function validateId(string $id) {
+ public static function validateId($id) {
// regular expression is a more restrictive version of
// https://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
if (preg_match('~^-?[_A-z][_A-z0-9-]*$~', $id) !== 1) {
* @param string $nodeId id of searched node
* @return bool
*/
- public function contains(string $nodeId) {
+ public function contains($nodeId) {
static::validateId($nodeId);
foreach ($this->children() as $child) {
*
* @throws \InvalidArgumentException if the given id is invalid
*/
- public function getNodeById(string $nodeId) {
+ public function getNodeById($nodeId) {
static::validateId($nodeId);
foreach ($this->children() as $child) {
*
* @throws \InvalidArgumentException if given node cannot be inserted or reference node id is invalid
*/
- public function insertBefore(IFormChildNode $child, string $referenceNodeId) {
+ public function insertBefore(IFormChildNode $child, $referenceNodeId) {
$didInsertNode = false;
foreach ($this->children() as $index => $existingChild) {
if ($existingChild->getId() === $referenceNodeId) {
/**
* `true` if this field is auto-focused and `false` otherwise
- * @var bool
+ * @var bool
*/
protected $__autoFocus = false;
/**
* name of the template used to output this field
- * @var string
+ * @var string
*/
protected $templateName;
/**
* @inheritDoc
*/
- public function autoFocus(bool $autoFocus = true) {
+ public function autoFocus($autoFocus = true) {
$this->__autoFocus = $autoFocus;
return $this;
/**
* @inheritDoc
*/
- public function hasValidator(string $validatorId) {
+ public function hasValidator($validatorId) {
FormFieldValidator::validateId($validatorId);
return isset($this->validators[$validatorId]);
/**
* @inheritDoc
*/
- public function immutable(bool $immutable = true) {
+ public function immutable($immutable = true) {
$this->__immutable = $immutable;
return $this;
* @inheritDoc
* @return static
*/
- public function objectProperty(string $objectProperty) {
+ public function objectProperty($objectProperty) {
if ($objectProperty === '') {
$this->__objectProperty = null;
}
/**
* @inheritDoc
*/
- public function removeValidator(string $validatorId) {
+ public function removeValidator($validatorId) {
if (!$this->hasValidator($validatorId)) {
throw new \InvalidArgumentException("Unknown validator with id '{$validatorId}'");
}
* @inheritDoc
* @return static
*/
- public function required(bool $required = true) {
+ public function required($required = true) {
$this->__required = $required;
return $this;
}
else {
if (is_string($step) && $step !== 'any') {
- throw new \InvalidArgumentException("The only valid string step value is 'any', '" . $step . "' given.");
+ throw new \InvalidArgumentException("The only valid step value is 'any', '" . $step . "' given.");
}
else if (!is_numeric($step)) {
throw new \InvalidArgumentException("Given step is no number, '" . gettype($step) . "' given.");
*
* @throws \InvalidArgumentException if given category name is invalid
*/
- public function categoryName(string $categoryName) {
+ public function categoryName($categoryName) {
// TODO: validation
$this->__categoryName = $categoryName;
* @param bool $classExists determines if entered class must exist
* @return static this field
*/
- public function classExists(bool $classExists = true) {
+ public function classExists($classExists = true) {
$this->__classExists = $classExists;
return $this;
}
/**
- * Returns class the entered class must extend or an empty string if the
+ * Returns class the entered class must extend or an empty if the
* entered class does not have to extend any specific class. By default,
- * an empty string is returned.
+ * an empty is returned.
*
* @return string
*/
/**
* Returns name of the interface the entered class must implement or an
- * empty string if the entered class does not have to implement any specific
- * interface. By default, an empty string is returned.
+ * empty if the entered class does not have to implement any specific
+ * interface. By default, an empty is returned.
*
* @return string
*/
*
* @throws \InvalidArgumentException if the entered interface does not exists
*/
- public function implementedInterface(string $interface) {
+ public function implementedInterface($interface) {
if (!interface_exists($interface)) {
throw new \InvalidArgumentException("Interface '{$interface}' does not exist.");
}
* @param bool $instantiable determines if entered class must be instantiable
* @return static this field
*/
- public function instantiable(bool $instantiable = true) {
+ public function instantiable($instantiable = true) {
$this->__instantiable = $instantiable;
return $this;
*
* @throws \InvalidArgumentException if the entered class does not exists
*/
- public function parentClass(string $parentClass) {
+ public function parentClass($parentClass) {
if (!class_exists($parentClass)) {
throw new \InvalidArgumentException("Class '{$parentClass}' does not exist.");
}
/**
* @inheritDoc
*/
- protected function validateText(string $text, Language $language = null) {
+ protected function validateText($text, Language $language = null) {
parent::validateText($text, $language);
if (empty($this->getValidationErrors())) {
* @param bool $autoFocus determines if field is auto-focused
* @return static this field
*/
- public function autoFocus(bool $autoFocus = true);
+ public function autoFocus($autoFocus = true);
/**
* Adds the given validation error to this field and returns this field.
*
* @throws \InvalidArgumentException if the given id is invalid
*/
- public function hasValidator(string $validatorId);
+ public function hasValidator($validatorId);
/**
* Returns `true` if this field provides a value that can simply be stored
* @param bool $immutable determines if field value is immutable
* @return static this field
*/
- public function immutable(bool $immutable = true);
+ public function immutable($immutable = true);
/**
* Returns `true` if this field is auto-focused and returns `false` otherwise.
/**
* Sets the name of the object property this field represents. If an empty
- * string is passed, the object property is unset.
+ * is passed, the object property is unset.
*
* The object property allows having different fields (requiring different ids)
* that represent the same object property which is handy when available options
*
* @throws \InvalidArgumentException if the passed object property is no valid id
*/
- public function objectProperty(string $objectProperty);
+ public function objectProperty($objectProperty);
/**
* Reads the value of this field from request data and return this field.
*
* @throws \InvalidArgumentException if the given id is invalid or no such validator exists
*/
- public function removeValidator(string $validatorId);
+ public function removeValidator($validatorId);
/**
* Sets whether it is required to fill out this field and returns this field.
* @param bool $required determines if field has to be filled out
* @return static this field
*/
- public function required(bool $required = true);
+ public function required($required = true);
/**
* Sets the value of this field and returns this field.
* @param bool $i18n determines if field is supports i18n input
* @return static this field
*/
- public function i18n(bool $i18n = true);
+ public function i18n($i18n = true);
/**
* Sets whether this field's value must be i18n input and returns this field.
* @param bool $i18nRequired determines if field value must be i18n input
* @return static this field
*/
- public function i18nRequired(bool $i18nRequired = true);
+ public function i18nRequired($i18nRequired = true);
/**
* Returns `true` if this field supports i18n input and returns `false` otherwise.
* @throws \BadMethodCallException if i18n is disabled for this field
* @throws \InvalidArgumentException if the given pattern is invalid
*/
- public function languageItemPattern(string $pattern);
+ public function languageItemPattern($pattern);
}
*
* @throws \InvalidArgumentException if the given maximum length is no integer or otherwise invalid
*/
- public function maximumLength(int $maximumLength = null);
+ public function maximumLength($maximumLength = null);
/**
* Validates the maximum length of the given text.
* @param string $text validated text
* @param null|Language $language language of the validated text
*/
- public function validateMaximumLength(string $text, Language $language = null);
+ public function validateMaximumLength($text, Language $language = null);
}
*
* @throws \InvalidArgumentException if the given minimum length is no integer or otherwise invalid
*/
- public function minimumLength(int $minimumLength = null);
+ public function minimumLength($minimumLength = null);
/**
* Validates the minimum length of the given text.
* @param string $text validated text
* @param null|Language $language language of the validated text
*/
- public function validateMinimumLength(string $text, Language $language = null);
+ public function validateMinimumLength($text, Language $language = null);
}
*
* @throws \InvalidArgumentException if the given maximum number of values is invalid
*/
- public function maximumMultiples(int $maximum);
+ public function maximumMultiples($maximum);
/**
* Sets the minimum number of values that can be selected or set and returns
*
* @throws \InvalidArgumentException if the given minimum number of values is invalid
*/
- public function minimumMultiples(int $minimum);
+ public function minimumMultiples($minimum);
/**
* Sets whether multiple values can be selected or set and returns this field.
* @param bool $multiple determines if multiple values can be selected/set
* @return static this field
*/
- public function multiple(bool $multiple = true);
+ public function multiple($multiple = true);
}
* @param bool $nullable determines if field supports `null` as its value
* @return static this node
*/
- public function nullable(bool $nullable = true);
+ public function nullable($nullable = true);
}
* @throws \UnexpectedValueException if object type definition returned by `getObjectTypeDefinition()` is unknown
* @throws InvalidObjectTypeException if given object type name is invalid
*/
- public function objectType(string $objectType);
+ public function objectType($objectType);
/**
* Returns the name of the object type definition the set object type must be of.
*
* @throws \InvalidArgumentException if the given value is invalid
*/
- public function placeholder(string $languageItem = null, array $variables = []);
+ public function placeholder($languageItem = null, array $variables = []);
}
* @throws \InvalidArgumentException if given options are no array or callable or otherwise invalid
* @throws \UnexpectedValueException if callable does not return an array
*/
- public function options($options, bool $nestedOptions = false);
+ public function options($options, $nestedOptions = false);
/**
* Returns `true` if the field class supports nested options and `false` otherwise.
*
* @throws \InvalidArgumentException if the given language item is invalid
*/
- public function suffix(string $languageItem = null, array $variables = []);
+ public function suffix($languageItem = null, array $variables = []);
}
* @throws \BadMethodCallException if save value type has already been set
* @throws \InvalidArgumentException if given save value type is invalid
*/
- public function saveValueType(string $saveValueType) {
+ public function saveValueType($saveValueType) {
if ($this->saveValueType !== null) {
throw new \BadMethodCallException("Save value type has already been set.");
}
*
* @throws \InvalidArgumentException if given number of rows is invalid
*/
- public function rows(int $rows) {
+ public function rows($rows) {
if ($rows <= 0) {
throw new \InvalidArgumentException("Given number of rows is not positive.");
}
* and using the language item `wcf.form.field.showOrder.firstPosition`
* as value to mark adding it at the first position.
*/
- public function options($options, bool $nestedOptions = false) {
+ public function options($options, $nestedOptions = false) {
parent::options($options, $nestedOptions);
$this->__options = [0 => WCF::getLanguage()->get('wcf.form.field.showOrder.firstPosition')] + $this->__options;
* @inheritDoc
* @return static
*/
- public static function create(string $id = null) {
+ public static function create($id = null) {
if ($id === null) {
$id = static::getDefaultId();
}
* @param bool $i18n determines if field supports i18n input
* @return II18nFormField this field
*/
- public function i18n(bool $i18n = true) {
+ public function i18n($i18n = true) {
$this->__i18n = $i18n;
return $this;
* @param bool $i18nRequired determines if field value must be i18n input
* @return static this field
*/
- public function i18nRequired(bool $i18nRequired = true) {
+ public function i18nRequired($i18nRequired = true) {
$this->__i18nRequired = $i18nRequired;
$this->i18n();
* @throws \BadMethodCallException if i18n is disabled for this field
* @throws \InvalidArgumentException if the given pattern is invalid
*/
- public function languageItemPattern(string $pattern) {
+ public function languageItemPattern($pattern) {
if (!$this->isI18n()) {
throw new \BadMethodCallException("The language item pattern can only be set for fields with i18n enabled.");
}
}
/**
- * Sets the value of this form field based on the given string value.
+ * Sets the value of this form field based on the given value.
* If the value is a language item matching the language item pattern,
* the relevant language items are loaded and their values are used as
* field values.
*
* @param string $value set value
*/
- protected function setStringValue(string $value) {
+ protected function setStringValue($value) {
if (Regex::compile('^' . $this->getLanguageItemPattern() . '$')->match($value)) {
$languageItemList = new LanguageItemList();
$languageItemList->getConditionBuilder()->add('languageItem = ?', [$value]);
}
}
else {
- throw new \InvalidArgumentException("Given value is neither a string nor an array, " . gettype($value) . " given.");
+ throw new \InvalidArgumentException("Given value is neither a nor an array, " . gettype($value) . " given.");
}
}
else {
*
* @throws \InvalidArgumentException if the given maximum length is no integer or otherwise invalid
*/
- public function maximumLength(int $maximumLength = null) {
+ public function maximumLength($maximumLength = null) {
if ($maximumLength !== null) {
if (!is_int($maximumLength)) {
throw new \InvalidArgumentException("Given maximum length is no int, '" . gettype($maximumLength) . "' given.");
* @param string $text validated text
* @param null|Language $language language of the validated text
*/
- public function validateMaximumLength(string $text, Language $language = null) {
+ public function validateMaximumLength($text, Language $language = null) {
if ($this->getMaximumLength() !== null && mb_strlen($text) > $this->getMaximumLength()) {
$this->addValidationError(new FormFieldValidationError(
'maximumLength',
*
* @throws \InvalidArgumentException if the given minimum length is no integer or otherwise invalid
*/
- public function minimumLength(int $minimumLength = null) {
+ public function minimumLength($minimumLength = null) {
if ($minimumLength !== null) {
if (!is_int($minimumLength)) {
throw new \InvalidArgumentException("Given minimum length is no int, '" . gettype($minimumLength) . "' given.");
* @param string $text validated text
* @param null|Language $language language of the validated text
*/
- public function validateMinimumLength(string $text, Language $language = null) {
+ public function validateMinimumLength($text, Language $language = null) {
if ($this->getMinimumLength() !== null && mb_strlen($text) < $this->getMinimumLength()) {
$this->addValidationError(new FormFieldValidationError(
'minimumLength',
*
* @throws \InvalidArgumentException if the given maximum number of values is invalid
*/
- public function maximumMultiples(int $maximum) {
+ public function maximumMultiples($maximum) {
if ($maximum !== IMultipleFormField::NO_MAXIMUM_MULTIPLES) {
if ($maximum <= 0) {
throw new \InvalidArgumentException("The maximum number of values has to be positive, '{$maximum}' given.");
*
* @throws \InvalidArgumentException if the given minimum number of values is invalid
*/
- public function minimumMultiples(int $minimum) {
+ public function minimumMultiples($minimum) {
if ($minimum < 0) {
throw new \InvalidArgumentException("The minimum number of values has to be non-negative, '{$minimum}' given.");
}
* @param bool $multiple determines if multiple values can be selected/set
* @return static this field
*/
- public function multiple(bool $multiple = true) {
+ public function multiple($multiple = true) {
$this->__multiple = $multiple;
return $this;
* @param bool $nullable determines if field supports `null` as its value
* @return static this node
*/
- public function nullable(bool $nullable = true) {
+ public function nullable($nullable = true) {
$this->__nullable = $nullable;
return $this;
* @throws \UnexpectedValueException if object type definition returned by `getObjectTypeDefinition()` is unknown
* @throws InvalidObjectTypeException if given object type name is invalid
*/
- public function objectType(string $objectType) {
+ public function objectType($objectType) {
if ($this->__objectType !== null) {
throw new \BadMethodCallException("Object type has already been set.");
}
* @param array $variables additional variables used when resolving the language item
* @return static this field
*
- * @throws \InvalidArgumentException if the given value is no string or otherwise invalid
+ * @throws \InvalidArgumentException if the given value is no or otherwise invalid
*/
- public function placeholder(string $languageItem = null, array $variables = []) {
+ public function placeholder($languageItem = null, array $variables = []) {
if ($languageItem === null) {
if (!empty($variables)) {
throw new \InvalidArgumentException("Cannot use variables when unsetting placeholder of field '{$this->getId()}'");
* @throws \InvalidArgumentException if given options are no array or callable or otherwise invalid
* @throws \UnexpectedValueException if callable does not return an array
*/
- public function options($options, bool $nestedOptions = false) {
+ public function options($options, $nestedOptions = false) {
if ($nestedOptions) {
if (!is_array($options) && !is_callable($options)) {
throw new \InvalidArgumentException("The given nested options are neither an array nor a callable, " . gettype($options) . " given.");
* @param array $variables additional variables used when resolving the language item
* @return static this field
*
- * @throws \InvalidArgumentException if the given language item is no string or otherwise invalid
+ * @throws \InvalidArgumentException if the given language item is no or otherwise invalid
*/
- public function suffix(string $languageItem = null, array $variables = []) {
+ public function suffix($languageItem = null, array $variables = []) {
if ($languageItem === null) {
if (!empty($variables)) {
throw new \InvalidArgumentException("Cannot use variables when unsetting suffix of field '{$this->getId()}'");
* @param string $text validated text
* @param null|Language $language language of validated text or `null` for monolingual text
*/
- protected function validateText(string $text, Language $language = null) {
+ protected function validateText($text, Language $language = null) {
$this->validateMinimumLength($text, $language);
$this->validateMaximumLength($text, $language);
}
* @param string $autosaveId identifier used to autosave field value
* @return WysiwygFormField this field
*/
- public function autosaveId(string $autosaveId) {
+ public function autosaveId($autosaveId) {
$this->__autosaveId = $autosaveId;
return $this;
/**
* Returns the identifier used to autosave the field value. If autosave is disabled,
- * an empty string is returned.
+ * an empty is returned.
*
* @return string
*/
* @param int $lastEditTime last time field has been edited
* @return WysiwygFormField this field
*/
- public function lastEditTime(int $lastEditTime) {
+ public function lastEditTime($lastEditTime) {
$this->__lastEditTime = $lastEditTime;
return $this;
*
* @throws \InvalidArgumentException if either id or processor callable are invalid
*/
- public function __construct(string $id, callable $processor) {
+ public function __construct($id, callable $processor) {
if (preg_match('~^[a-z][A-z0-9-]*$~', $id) !== 1) {
throw new \InvalidArgumentException("Invalid id '{$id}' given.");
}
* @param string $id id of the dependency
* @return static $this this dependency
*
- * @throws \InvalidArgumentException if given id no string or otherwise invalid
+ * @throws \InvalidArgumentException if given id no or otherwise invalid
*/
- protected function id(string $id) {
+ protected function id($id) {
if (preg_match('~^[a-z][A-z0-9-]*$~', $id) !== 1) {
throw new \InvalidArgumentException("Invalid id '{$id}' given.");
}
* @inheritDoc
* @return static
*/
- public static function create(string $id) {
+ public static function create($id) {
return (new static)->id($id);
}
}
*
* @throws \InvalidArgumentException if the given id is invalid
*/
- public static function create(string $id);
+ public static function create($id);
}
* @param bool $negate
* @return static $this this dependency
*/
- public function negate(bool $negate = true) {
+ public function negate($negate = true) {
$this->__isNegated = $negate;
return $this;
/**
* @inheritDoc
*/
- public function __construct(string $type, string $languageItem = null, array $information = []) {
+ public function __construct($type, $languageItem = null, array $information = []) {
if ($languageItem === null) {
$languageItem = 'wcf.global.form.error.' . $type;
}
class FormFieldValidator implements IFormFieldValidator {
/**
* id of the validator that has to be unique for each field
- * @var string
+ * @var
*/
protected $id;
/**
* @inheritDoc
*/
- public function __construct(string $id, callable $validator) {
+ public function __construct($id, callable $validator) {
static::validateId($id);
$this->id = $id;
/**
* @inheritDoc
*/
- public static function validateId(string $id) {
+ public static function validateId($id) {
if (preg_match('~^[a-z][A-z0-9-]*$~', $id) !== 1) {
throw new \InvalidArgumentException("Invalid id '{$id}' given.");
}
*
* @throws \InvalidArgumentException if regular expression is invalid
*/
- public static function getRegularExpressionValidator(string $regularExpression, string $languageItemPrefix) {
+ public static function getRegularExpressionValidator($regularExpression, $languageItemPrefix) {
$regex = Regex::compile($regularExpression);
if (!$regex->isValid()) {
throw new \InvalidArgumentException("Invalid regular expression '{$regularExpression}' given.");
*
* @throws \InvalidArgumentException if the given error type is invalid
*/
- public function __construct(string $type, string $languageItem = null, array $information = []);
+ public function __construct($type, $languageItem = null, array $information = []);
/**
* Returns the HTML element representing the error.
*
* @throws \InvalidArgumentException if the given id is invalid
*/
- public function __construct(string $id, callable $validator);
+ public function __construct($id, callable $validator);
/**
* Validates the value of the given field.
public function getId();
/**
- * Checks if the given parameter is a string and a valid validator id.
+ * Checks if the given parameter is a and a valid validator id.
*
* @param mixed $id checked id
*
* @throws \InvalidArgumentException if the given id is invalid
*/
- public static function validateId(string $id);
+ public static function validateId($id);
}