Skip to content

Commit

Permalink
[validator] improvement: use null coalescing operator
Browse files Browse the repository at this point in the history
  • Loading branch information
connorhu committed Apr 9, 2024
1 parent 1c5e9e7 commit 4d3f444
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions lib/validator/sfValidatorDate.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -189,9 +189,9 @@ protected function convertDateArrayToString($value)
(int) $value['year'],
(int) $value['month'],
(int) $value['day'],
isset($value['hour']) ? (int) $value['hour'] : 0,
isset($value['minute']) ? (int) $value['minute'] : 0,
isset($value['second']) ? (int) $value['second'] : 0
(int) $value['hour'] ?? 0,
(int) $value['minute'] ?? 0,
(int) $value['second'] ?? 0,
);
} else {
$clean = sprintf(
Expand Down
6 changes: 3 additions & 3 deletions lib/validator/sfValidatorTime.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,9 @@ protected function convertTimeArrayToTimestamp($value)
}

$clean = mktime(
isset($value['hour']) ? (int) $value['hour'] : 0,
isset($value['minute']) ? (int) $value['minute'] : 0,
isset($value['second']) ? (int) $value['second'] : 0
(int) $value['hour'] ?? 0,
(int) $value['minute'] ?? 0,
(int) $value['second'] ?? 0,
);

if (false === $clean) {
Expand Down

0 comments on commit 4d3f444

Please sign in to comment.