arendjantetteroo / guzzle-toggl

A Toggl API client based on guzzle
MIT License
88 stars 42 forks source link

Declared autocomplete feature is missing! #24

Closed webarchitect609 closed 5 years ago

webarchitect609 commented 6 years ago

Your README.md says:

Invoke Commands using our __call method (auto-complete phpDocs are included)

But where are they? PhpStorm thinks there are missing methods: http://joxi.ru/brR68KFJZgbVr1?d=1 The only place I've found where I can see method names are two files describing services:

But it's not easy to find something any time I want to call new method.

arendjantetteroo commented 6 years ago

@webarchitect609 i'm afraid the upgrade to guzzle6 has broken these auto complete functionality. This was working in the previous guzzle setup. I'm not sure this is easily done again on guzzle6.

webarchitect609 commented 6 years ago

i'm afraid the upgrade to guzzle6 has broken these auto complete functionality.

No. It's simply never been there! Even at the very first release v0.6 from 2013-04-17 all endpoints are declared in json files according to use them for Guzzle\Service\Client. But IDE will never understand that magic _call method will use a json file to implement lots of methods.

So basicly there are two ways: use it as is and look to json before writing method call. Or add phpdoc blocks to \AJT\Toggl\TogglClient class to help IDE understand it has more methods.

phpdoc blocks should looks similar to this:

/**
 * @method ResponseInterface get(string|UriInterface $uri, array $options = [])
 * @method ResponseInterface head(string|UriInterface $uri, array $options = [])
 * @method ResponseInterface put(string|UriInterface $uri, array $options = [])
 * @method ResponseInterface post(string|UriInterface $uri, array $options = [])
 * @method ResponseInterface patch(string|UriInterface $uri, array $options = [])
 * @method ResponseInterface delete(string|UriInterface $uri, array $options = [])
 * @method Promise\PromiseInterface getAsync(string|UriInterface $uri, array $options = [])
 * @method Promise\PromiseInterface headAsync(string|UriInterface $uri, array $options = [])
 * @method Promise\PromiseInterface putAsync(string|UriInterface $uri, array $options = [])
 * @method Promise\PromiseInterface postAsync(string|UriInterface $uri, array $options = [])
 * @method Promise\PromiseInterface patchAsync(string|UriInterface $uri, array $options = [])
 * @method Promise\PromiseInterface deleteAsync(string|UriInterface $uri, array $options = [])
 */

But it will be very hard to make them manually. I'm not sure how to do it better but I'm thinking about some kind of feature for guzzlehttp/guzzle-services package that could make such phpdocs from json service description. Maybe one day I would write it :) Now I'm busy with another challenging activity.

Sorry for disturbing. There is nothing more to say and you could close this issue.