From 8d0e9228ada7672a1fc7e1deb4d3e77680ab5a83 Mon Sep 17 00:00:00 2001 From: Ricardo Sawir <37329575+sawirricardo@users.noreply.github.com> Date: Fri, 12 Jun 2026 15:55:15 +0700 Subject: [PATCH] Fix incorrect @return phpdoc types in Client class The Client methods (post, put, delete, options) documented their return type as \stdClass, but json_decode() returns array for JSON arrays. This caused phpstan errors for users expecting the documented type. The HttpClient::request() method already correctly documents \stdClass|array. Update all Client method phpdocs to match. Fixes #329 --- src/WooCommerce/Client.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/WooCommerce/Client.php b/src/WooCommerce/Client.php index 2bceda3..15582c3 100644 --- a/src/WooCommerce/Client.php +++ b/src/WooCommerce/Client.php @@ -49,7 +49,7 @@ public function __construct($url, $consumerKey, $consumerSecret, $options = []) * @param string $endpoint API endpoint. * @param array $data Request data. * - * @return \stdClass + * @return \stdClass|array */ public function post($endpoint, $data) { @@ -62,7 +62,7 @@ public function post($endpoint, $data) * @param string $endpoint API endpoint. * @param array $data Request data. * - * @return \stdClass + * @return \stdClass|array */ public function put($endpoint, $data) { @@ -88,7 +88,7 @@ public function get($endpoint, $parameters = []) * @param string $endpoint API endpoint. * @param array $parameters Request parameters. * - * @return \stdClass + * @return \stdClass|array */ public function delete($endpoint, $parameters = []) { @@ -100,7 +100,7 @@ public function delete($endpoint, $parameters = []) * * @param string $endpoint API endpoint. * - * @return \stdClass + * @return \stdClass|array */ public function options($endpoint) {