You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would be great if the different sub-APIs could be exposed through dedicated methods in the main client rather than having to use ->api('issues') which breaks any kind of autocompletion or type checks on the library usage.
yep, but the api() method is not friendly with the IDE, because the returned classes all have a different API. So the only thing the IDE can knwo about them is that them implement setPerPage($perPage) and getPerPage(), which is quite useless. Having dedicated methods would allow documenting the return type of each method properly
Activity
jbrooksuk commentedon Aug 21, 2014
Technically all the
apimethod is doing is just calling initialising a class. That's all the dedicated methods would have to do.stof commentedon Aug 21, 2014
yep, but the
api()method is not friendly with the IDE, because the returned classes all have a different API. So the only thing the IDE can knwo about them is that them implementsetPerPage($perPage)andgetPerPage(), which is quite useless. Having dedicated methods would allow documenting the return type of each method properlyjbrooksuk commentedon Aug 21, 2014
Yeah, I completely agree. Would the IDE be able to pick up the magic
__callmethod?jbrooksuk commentedon Aug 21, 2014
@stof not sure if you read my previous comment, but GitHub hid the second part of it.
stof commentedon Aug 21, 2014
@jbrooksuk if you document them properly with
@methodon the class, yesjbrooksuk commentedon Aug 21, 2014
That's probably a good way of doing it then, I'd say.
I don't use the
@methodblock, so I'm not sure how it works, but the actual code should.stof commentedon Aug 21, 2014
@methodgoes in the class phpdoc, not in the method phpdoc.and as shown in my sample, I would use a camelCased method name rather than underscores.
jbrooksuk commentedon Aug 21, 2014
Ah right, I see. That's easily doable. If I make a PR, will @knpEdgar merge?
Nek- commentedon Aug 21, 2014
I'm 👍 with it :) .
GrahamCampbell commentedon Aug 21, 2014
👍 for 1.3 or 2.0.
jbrooksuk commentedon Aug 21, 2014
Ok guys, I'll do it now 😄
stof commentedon Aug 21, 2014
given that adding this API (without removing
->api($type)) is BC, it can go in 1.3jbrooksuk commentedon Aug 21, 2014
This change seems too simple... Adding a PR now.
Merge pull request #180 from jbrooksuk/magic-api