fix return types of transformer functions
Some checks failed
PHP Code Checker / PHP Code Checker (pull_request) Failing after 36s
PHPUnit / PHPUnit – PHP 8.2 (pull_request) Has been cancelled
PHPUnit / PHPUnit – PHP 8.3 (pull_request) Has been cancelled
PHPUnit / PHPUnit – PHP 8.1 (pull_request) Has been cancelled

This commit is contained in:
André Menrath 2024-09-25 14:24:30 +02:00
parent ac99300949
commit 35bd198f47
3 changed files with 9 additions and 6 deletions

View file

@ -125,14 +125,14 @@ final class Events_Manager extends Event_Transformer {
/** /**
* Get the end time from the events metadata. * Get the end time from the events metadata.
*/ */
public function get_end_time() { public function get_end_time(): ?string {
return null; return null;
} }
/** /**
* Get the end time from the events metadata. * Get the end time from the events metadata.
*/ */
public function get_start_time() { public function get_start_time(): string {
$date_string = $this->em_event->event_start_date; $date_string = $this->em_event->event_start_date;
$time_string = $this->em_event->event_start_time; $time_string = $this->em_event->event_start_time;
$timezone_string = $this->em_event->event_timezone; $timezone_string = $this->em_event->event_timezone;

View file

@ -97,14 +97,14 @@ final class GatherPress extends Event {
/** /**
* Get the end time from the event object. * Get the end time from the event object.
*/ */
protected function get_end_time() { protected function get_end_time(): ?string {
return $this->gp_event->get_datetime_end( 'Y-m-d\TH:i:s\Z' ); return $this->gp_event->get_datetime_end( 'Y-m-d\TH:i:s\Z' );
} }
/** /**
* Get the end time from the event object. * Get the end time from the event object.
*/ */
protected function get_start_time() { protected function get_start_time(): string {
return $this->gp_event->get_datetime_start( 'Y-m-d\TH:i:s\Z' ); return $this->gp_event->get_datetime_start( 'Y-m-d\TH:i:s\Z' );
} }

View file

@ -64,7 +64,10 @@ final class The_Events_Calendar extends Event {
/** /**
* Get the end time from the event object. * Get the end time from the event object.
*/ */
protected function get_end_time() { protected function get_end_time(): ?string {
if ( empty( $this->tribe_event->end_date ) ) {
return null;
}
$date = date_create( $this->tribe_event->end_date, wp_timezone() ); $date = date_create( $this->tribe_event->end_date, wp_timezone() );
return \gmdate( 'Y-m-d\TH:i:s\Z', $date->getTimestamp() ); return \gmdate( 'Y-m-d\TH:i:s\Z', $date->getTimestamp() );
} }
@ -72,7 +75,7 @@ final class The_Events_Calendar extends Event {
/** /**
* Get the end time from the event object. * Get the end time from the event object.
*/ */
protected function get_start_time() { protected function get_start_time(): string {
$date = date_create( $this->tribe_event->start_date, wp_timezone() ); $date = date_create( $this->tribe_event->start_date, wp_timezone() );
return \gmdate( 'Y-m-d\TH:i:s\Z', $date->getTimestamp() ); return \gmdate( 'Y-m-d\TH:i:s\Z', $date->getTimestamp() );
} }