Skip to content

Commit

Permalink
Refactor Validator
Browse files Browse the repository at this point in the history
  • Loading branch information
hungnguyenhp committed Mar 10, 2023
1 parent fdc6ba3 commit 3a4172d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/BaseHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
*/
class BaseHelper
{
const VERSION = '1.3.1';
const VERSION = '1.3.2';
const LAST_MODIFIED = '2023-03-10';
const PROJECT_NAME = 'CodeIgniter - Basic Helper';
const AUTHOR_NAME = 'Hung Nguyen';
Expand Down
6 changes: 2 additions & 4 deletions src/Validator.php
Original file line number Diff line number Diff line change
Expand Up @@ -1043,8 +1043,7 @@ protected function validateRequiredWith($field, $value, $params, $fields)
}
}
// if we have conditionally required fields
if ($conditionallyReq && (is_null($value) ||
is_string($value) && trim($value) === '')) {
if ($conditionallyReq && (is_null($value) || (is_string($value) && trim($value) === ''))) {
return false;
}

Expand Down Expand Up @@ -1089,8 +1088,7 @@ protected function validateRequiredWithout($field, $value, $params, $fields)
}
}
// if we have conditionally required fields
if ($conditionallyReq && (is_null($value) ||
is_string($value) && trim($value) === '')) {
if ($conditionallyReq && (is_null($value) || (is_string($value) && trim($value) === ''))) {
return false;
}

Expand Down

0 comments on commit 3a4172d

Please sign in to comment.