*
* @throws \InvalidArgumentException if the given description is invalid
*/
- public function description($languageItem = null, array $variables = []): IFormElement;
+ public function description(string $languageItem = null, array $variables = []): IFormElement;
/**
* 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($languageItem = null, array $variables = []): IFormElement;
+ public function label(string $languageItem = null, array $variables = []): IFormElement;
}
*
* @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, $value = null): IFormNode;
+ public function attribute(string $name, string $value = null): IFormNode;
/**
* Sets if this node is available and returns this node.
*
* @throws \InvalidArgumentException if the given description is no string or otherwise is invalid
*/
- public function description($languageItem = null, array $variables = []): IFormElement {
+ public function description(string $languageItem = null, array $variables = []): IFormElement {
if ($languageItem === null) {
if (!empty($variables)) {
throw new \InvalidArgumentException("Cannot use variables when unsetting description of element '{$this->getId()}'");
*
* @throws \InvalidArgumentException if the given label is no string or otherwise is invalid
*/
- public function label($languageItem = null, array $variables = []): IFormElement {
+ public function label(string $languageItem = null, array $variables = []): IFormElement {
if ($languageItem === null) {
if (!empty($variables)) {
throw new \InvalidArgumentException("Cannot use variables when unsetting label of element '{$this->getId()}'");
*
* @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, $value = null): IFormNode {
+ public function attribute(string $name, string $value = null): IFormNode {
static::validateAttribute($name);
if ($value !== null && !is_bool($value) && !is_numeric($value) && !is_string($value)) {
*
* @throws \InvalidArgumentException if the given maximum is no integer or otherwise invalid
*/
- public function maximum($maximum = null): IMaximumFormField;
+ public function maximum(int $maximum = null): IMaximumFormField;
}
*
* @throws \InvalidArgumentException if the given maximum length is no integer or otherwise invalid
*/
- public function maximumLength($maximumLength = null): IMaximumLengthFormField;
+ public function maximumLength(int $maximumLength = null): IMaximumLengthFormField;
}
*
* @throws \InvalidArgumentException if the given minimum is no integer or otherwise invalid
*/
- public function minimum($minimum = null): IMinimumFormField;
+ public function minimum(int $minimum = null): IMinimumFormField;
}
*
* @throws \InvalidArgumentException if the given minimum length is no integer or otherwise invalid
*/
- public function minimumLength($minimumLength = null): IMinimumLengthFormField;
+ public function minimumLength(int $minimumLength = null): IMinimumLengthFormField;
}
*
* @throws \InvalidArgumentException if the given value is invalid
*/
- public function placeholder($languageItem = null, array $variables = []): IPlaceholderFormField;
+ public function placeholder(string $languageItem = null, array $variables = []): IPlaceholderFormField;
}
*
* @throws \InvalidArgumentException if the given language item is invalid
*/
- public function suffix($languageItem = null, array $variables = []): ISuffixedFormField;
+ public function suffix(string $languageItem = null, array $variables = []): ISuffixedFormField;
}
*
* @throws \InvalidArgumentException if the given maximum is no integer or otherwise invalid
*/
- public function maximum($maximum = null): IMaximumFormField {
+ public function maximum(int $maximum = null): IMaximumFormField {
if ($maximum !== null) {
if (!is_int($maximum)) {
throw new \InvalidArgumentException("Given maximum is no int, '" . gettype($maximum) . "' given.");
*
* @throws \InvalidArgumentException if the given maximum length is no integer or otherwise invalid
*/
- public function maximumLength($maximumLength = null): IMaximumLengthFormField {
+ public function maximumLength(int $maximumLength = null): IMaximumLengthFormField {
if ($maximumLength !== null) {
if (!is_int($maximumLength)) {
throw new \InvalidArgumentException("Given maximum length is no int, '" . gettype($maximumLength) . "' given.");
*
* @throws \InvalidArgumentException if the given minimum is no integer or otherwise invalid
*/
- public function minimum($minimum = null): IMinimumFormField {
+ public function minimum(int $minimum = null): IMinimumFormField {
if ($minimum !== null) {
if (!is_int($minimum)) {
throw new \InvalidArgumentException("Given minimum is no int, '" . gettype($minimum) . "' given.");
*
* @throws \InvalidArgumentException if the given minimum length is no integer or otherwise invalid
*/
- public function minimumLength($minimumLength = null): IMinimumLengthFormField {
+ public function minimumLength(int $minimumLength = null): IMinimumLengthFormField {
if ($minimumLength !== null) {
if (!is_int($minimumLength)) {
throw new \InvalidArgumentException("Given minimum length is no int, '" . gettype($minimumLength) . "' given.");
*
* @throws \InvalidArgumentException if the given value is no string or otherwise invalid
*/
- public function placeholder($languageItem = null, array $variables = []): IPlaceholderFormField {
+ public function placeholder(string $languageItem = null, array $variables = []): IPlaceholderFormField {
if ($languageItem === null) {
if (!empty($variables)) {
throw new \InvalidArgumentException("Cannot use variables when unsetting placeholder of field '{$this->getId()}'");
*
* @throws \InvalidArgumentException if the given language item is no string or otherwise invalid
*/
- public function suffix($languageItem = null, array $variables = []): ISuffixedFormField {
+ public function suffix(string $languageItem = null, array $variables = []): ISuffixedFormField {
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|int $languageID language id of validated text or `null` for monolingual text
*/
- protected function validateText(string $text, $languageID = null) {
+ protected function validateText(string $text, int $languageID = null) {
if ($this->getMinimumLength() !== null && mb_strlen($text) < $this->getMinimumLength()) {
$this->addValidationError(new FormFieldValidationError('minimumLength', 'wcf.global.form.text.error.minimumLength', [
'languageID' => $languageID,
/**
* @inheritDoc
*/
- public function __construct(string $type, $languageItem = null, array $information = []) {
+ public function __construct(string $type, string $languageItem = null, array $information = []) {
if ($languageItem === null) {
$languageItem = 'wcf.global.form.error.' . $type;
}
*
* @throws \InvalidArgumentException if the given error type is invalid
*/
- public function __construct(string $type, $languageItem = null, array $information = []);
+ public function __construct(string $type, string $languageItem = null, array $information = []);
/**
* Returns the HTML element representing the error.