generated from yii-tools/template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHasMin.php
33 lines (29 loc) · 954 Bytes
/
HasMin.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<?php
declare(strict_types=1);
namespace UIAwesome\Html\Attribute\FormControl;
/**
* Is used by widgets that implement the min method.
*/
trait HasMin
{
/**
* Set the min value valid for date, month, week, time, datetime-local, number, and range, it defines the smallest
* value in the range of permitted values.
*
* If the value entered into the element is less than this, the element fails constraint validation.
*
* If the value of the min attribute isn't a number, then the element has no minimum value.
*
* @param int|string $value The minimum value.
*
* @return static A new instance of the current class with the specified minimum value.
*
* @link https://html.spec.whatwg.org/multipage/input.html#attr-input-min
*/
public function min(int|string $value): static
{
$new = clone $this;
$new->attributes['min'] = $value;
return $new;
}
}