From f1f0860b8bea807cc5b6b712c2c566f2161f5609 Mon Sep 17 00:00:00 2001 From: Jannes Date: Tue, 7 May 2024 14:17:32 +0200 Subject: [PATCH] Simplify and prevent warnings --- src/generators/schema/howto.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/generators/schema/howto.php b/src/generators/schema/howto.php index 7d9352598be..2208e25b3f2 100644 --- a/src/generators/schema/howto.php +++ b/src/generators/schema/howto.php @@ -46,9 +46,9 @@ private function add_duration( &$data, $attributes ) { return; } - $days = ! \is_numeric( $attributes['days'] ) ? 0 : \intval( $attributes['days'] ); - $hours = ! \is_numeric( $attributes['hours'] ) ? 0 : \intval( $attributes['hours'] ); - $minutes = ! \is_numeric( $attributes['minutes'] ) ? 0 : \intval( $attributes['minutes'] ); + $days = \intval( $attributes['days'] ?? 0 ); + $hours = \intval( $attributes['hours'] ?? 0 ); + $minutes = \intval( $attributes['minutes'] ?? 0 ); if ( ( $days + $hours + $minutes ) > 0 ) { $data['totalTime'] = \esc_attr( 'P' . $days . 'DT' . $hours . 'H' . $minutes . 'M' );