-
Notifications
You must be signed in to change notification settings - Fork 208
PhpDocs update #127
base: dev
Are you sure you want to change the base?
PhpDocs update #127
Conversation
Hello! Can anybody check this PR and merge or send feedback? |
Hi! I've started to write a review, I will try to finish it tonight. |
Many thanks! There is no hurry. I just wanted to know, if i need to wait little bit more or this PR will be buried in sands of time :) |
To make review simpler, here is the list of files i have changed:
After that i run docs generator cli command to update automatically generated phpDocs. |
I'm glad it helps you! |
@nesk Ive reverted Traits changes. Also i've done some stuff:
Will wait for your approval and merge ;) |
IDE autocompletion issuesI have downloaded PHPStorm and tried to setup everything, I must agree: it doesn't work well. 😅 However, you can clearly see with this PHPStan demo what it brings to have those annotations, they really help. I'm don't want to give up on them, but I have some ideas to fix the current issues. Here are some interesting points:
The good news:
By using the three documentation formats here, we could achieve perfect support everywhere. Callback documentationYou are right, the current typings for the callbacks aren't the good ones, because PuPHPeteer expects you to use a - * @method mixed download(string $revision, callable(float $x, float $y): void $progressCallback = null)
+ * @method mixed download(string $revision, \Nesk\Rialto\Data\JsFunction $progressCallback = null) This is correct, however we lose the detailed typings. I think we can fix this by doing this: - * @method mixed download(string $revision, callable(float $x, float $y): void $progressCallback = null)
+ * @method mixed download(string $revision, (callable(float, float): void)|JsFunction $progressCallback = null) This works perfectly and can still help users to see the detailed typings, here's an example. Additionally, I could add in Rialto a trigger to warn users about the fact they are using a FQCN references
I've tought about it, I see no difference on your side (as a user) if I use FQCN refs or relative ones. As the maintainer of the project, I would rather keep the FQCN references since I find them more reliable. PHPStorm makes no difference between relative or FQCN references, it always displays the FQCN one: To concludeI see immediate benefits in some of your changes:
If you want, you can make a new PR with only the last two changes in this list and I will merge it right away. 🙂 About everything else, there is still work to do:
If you don't have time anymore to work on these, I can take over. However, I may not have time to work on this soon so you will have to deal with the current typings for a while. |
Good idea to use
Union is ok, i will do that.
Ok. Will return full namespace Thanks for nice ideas, will implement them in upcoming days. |
@nesk Hi! Want to remind about my pull request :) |
Hi! PhpStorm got update with generics support in PHPDocs. Maybe this will help to cleanup this PR. |
Checked in new PhpStorm and there is still no support for array shape for argement types in |
Arrow functions fix & #private tags
Tested in PHPStorm.
P.S. Docs generation from js code is awesome yet simple to read!