99use Yiisoft \Validator \Rule \Trait \SkipOnErrorTrait ;
1010use Yiisoft \Validator \Rule \Trait \WhenTrait ;
1111use Yiisoft \Validator \SerializableRuleInterface ;
12- use Yiisoft \Validator \SkipOnEmptyCallback \ SkipOnEmpty ;
12+ use Yiisoft \Validator \EmptyCriteria \ WhenEmpty ;
1313use Yiisoft \Validator \SkipOnErrorInterface ;
1414use Yiisoft \Validator \ValidationContext ;
1515use Yiisoft \Validator \WhenInterface ;
1616
1717/**
1818 * Validates that the specified value is neither null nor empty.
1919 *
20- * @psalm-type EmptyCallbackType = callable(mixed,bool):bool
20+ * @psalm-type EmptyCriteriaType = callable(mixed,bool):bool
2121 */
2222#[Attribute(Attribute::TARGET_PROPERTY | Attribute::IS_REPEATABLE )]
2323final class Required implements SerializableRuleInterface, SkipOnErrorInterface, WhenInterface
@@ -27,24 +27,24 @@ final class Required implements SerializableRuleInterface, SkipOnErrorInterface,
2727
2828 /**
2929 * @var callable
30- * @psalm-var EmptyCallbackType
30+ * @psalm-var EmptyCriteriaType
3131 */
32- private $ emptyCallback ;
32+ private $ emptyCriteria ;
3333
3434 /**
35- * @psalm-param EmptyCallbackType |null $emptyCallback
35+ * @psalm-param EmptyCriteriaType |null $emptyCriteria
3636 */
3737 public function __construct (
3838 private string $ message = 'Value cannot be blank. ' ,
3939 private string $ notPassedMessage = 'Value not passed. ' ,
40- callable |null $ emptyCallback = null ,
40+ callable |null $ emptyCriteria = null ,
4141 private bool $ skipOnError = false ,
4242 /**
4343 * @var Closure(mixed, ValidationContext):bool|null
4444 */
4545 private ?Closure $ when = null ,
4646 ) {
47- $ this ->emptyCallback = $ emptyCallback ?? new SkipOnEmpty (trimString: true );
47+ $ this ->emptyCriteria = $ emptyCriteria ?? new WhenEmpty (trimString: true );
4848 }
4949
5050 public function getName (): string
@@ -63,11 +63,11 @@ public function getNotPassedMessage(): string
6363 }
6464
6565 /**
66- * @psalm-return EmptyCallbackType
66+ * @psalm-return EmptyCriteriaType
6767 */
68- public function getEmptyCallback (): callable
68+ public function getEmptyCriteria (): callable
6969 {
70- return $ this ->emptyCallback ;
70+ return $ this ->emptyCriteria ;
7171 }
7272
7373 public function getOptions (): array
0 commit comments