Skip to content

Commit 4674420

Browse files
committed
Validator: fixed type hints, arguments can be string when reference to another form field is used: addRule($form::RANGE, NULL, [$form['min'], $form['max'])
1 parent 362aedb commit 4674420

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/Forms/Validator.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ public static function validateRange(IControl $control, array $range): bool
159159
/**
160160
* Is a control's value number greater than or equal to the specified minimum?
161161
*/
162-
public static function validateMin(IControl $control, float $minimum): bool
162+
public static function validateMin(IControl $control, $minimum): bool
163163
{
164164
return Validators::isInRange($control->getValue(), [$minimum, NULL]);
165165
}
@@ -168,7 +168,7 @@ public static function validateMin(IControl $control, float $minimum): bool
168168
/**
169169
* Is a control's value number less than or equal to the specified maximum?
170170
*/
171-
public static function validateMax(IControl $control, float $maximum): bool
171+
public static function validateMax(IControl $control, $maximum): bool
172172
{
173173
return Validators::isInRange($control->getValue(), [NULL, $maximum]);
174174
}
@@ -191,7 +191,7 @@ public static function validateLength(IControl $control, $range): bool
191191
/**
192192
* Has control's value minimal count/length?
193193
*/
194-
public static function validateMinLength(IControl $control, int $length): bool
194+
public static function validateMinLength(IControl $control, $length): bool
195195
{
196196
return static::validateLength($control, [$length, NULL]);
197197
}
@@ -200,7 +200,7 @@ public static function validateMinLength(IControl $control, int $length): bool
200200
/**
201201
* Is control's value count/length in limit?
202202
*/
203-
public static function validateMaxLength(IControl $control, int $length): bool
203+
public static function validateMaxLength(IControl $control, $length): bool
204204
{
205205
return static::validateLength($control, [NULL, $length]);
206206
}
@@ -243,7 +243,7 @@ public static function validateUrl(IControl $control): bool
243243
/**
244244
* Matches control's value regular expression?
245245
*/
246-
public static function validatePattern(IControl $control, $pattern): bool
246+
public static function validatePattern(IControl $control, string $pattern): bool
247247
{
248248
return (bool) Strings::match($control->getValue(), "\x01^(?:$pattern)\\z\x01u");
249249
}

0 commit comments

Comments
 (0)