From 800cd897ac3f9b84e7882ac3804c97e1679cbdee Mon Sep 17 00:00:00 2001 From: connor Date: Tue, 9 Apr 2024 08:53:56 +0200 Subject: [PATCH] [validator] improvement: use null coalescing operator --- lib/validator/sfValidatorDate.class.php | 6 +++--- lib/validator/sfValidatorTime.class.php | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/validator/sfValidatorDate.class.php b/lib/validator/sfValidatorDate.class.php index e14fb13e5..19502c8c4 100644 --- a/lib/validator/sfValidatorDate.class.php +++ b/lib/validator/sfValidatorDate.class.php @@ -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( diff --git a/lib/validator/sfValidatorTime.class.php b/lib/validator/sfValidatorTime.class.php index bfc949d69..f2e2507d8 100644 --- a/lib/validator/sfValidatorTime.class.php +++ b/lib/validator/sfValidatorTime.class.php @@ -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) {