fix more function return types in transformers
All checks were successful
PHP Code Checker / PHP Code Checker (pull_request) Successful in 33s
PHPUnit / PHPUnit – PHP 8.1 (pull_request) Successful in 1m3s
PHPUnit / PHPUnit – PHP 8.2 (pull_request) Successful in 57s
PHPUnit / PHPUnit – PHP 8.3 (pull_request) Successful in 52s

This commit is contained in:
André Menrath 2024-09-25 14:30:37 +02:00
parent 4d4328f3fd
commit c13230ac6f
3 changed files with 6 additions and 14 deletions

View file

@ -89,7 +89,7 @@ final class Events_Manager extends Event_Transformer {
*
* @return array The Place.
*/
public function get_location() {
public function get_location(): ?Place {
if ( 'url' === $this->em_event->event_location_type ) {
return null;
}
@ -181,7 +181,7 @@ final class Events_Manager extends Event_Transformer {
/**
* Hardcoded function for generating a summary.
*/
public function get_summary() {
public function get_summary(): ?string {
if ( $this->em_event->post_excerpt ) {
$excerpt = $this->em_event->post_excerpt;
} else {

View file

@ -81,7 +81,7 @@ final class GatherPress extends Event {
*
* @return Place|null The place objector null if not place set.
*/
public function get_location(): Place|null {
public function get_location(): ?Place {
$address = $this->gp_venue['full_address'];
if ( $address ) {
$place = new Place();

View file

@ -31,17 +31,6 @@ final class VS_Event_List extends Event_Transformer {
*/
protected $ap_object;
/**
* Returns the ActivityStreams 2.0 Object-Type for an Event.
*
* @see https://www.w3.org/TR/activitystreams-vocabulary/#dfn-event
* @since 1.0.0
* @return string The Event Object-Type.
*/
protected function get_type(): string {
return 'Event';
}
/**
* Get the event location.
*
@ -68,6 +57,9 @@ final class VS_Event_List extends Event_Transformer {
return null;
}
$end_time = get_post_meta( $this->wp_object->ID, 'event-date', true );
if ( is_null( $end_time ) || empty( $end_time ) || 'no' === $end_time ) {
return null;
}
return $end_time ? \gmdate( 'Y-m-d\TH:i:s\Z', $end_time ) : null;
}