… for compatibility with PHP versions < 7.4.
* @inheritDoc
* @since 5.4
*/
- public function markRequiredFields(bool $markRequiredFields = true): self
+ public function markRequiredFields(bool $markRequiredFields = true)
{
$this->markRequiredFields = $markRequiredFields;
* Sets whether required fields are marked in the output and returns this document.
*
* @since 5.4
+ * @return static this document
*/
- public function markRequiredFields(bool $markRequiredFields = true): self;
+ public function markRequiredFields(bool $markRequiredFields = true);
/**
* Returns `true` if required fields are marked in the output and `false` otherwise.
/**
* Sets the language item shown in the form node and returns this form node.
+ *
+ * @return static this form field
*/
- public function languageItem(string $languageItem): self
+ public function languageItem(string $languageItem)
{
$this->languageItem = $languageItem;
/**
* Sets the template variables passed to the language item and returns this form node.
+ *
+ * @return static this form field
*/
- public function variables(array $variables): self
+ public function variables(array $variables)
{
$this->variables = $variables;
/**
* Sets the text shown on the button and returns this form field.
+ *
+ * @return ButtonFormField this form field
*/
- public function buttonLabel(string $languageItem, array $variables = []): self
+ public function buttonLabel(string $languageItem, array $variables = [])
{
$this->buttonLabel = WCF::getLanguage()->getDynamicVariable($languageItem, $variables);
* Returns the value of the additional attribute of the actual field element with the given name.
*
* @throws \InvalidArgumentException if the given attribute is invalid or no such attribute exists
+ * @return static this form field
*/
- public function getFieldAttribute(string $name): self;
+ public function getFieldAttribute(string $name);
/**
* Returns all additional attributes of the actual field element.
* Adds the given additional attribute to the actual field element and returns this field.
*
* @throws \InvalidArgumentException if the given attribute is invalid
+ * @return static this form field
*/
- public function fieldAttribute(string $name, ?string $value = null): self;
+ public function fieldAttribute(string $name, ?string $value = null);
/**
* Returns `true` if an additional attribute of the actual field element with the given name exists and returns
* If the actual field element does not have the given attribute, this method silently ignores that fact.
*
* @throws \InvalidArgumentException if the given attribute is invalid
+ * @return static this form field
*/
- public function removeFieldAttribute(string $name): self;
+ public function removeFieldAttribute(string $name);
/**
* Checks if the given name is a valid additional attribute name.
* Multiple tokens can be separated by spaces and if `null` is given, the attribute is unset.
*
* @throws \InvalidArgumentException if an invalid `autocomplete` token is included in the attribute value
+ * @return static this form field
*/
- public function autoComplete(?string $autoComplete): self;
+ public function autoComplete(?string $autoComplete);
/**
* Returns the `autocomplete` attribute of the form field.
* Adds the given CSS class to the actual field element and returns this field.
*
* @throws \InvalidArgumentException if the given class is invalid
+ * @return static this form field
*/
- public function addFieldClass(string $class): self;
+ public function addFieldClass(string $class);
/**
* Adds the given CSS classes to the actual field element and returns this field.
*
* @throws \InvalidArgumentException if any of the given classes is invalid
+ * @return static this form field
*/
- public function addFieldClasses(array $classes): self;
+ public function addFieldClasses(array $classes);
/**
* Returns all CSS classes of the actual field element.
* If the actual field element does not have the given CSS class, this method silently ignores that fact.
*
* @throws \InvalidArgumentException if the given class is invalid
+ * @return static this form field
*/
- public function removeFieldClass(string $class): self;
+ public function removeFieldClass(string $class);
}
* If `null` is given, the attribute is unset.
*
* @throws \InvalidArgumentException if an invalid `inputmode` token is included in the attribute value
+ * @return static this form field
*/
- public function inputMode(?string $inputMode): self;
+ public function inputMode(?string $inputMode);
}
* Sets the `pattern` attribute of the form field.
*
* If `null` is given, the attribute is unset.
+ *
+ * @return static this form field
*/
- public function pattern(?string $pattern): self;
+ public function pattern(?string $pattern);
}
/**
* @inheritDoc
*/
- public function readValue(): self
+ public function readValue()
{
return $this;
}
* Returns the value of the additional attribute of the actual field element with the given name.
*
* @throws \InvalidArgumentException if the given attribute is invalid or no such attribute exists
+ * @return static this form field
*/
- public function getFieldAttribute(string $name): self
+ public function getFieldAttribute(string $name)
{
if (!$this->hasFieldAttribute($name)) {
throw new \InvalidArgumentException("Unknown attribute '{$name}' requested.");
* Adds the given additional attribute to the actual field element and returns this field.
*
* @throws \InvalidArgumentException if the given attribute is invalid
+ * @return static this form field
*/
- public function fieldAttribute(string $name, ?string $value = null): self
+ public function fieldAttribute(string $name, ?string $value = null)
{
static::validateFieldAttribute($name);
* If the actual field element does not have the given attribute, this method silently ignores that fact.
*
* @throws \InvalidArgumentException if the given attribute is invalid
+ * @return static this form field
*/
- public function removeFieldAttribute(string $name): self
+ public function removeFieldAttribute(string $name)
{
static::validateFieldAttribute($name);
* Multiple tokens can be separated by spaces and if `null` is given, the attribute is unset.
*
* @throws \InvalidArgumentException if an invalid `autocomplete` token is included in the attribute value
+ * @return static this form field
*/
- public function autocomplete(?string $autoComplete): self
+ public function autocomplete(?string $autoComplete)
{
if ($autoComplete !== null && $autoComplete !== 'on' && $autoComplete !== 'off') {
if (\preg_match('~^(?:section-\w+ )?(?:(shipping|billing) )?(?P<token>.+)$~', $autoComplete, $matches)) {
* Adds the given CSS class to the actual field element and returns this field.
*
* @throws \InvalidArgumentException if the given class is invalid
+ * @return static this form field
*/
- public function addFieldClass(string $class): self
+ public function addFieldClass(string $class)
{
static::validateClass($class);
* Adds the given CSS classes to the actual field element and returns this field.
*
* @throws \InvalidArgumentException if any of the given classes is invalid
+ * @return static this form field
*/
- public function addFieldClasses(array $classes): self
+ public function addFieldClasses(array $classes)
{
foreach ($classes as $class) {
$this->addFieldClass($class);
* If the actual field element does not have the given CSS class, this method silently ignores that fact.
*
* @throws \InvalidArgumentException if the given class is invalid
+ * @return static this form field
*/
- public function removeFieldClass(string $class): self
+ public function removeFieldClass(string $class)
{
static::validateClass($class);
* If `null` is given, the attribute is unset.
*
* @throws \InvalidArgumentException if an invalid `inputmode` token is included in the attribute value
+ * @return static this form field
*/
- public function inputMode(?string $inputMode): self
+ public function inputMode(?string $inputMode)
{
if ($inputMode !== null && $inputMode !== 'none' && !\in_array($inputMode, $this->getValidInputModes())) {
throw new \InvalidArgumentException("Invalid inputmode attribute '{$inputMode}'.");
* Sets the `pattern` attribute of the form field.
*
* If `null` is given, the attribute is unset.
+ *
+ * @return static this form field
*/
- public function pattern(?string $pattern): self
+ public function pattern(?string $pattern)
{
$this->pattern = $pattern;