IsraelOrtuno / pipedrive

Complete Pipedrive API client for PHP
MIT License
166 stars 58 forks source link

Better/strict typehinting? #48

Closed JanMikes closed 6 years ago

JanMikes commented 6 years ago

Hello there!

I just started using this library - everything works as expected, thought i have a bit pain with typehinting methods, so my IDE understands return types, like this:

screenshot 2018-09-25 17 23 45

As you can see from screenshot, it is not good programmer experience in code like that.

Is there any chance, this will get improved?

JanMikes commented 6 years ago

One more hint, using magic methods like this makes package almost impossible to test with static analysis, etc phpstan - http://github.com/phpstan/phpstan which can prevent many bugs in code

IsraelOrtuno commented 6 years ago

I understand what you say, but tried to use DRY pattern in order to simplify the development and maintenance... Would be open to merge a PR with all resources with their methods tho..

JanMikes commented 6 years ago

Hi @IsraelOrtuno and what about adding @method annotations? like this:

/**
 * @method Activities activities()
 * @method ActivityFields activityFields()
 *  ..... and more
 */
class Pipedrive

It will allow IDE to autocomplete and better understand the code:

screenshot 2018-09-25 21 08 04

Mind if i prepare PR like this? 😉

JanMikes commented 6 years ago

Will be very happy for merging and tagging a version for composer 🌹