Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[enhancement] Add type hinting #33

Open
S-K-Tiger opened this issue Nov 5, 2021 · 0 comments
Open

[enhancement] Add type hinting #33

S-K-Tiger opened this issue Nov 5, 2021 · 0 comments

Comments

@S-K-Tiger
Copy link

While I don't expect the amount of detail I added in the example below I would expect type hints for single type returns and parameters.

For example changing

public function getProductStock($idproduct) {
  return $this->sendRequest('/products/' . $idproduct . '/stock');
}

to

/**
* Requesting the stock for a product gives you the stock for the product per warehouse.
* @param string|int $idproduct
* @return array<string,(bool|string|array<int,array<string,int>>)>(3) {
  "success"=>bool,
  "rate-limit-remaining"=>string,
  "data"=> array<int, array<string, int>> {
    array<string, int>(7) {
      "idwarehouse"=>int,
      "stock"=>int,
      "reserved"=>int,
      "reservedbackorders"=>int,
      "reservedpicklists"=>int,
      "reservedallocations"=>int,
      "freestock"=>int
    }
  }
}
* @see https://picqer.com/en/api/product-stock
*/
public function getProductStock($idproduct): array {
  return $this->sendRequest('/products/' . $idproduct . '/stock');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant