fix: remove union return types for PHP 7.4 compatibility

Union types (array|WP_Error, int|WP_Error, string|WP_Error) require
PHP 8.0+. Removed return type declarations while keeping @return
docblocks intact for IDE/static analysis support.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
peptiderepo
2026-04-16 17:05:12 +07:00
parent f88d752a79
commit 76b258bcc3
2 changed files with 4 additions and 4 deletions

View File

@@ -38,7 +38,7 @@ class PRAutoBlogger_Image_Media_Sideloader {
*
* @return int|\WP_Error Attachment ID on success, WP_Error on failure.
*/
public function sideload_image( array $image_data, int $post_id, string $alt_text = '' ): int | \WP_Error {
public function sideload_image( array $image_data, int $post_id, string $alt_text = '' ) {
// Validate input.
if ( empty( $image_data['bytes'] ) ) {
return new \WP_Error( 'invalid_image_data', 'Image data (bytes) is empty.' );
@@ -97,7 +97,7 @@ class PRAutoBlogger_Image_Media_Sideloader {
*
* @return string|\WP_Error Path to temporary file on success, WP_Error on failure.
*/
private function create_temp_file( string $bytes, string $mime_type ): string | \WP_Error {
private function create_temp_file( string $bytes, string $mime_type ) {
$temp_dir = get_temp_dir();
$filename = 'prautoblogger_img_' . wp_generate_uuid4() . $this->get_extension_for_mime( $mime_type );
$temp_path = $temp_dir . $filename;

View File

@@ -153,7 +153,7 @@ class PRAutoBlogger_Image_Pipeline {
* cost_usd: float,
* }|\WP_Error
*/
private function generate_image_a( int $post_id, array $article_data ): array | \WP_Error {
private function generate_image_a( int $post_id, array $article_data ) {
try {
// Build the article-driven prompt.
$prompt = $this->prompt_builder->build_article_prompt( $article_data );
@@ -219,7 +219,7 @@ class PRAutoBlogger_Image_Pipeline {
* cost_usd: float,
* }|\WP_Error
*/
private function generate_image_b( int $post_id, array $source_data ): array | \WP_Error {
private function generate_image_b( int $post_id, array $source_data ) {
try {
// Build the source-driven prompt.
$prompt = $this->prompt_builder->build_source_prompt( $source_data );