Skip to content

[enhancement] Add type hinting #33

@S-K-Tiger

Description

@S-K-Tiger

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions