fix more function return types in transformers
All checks were successful
All checks were successful
This commit is contained in:
parent
4d4328f3fd
commit
c13230ac6f
3 changed files with 6 additions and 14 deletions
|
@ -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 {
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue