diff --git a/includes/core/classes/class-calendars.php b/includes/core/classes/class-calendars.php index 02f5128cd..dc59b9600 100644 --- a/includes/core/classes/class-calendars.php +++ b/includes/core/classes/class-calendars.php @@ -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 ) { @@ -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 ) ); @@ -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 ); } /** diff --git a/includes/core/classes/endpoints/class-endpoint-template.php b/includes/core/classes/endpoints/class-endpoint-template.php index 376dca6ec..cc4cf603d 100644 --- a/includes/core/classes/endpoints/class-endpoint-template.php +++ b/includes/core/classes/endpoints/class-endpoint-template.php @@ -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. @@ -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; } /**