-
Notifications
You must be signed in to change notification settings - Fork 21
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
Add type hints to KlaviyoAPI via PHPDoc #38
base: main
Are you sure you want to change the base?
Conversation
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.
Since this sdk supports 7.4+, we could use type declarations when defining the properties and method signatures. That would add an extra layer of defensive coding around the public properties, which are otherwise open for modification.
The only issue that I can see is that existing code which relies on the dynamic typing of php could break, and with breaking changes comes another major version tag. Then again, this would ensure that the remainder of the code functions exactly as expected though.
Yeah I wanted to avoid any breaking changes, but also we need generics to express how the |
Oh yes, I recognized that syntax - I've spent more time trying to get that passing phpstan than doing the actual fix :P Sounds good and in that case, I approve |
Any chance to have this merged? it's a great QoL change 🙏 |
@AJenbo Hey , Are you still alive? Don't left us ! Can you merge this ? |
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!
I'm still alive but this isn't my project so I can't merged, I just made the proposal |
Using the API is not very friendly as it does not hint the types and so you constantly have to look things up either in code or docs since the IDE is not able to reason about the code. Also the lack of types prevents static analyzers from validating that the code has been written correctly.
I have added some basic hints to the main class, but there appears to be more room for improvements.