File tree Expand file tree Collapse file tree 2 files changed +10
-6
lines changed Expand file tree Collapse file tree 2 files changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -64,7 +64,7 @@ public function setRequired($value = TRUE)
6464 */
6565 public function isRequired ()
6666 {
67- return $ this -> required instanceof Rule ? ! $ this ->required -> isNegative : FALSE ;
67+ return ( bool ) $ this ->required ;
6868 }
6969
7070
@@ -281,6 +281,11 @@ private function adjustOperation($rule)
281281 $ name = strncmp ($ rule ->validator , ': ' , 1 ) ? $ rule ->validator : 'Form: ' . strtoupper ($ rule ->validator );
282282 trigger_error ("Negative validation rules such as ~ $ name are deprecated. " , E_USER_DEPRECATED );
283283 }
284+ if ($ rule ->validator === Form::FILLED ) {
285+ $ rule ->validator = Form::BLANK ;
286+ $ rule ->isNegative = FALSE ;
287+ trigger_error ('Replace negative validation rule ~Form::FILLED with Form::BLANK. ' , E_USER_DEPRECATED );
288+ }
284289 }
285290
286291 if (!is_callable ($ this ->getCallback ($ rule ))) {
Original file line number Diff line number Diff line change @@ -57,13 +57,12 @@ test(function () { // 'required' is always the first rule
5757
5858 @$ rules ->addRule (~$ form ::REQUIRED ); // @ - negative rules are deprecated
5959 $ items = iterator_to_array ($ rules );
60- Assert::count (2 , $ items );
61- Assert::same (Form::REQUIRED , $ items [0 ]->validator );
62- Assert::true ($ items [0 ]->isNegative );
63- Assert::same (Form::EMAIL , $ items [1 ]->validator );
60+ Assert::count (3 , $ items );
61+ Assert::same (Form::BLANK , $ items [2 ]->validator );
62+ Assert::false ($ items [2 ]->isNegative );
6463
6564 Assert::false ($ rules ->validate ());
66- Assert::same (['Please enter a valid email address . ' ], $ input ->getErrors ());
65+ Assert::same (['This field is required . ' ], $ input ->getErrors ());
6766});
6867
6968
You can’t perform that action at this time.
0 commit comments