From 763fff5487d5af8bf427236d422f3ac9148e5ccf Mon Sep 17 00:00:00 2001 From: Narek Zakarian Date: Mon, 6 Nov 2023 16:27:57 +0400 Subject: [PATCH] Fix Psalm errors --- src/Api.php | 2 +- src/Xliff/Import.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Api.php b/src/Api.php index 1d8179b..7c02d52 100644 --- a/src/Api.php +++ b/src/Api.php @@ -212,7 +212,7 @@ private function request($method, $path, $data = [], $headers = []) ); if (is_wp_error($response)) { - throw new ApiException($response->get_error_message(), $response->get_error_code()); + throw new ApiException($response->get_error_message(), (int)$response->get_error_code()); } $response_code = wp_remote_retrieve_response_code($response); diff --git a/src/Xliff/Import.php b/src/Xliff/Import.php index 4a03170..dcba2d9 100644 --- a/src/Xliff/Import.php +++ b/src/Xliff/Import.php @@ -266,7 +266,7 @@ protected function importPost( $postData = array_merge((array)$targetPost, $postData); } $targetPostId = wp_insert_post($postData, true); - $targetPost = $targetPostId ? get_post($targetPostId) : null; + $targetPost = !is_wp_error($targetPostId) ? get_post($targetPostId) : null; if (!$targetPost) { return false;