Skip to content

Commit

Permalink
Update Form.php
Browse files Browse the repository at this point in the history
  • Loading branch information
viames committed Jul 3, 2024
1 parent 7ae5db1 commit 9f49656
Showing 1 changed file with 10 additions and 38 deletions.
48 changes: 10 additions & 38 deletions src/Form.php
Original file line number Diff line number Diff line change
Expand Up @@ -631,10 +631,8 @@ public function setId(string $id): FormControlSelect|FormControlInput|FormContro
/**
* Sets this field as required (enables JS client-side and PHP server-side validation).
* Chainable method.
*
* @return FormControl subclass
*/
public function setRequired(): FormControl {
public function setRequired(): FormControlSelect|FormControlInput|FormControlTextarea|FormControlButton {

$this->required = TRUE;
return $this;
Expand All @@ -643,10 +641,8 @@ public function setRequired(): FormControl {

/**
* Sets this field as disabled only. Chainable method.
*
* @return FormControl
*/
public function setDisabled(): FormControl {
public function setDisabled(): FormControlSelect|FormControlInput|FormControlTextarea|FormControlButton {

$this->disabled = TRUE;
return $this;
Expand All @@ -655,10 +651,8 @@ public function setDisabled(): FormControl {

/**
* Sets this field as read only. Chainable method.
*
* @return FormControl subclass
*/
public function setReadonly(): FormControl {
public function setReadonly(): FormControlSelect|FormControlInput|FormControlTextarea|FormControlButton {

$this->readonly = TRUE;
return $this;
Expand All @@ -667,10 +661,8 @@ public function setReadonly(): FormControl {

/**
* Sets this field as array. Will add [] to control name. Chainable method.
*
* @return FormControl subclass
*/
public function setArrayName(): FormControl {
public function setArrayName(): FormControlSelect|FormControlInput|FormControlTextarea|FormControlButton {

$this->arrayName = TRUE;
return $this;
Expand All @@ -681,9 +673,8 @@ public function setArrayName(): FormControl {
* Sets placeholder text. Chainable method.
*
* @param string Placeholder’s text.
* @return FormControl subclass
*/
public function setPlaceholder(string $text): FormControl {
public function setPlaceholder(string $text): FormControlSelect|FormControlInput|FormControlTextarea|FormControlButton {

$this->placeholder = $text;
return $this;
Expand All @@ -694,10 +685,8 @@ public function setPlaceholder(string $text): FormControl {
* Sets minimum length for value of this control. It’s a chainable method.
*
* @param int Minimum length for value.
*
* @return FormControl subclass
*/
public function setMinLength(int $length): FormControl {
public function setMinLength(int $length): FormControlSelect|FormControlInput|FormControlTextarea|FormControlButton {

$this->minLength = $length;
return $this;
Expand All @@ -708,10 +697,8 @@ public function setMinLength(int $length): FormControl {
* Sets maximum length for value of this control. It’s a chainable method.
*
* @param int Maximum length for value.
*
* @return FormControl subclass
*/
public function setMaxLength(int $length): FormControl {
public function setMaxLength(int $length): FormControlSelect|FormControlInput|FormControlTextarea|FormControlButton {

$this->maxLength = $length;
return $this;
Expand All @@ -723,10 +710,8 @@ public function setMaxLength(int $length): FormControl {
* duplicates. This method is chainable.
*
* @param string|array Single class name, list space separated or array of class names.
*
* @return FormControl subclass
*/
public function addClass($class): FormControl {
public function addClass($class): FormControlSelect|FormControlInput|FormControlTextarea|FormControlButton {

// classes array
if (is_array($class)) {
Expand All @@ -753,9 +738,8 @@ public function addClass($class): FormControl {
* Set a label for this control as text or translation key. Chainable method.
*
* @param string The text label or the uppercase translation key.
* @return FormControl
*/
public function setLabel(string $label): FormControl {
public function setLabel(string $label): FormControlSelect|FormControlInput|FormControlTextarea|FormControlButton {

$this->label = $label;

Expand All @@ -765,8 +749,6 @@ public function setLabel(string $label): FormControl {

/**
* Return the control’s label.
*
* @return string
*/
public function getLabel(): string {

Expand Down Expand Up @@ -795,9 +777,8 @@ public function getLabel(): string {
* Set a description for this control as text. Chainable method.
*
* @param string The text description.
* @return FormControl
*/
public function setDescription(string $description): FormControl {
public function setDescription(string $description): FormControlSelect|FormControlInput|FormControlTextarea|FormControlButton {

$this->description = $description;

Expand All @@ -807,8 +788,6 @@ public function setDescription(string $description): FormControl {

/**
* Return the control’s description.
*
* @return string
*/
public function getDescription(): string {

Expand All @@ -818,8 +797,6 @@ public function getDescription(): string {

/**
* Print the control’s label even with required-field class.
*
* @return void
*/
public function printLabel(): void {

Expand All @@ -842,7 +819,6 @@ public function printLabel(): void {
* Print the HTML code of this FormControl.
*
* @param string HTML name of the wanted control.
* @return void
*/
public function printControl(): void {

Expand All @@ -852,8 +828,6 @@ public function printControl(): void {

/**
* Process and return the common control attributes.
*
* @return string
*/
protected function processProperties(): string {

Expand Down Expand Up @@ -891,8 +865,6 @@ protected function processProperties(): string {

/**
* Create a control name escaping special chars and adding array puncts in case of.
*
* @return string
*/
protected function getNameProperty(): string {

Expand Down

0 comments on commit 9f49656

Please sign in to comment.