Skip to content

Commit

Permalink
Add setRequired and PHPDoc update
Browse files Browse the repository at this point in the history
  • Loading branch information
kgrzelak committed Jul 1, 2024
1 parent 46c415f commit dff11f4
Showing 1 changed file with 24 additions and 12 deletions.
36 changes: 24 additions & 12 deletions src/BaseItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function __construct()
}

/**
* @description Set the id attribute of the input
* @description Set the id attribute of the element
* @param string|int $id
* @return static
*/
Expand All @@ -55,8 +55,8 @@ public function setId(string $id): static
}

/**
* @description Set the name attribute of the input
* @param string $name - Name of the input
* @description Set the name attribute of the element
* @param string $name - Name of the element
* @return static
*/
public function name(string $name): static
Expand All @@ -68,7 +68,7 @@ public function name(string $name): static

/**
* @deprecated Use name() instead
* @param string $name - Name of the input
* @param string $name - Name of the element
* @return $this
*/
public function setName(string $name): static
Expand Down Expand Up @@ -105,7 +105,7 @@ public function setType(?string $type = null): static

/**
* @description Set the value of the input
* @param mixed|null $value - Value of the input
* @param mixed|null $value - Value of the element
* @return static
*/
public function value(mixed $value = null): static
Expand Down Expand Up @@ -144,7 +144,7 @@ public function setValue(mixed $value = null): static
}

/**
* @description Set the placeholder of the input
* @description Set the placeholder of the element
* @param string $placeholder
* @return static
*/
Expand All @@ -156,7 +156,7 @@ public function placeholder(string $placeholder): static
}

/**
* @description Set the required attribute of the input
* @description Set the required attribute of the element
* @param bool $required
* @return static
*/
Expand All @@ -168,8 +168,20 @@ public function required(bool $required): static
}

/**
* @description Set the class of the input
* @param string $class - Name of the class
* @deprecated Use required() instead
* @param bool $required
* @return static
*/
public function setRequired(bool $required): static
{
$this->attributes->setAttribute('required', $required);

return $this;
}

/**
* @description Set the class of the element
* @param string $class - Name of the element class
* @return static
*/
public function setClass(string $class): static
Expand All @@ -180,8 +192,8 @@ public function setClass(string $class): static
}

/**
* @description Add a class to the input
* @param string $class - Name of the class
* @description Add a class to the element
* @param string $class - Name of the element class
* @return static
*/
public function addClass(string $class): static
Expand All @@ -192,7 +204,7 @@ public function addClass(string $class): static
}

/**
* @description Set the attribute of the input
* @description Set the attribute of the element
* @param string|int $name - Name of the attribute
* @param string|null $value - Value of the attribute
* @return static
Expand Down

0 comments on commit dff11f4

Please sign in to comment.