From 19b651c68c3ab13d26c225abc3cd60426094f78e Mon Sep 17 00:00:00 2001 From: TZK- <7808125+TZK-@users.noreply.github.com> Date: Mon, 13 Dec 2021 15:50:19 +0100 Subject: [PATCH] Remove API CRUD methods typehint API may not always return an object or array but only integers or strings for example. If CRUD methods force return type, it may throw TypeError exception. --- src/Api.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Api.php b/src/Api.php index d2a0810..79e66fe 100755 --- a/src/Api.php +++ b/src/Api.php @@ -114,9 +114,9 @@ protected function findOne(string $endpoint, $id, array $filters = []) * @param int $id * @param $attributes * - * @return array + * @return mixed|array */ - protected function update(string $endpoint, $id, $attributes): array + protected function update(string $endpoint, $id, $attributes) { $key = $endpoint.'/'.$id.'?'; @@ -129,9 +129,9 @@ protected function update(string $endpoint, $id, $attributes): array * @param string $endpoint * @param $attributes * - * @return array + * @return mixed|array */ - protected function create(string $endpoint, $attributes): array + protected function create(string $endpoint, $attributes) { return $this->getTransport()->request('/'.$endpoint, $attributes, 'post') ?? []; } @@ -142,9 +142,9 @@ protected function create(string $endpoint, $attributes): array * @param string $endpoint * @param int $id * - * @return array + * @return mixed|array */ - protected function delete(string $endpoint, $id): array + protected function delete(string $endpoint, $id) { $key = $endpoint.'/'.$id.'?'; $this->deleteCache($key);