picqer / picqer-php

PHP Client for the Picqer API
https://picqer.com/en/api
MIT License
18 stars 23 forks source link

[enhancement] Add type hinting #33

Open S-K-Tiger opened 2 years ago

S-K-Tiger commented 2 years ago

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');
}