Request assumes the $product value to be an integer. And the Renew class assumes it to be a Product. But this is not enforced in either with a type declaration or a check and this is inconsistent between the two.
Suggested solution:
Instead of breaking the client for anyone currently using it in this manner(We just cast it to an object and that works for now). Allowing people to input an integer on the Renew&Request class constructor and checking in the getArray method by checking if it is an object or not and then either just placing the $this->product or $this->product->id into the array
This is what this pull request does.
An alternative could be to enforce the Product on both renew and request class constructors with a type declaration. This would be problematic for anyone already using this client.
Request assumes the $product value to be an integer. And the Renew class assumes it to be a Product. But this is not enforced in either with a type declaration or a check and this is inconsistent between the two.
Renew: https://github.com/xolphin/xolphin-api-php/blob/709c24efa6f33342799f1e3b1abd86d722e5044c/src/Requests/Renew.php#L78
Request: https://github.com/xolphin/xolphin-api-php/blob/709c24efa6f33342799f1e3b1abd86d722e5044c/src/Requests/Request.php#L85
Suggested solution: Instead of breaking the client for anyone currently using it in this manner(We just cast it to an object and that works for now). Allowing people to input an integer on the Renew&Request class constructor and checking in the getArray method by checking if it is an object or not and then either just placing the $this->product or $this->product->id into the array
This is what this pull request does.
An alternative could be to enforce the Product on both renew and request class constructors with a type declaration. This would be problematic for anyone already using this client.