-
Notifications
You must be signed in to change notification settings - Fork 61
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
API Strongly type everything #460
API Strongly type everything #460
Conversation
In some cases you've removed the params and returns from phpdoc blocks and in other cases you e retained it. We should be consistent about that (and probably have at least a semiformal policy about it to make it easier on ourselves when it comes time to strongly type other modules) |
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.
I try to strongly type everything.
There's a few places where array definition where clearly meant to be callabale
so I swapped those.
When the PHPDoc was just repeating the explicit types, I removed it.
/** | ||
* Represents middleware for evaluating a graphql query | ||
*/ | ||
interface Middleware |
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.
I couldn't find this being used anywhere.
|
||
namespace SilverStripe\GraphQL\Middleware; | ||
|
||
trait MiddlewareConsumer |
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.
Couldn't find this being used anywhere.
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.
I haven't gone through the whole PR 'cause it's pretty big - there's a lot of inconsistency about keeping or removing @param
and @returns
declarations in PHPDocs even when they match the typehints exactly.
There are also a couple of other small changes here (namely some missing typehints) - but again I haven't checked the whole PR much less had a hunt around outside the diff to see if there were others missed out.
5d4899e
to
5d0b91a
Compare
Just pushed a few extra changes to explicitly require all the libraries directly reference in the codebase and to make Versioned optional. |
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.
You've still got a lot of PHPDocs here that are duplicating (and in at least one case in conflict with) the strong param and/or return types. I'm not going to go through and ping them all in the review because you'll still have to go through and find them all in your IDE to remove them, so it's just duplication of effort.
Consider this a blanket "Please remove the PHPDocs param
and return
declarations that are the same as the strong typehints, and validate any that are in conflict.
6f40f65
to
45b5763
Compare
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.
Still a lot of types mentioned in PHPDocs. I've gone through and tagged them this time.
Note that in some cases it's possible that removing just the bits I've pinged will result in an empty PHPDoc - in those cases the whole PHPDoc should be thrown out.
I did find some missing types (see comments)
There's also a question in here about typing callables as array
.
* @param int $timeout | ||
* @return null|string |
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.
* @param int $timeout | |
* @return null|string |
Also remove the url param phpdoc.
a6f1766
to
a99055b
Compare
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.
Looks good to me. A few phpdocs missed but we've agreed over slack that some redundant phpdocs here or there isn't the end of the world, and shouldn't block this PR being merged.
Merge on green.
Behat failure is on master already, so not related to this PR. |
Trying to strongly type everything.
Parent issue