-
Notifications
You must be signed in to change notification settings - Fork 256
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
Fix Rate RequestOption and type-hinting #349
base: master
Are you sure you want to change the base?
Conversation
src/Rate.php
Outdated
*/ | ||
public function shopRates($rateRequest) | ||
public function shopRates($rateRequest, string $requestOption = 'Rate'): RateResponse |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please add a class with all requestoption strings? (old school enum)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok but you can create kind of this class. It forces type-hinting instead of relying on pure string while we don't have a good PHPStan coverage.
final class RateRequestOption
{
public const RATE = 'Rate';
public const SHOP = 'Shop';
// ...
}
and use it in function definition
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
IMHO we need add how to run phpstan for some file in example Rate.php to doc: |
PHPStan integration is planned but we need to have a full pass on current docblock because some classes are not up-to-date or typehint is wrong. |
No description provided.