Skip to content

Commit

Permalink
Remove the union return type declarations to become compatible with P…
Browse files Browse the repository at this point in the history
…HP 7.4
  • Loading branch information
carstingaxion committed Sep 17, 2024
1 parent ae0e3f5 commit f6530c5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions includes/core/classes/class-calendars.php
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ public function get_ical_feed_template(): array {
*
* @return string|false URL of the posts endpoint or false if something went wrong.
*/
public static function get_url( string $endpoint_slug, $post = null, string $query_var = self::QUERY_VAR ): string|false {
public static function get_url( string $endpoint_slug, $post = null, string $query_var = self::QUERY_VAR ) {
$post = get_post( $post );

if ( ! $post ) {
Expand All @@ -407,7 +407,7 @@ public static function get_url( string $endpoint_slug, $post = null, string $que
if ( false !== $is_feed_endpoint ) {
// Feels weird to use a *_comments_* function here, but it delivers clean results
// in the form of "domain.tld/event/my-sample-event/feed/ical/".
return get_post_comments_feed_link(
return (string) get_post_comments_feed_link(
$post->ID,
substr( $endpoint_slug, $is_feed_endpoint )
);
Expand Down Expand Up @@ -441,7 +441,7 @@ public static function get_url( string $endpoint_slug, $post = null, string $que
)
);

return sanitize_url( $endpoint_url );
return (string) sanitize_url( $endpoint_url );
}

/**
Expand Down
4 changes: 2 additions & 2 deletions includes/core/classes/endpoints/class-endpoint-template.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ protected function get_template_presets(): array {
* @param string $file_name The name of the template file.
* @return string|false The path to the theme template or false if not found.
*/
protected function get_template_from_theme( string $file_name ): string|false {
protected function get_template_from_theme( string $file_name ) {

// locate_template() doesn't cares,
// but locate_block_template() needs this to be an array.
Expand All @@ -143,7 +143,7 @@ protected function get_template_from_theme( string $file_name ): string|false {
$templates
);

return $template;
return ( is_string( $template ) && ! empty( $template ) ) ? $template : false;
}

/**
Expand Down

0 comments on commit f6530c5

Please sign in to comment.