woocommerce / woocommerce/wc-api-php

Client return types are array not stdClass

Open
#329 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

stale
Dominant language
PHP
Stars
546
Forks
158
Avg merge
3h 21m
Merged PRs (30d)
2

Description

If I do a get call to the orders endpoint for example, it seems to return an array but the phpdoc says stdClass. The change that led to this documentation seems to have come in https://github.com/woocommerce/wc-api-php/pull/286

This gives us problems as phpstan reports errors based on the return type expected. Is the correct return type array or should it be returning an stdClass?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the client handling of GET requests to the orders endpoint and review the documentation change from pull request #286. Compare the returned value with its PHPDoc type and determine which type is correct; done when the documented return type matches the actual result and the phpstan errors are resolved.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.