-
-
Notifications
You must be signed in to change notification settings - Fork 438
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
Added getter/setter for getCouponCode() #2825
Conversation
converted it to draft so that it doesn't appear in https://fabrizioballiano.com/om/pr_status.html ;-) |
This is ready to test ... If its okay to fix it that way, ill add some commits. |
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.
LGTM
* @param string $couponCode | ||
* @return $this | ||
*/ | ||
public function setCouponCode(string $couponCode) #static with php74 |
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.
what does "static with php74" comment mean?
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.
When adding new methods i tried to add type hints and return types if possible ... , was not sure about adding self
. Its a php8 change not 7.4 (https://php.watch/versions/8.0/static-return-type) ... comment can be removed.
However ... this should not be merged yet. If it's okay to add some getter/setter to avoid changes in templates, i'd also fix the other issues found by @elidrissidev.
I haven't checked this yet, usages of getCouponCode need to be checked carefully since this change will make it always a return a string even if not set. |
Yes, but an empty string is no valid coupon code, |
I know, I meant just to make sure there's no code that expects null or something. I remember similar issue happened before due to introducing getters that change the type. |
Think this would be found by phpstan ... https://phpstan.org/r/6b275cc5-439a-4af3-b201-b6c932a07b16 |
Just checked all the |
Thanks for review. 👍 I'd add some more to fix the issues you've found during your test. |
On hold ... #2884 |
Just fix coupon code related code here. |
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.
good approach
Description (*)
@elidrissidev #2586 (comment)
Added first getter/setter for test ... should make some changes to templates obsolete.
Related Pull Requests
$this->getCouponCode()