Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add setRequired and PHPDoc update #19

Merged
merged 1 commit into from
Jul 1, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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