Skip to content
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

[8.x] fix doc blocks #35675

Merged
merged 2 commits into from
Dec 21, 2020
Merged

[8.x] fix doc blocks #35675

merged 2 commits into from
Dec 21, 2020

Conversation

rodrigopedra
Copy link
Contributor

@rodrigopedra rodrigopedra commented Dec 19, 2020

Addresses errors for 8.x branch listed on #35673 .

EDIT: I also made some other fixes I found while assessing doctum error messages.

To clarify, I didn't run doctum myself. I based my code review on the error messages listed on #35673

@@ -114,12 +114,11 @@ public function bcc($users)
* Send a new mailable message instance.
*
* @param \Illuminate\Contracts\Mail\Mailable $mailable
*
* @return mixed
* @return void
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here I removed the extra blank line between parameters and return, and also changed the return to match the interface.

Mailer implementation send method does not return anything.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh okay, did Doctum say something about that ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, but when I was reviewing the others I found this. Neither doctum or StyleCI complained about this one.

I will update my opening comment to clarify I made other fixes.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

phpstan would have got it I think ;p

@@ -171,7 +171,7 @@ protected function shouldSendNotification($notifiable, $notification, $channel)
* Queue the given notification instances.
*
* @param mixed $notifiables
* @param array[\Illuminate\Notifications\Channels\Notification] $notification
* @param \Illuminate\Notifications\Notification $notification
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The implementation does not expects an array on this parameter

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @williamdes

Maybe this one you want to take a look on how doctum is handling, the error message was odd for this line:

ERROR: The "r" @param tag variable name is wrong (should be "notification") on "Illuminate\Notifications\NotificationSender::queueNotification" in build/doctum/laravel/src/Illuminate/Notifications/NotificationSender.php:177

As you can see the @param variable was not called r. Maybe it is because it used this odd syntax with brackets

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ha, thanks for pointing this out
I had some chance this time because you looked to the old errors report, please have a look to the "5.3.0-dev" one instead :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now I see, thanks for the heads up

@@ -347,7 +347,7 @@ public function send($view, array $data = [], $callback = null)
/**
* Queue a new e-mail message for sending.
*
* @param string|array $view
* @param \Illuminate\Contracts\Mail\Mailable|string|array $view
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed to match its interface

* @param \Illuminate\Contracts\Mail\Mailable $mailable;
* @return mixed
* @param \Illuminate\Contracts\Mail\Mailable $mailable
* @return void
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here I removed the extra semicolon, and also changed the return to match the interface.

Mailer implementation send method does not return anything.

@rodrigopedra
Copy link
Contributor Author

From the errors for the 8.x branch the only I left unaddressed was this:

ERROR: "0" @param tags are expected but only "1" found on "Illuminate\Http\Client\Response::throw" in build/doctum/laravel/src/Illuminate/Http/Client/Response.php:236

This was a feature added by commit d034e2c to allow a callback but avoid a breaking change on changing the method's signature.

Maybe the method signature could be changed for 9.x

@williamdes

This comment has been minimized.

@williamdes
Copy link
Contributor

Version 8.x
------------
  Parsing   done

ERROR: The method "cache" has "1" @param tags but only "0" where expected. on "\cache" in /mnt/Dev/@code-lts/@doctum-fork/laravel.com-next/build/doctum/laravel/src/Illuminate/Foundation/helpers.php:233
ERROR: The "args" parameter of the method "event" is missing a @param tag on "\event" in /mnt/Dev/@code-lts/@doctum-fork/laravel.com-next/build/doctum/laravel/src/Illuminate/Foundation/helpers.php:430
ERROR: The method "event" has "3" @param tags but only "1" where expected. on "\event" in /mnt/Dev/@code-lts/@doctum-fork/laravel.com-next/build/doctum/laravel/src/Illuminate/Foundation/helpers.php:430
ERROR: The method "throw" has "1" @param tags but only "0" where expected. on "Illuminate\Http\Client\Response::throw" in /mnt/Dev/@code-lts/@doctum-fork/laravel.com-next/build/doctum/laravel/src/Illuminate/Http/Client/Response.php:236

 988/988 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100% 16 secs
  Rendering                                             Rendering done

 1123/1123 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100% 23 secs


Here are the errors that are not fixed, thank you for your quick work on the other ones !

@williamdes
Copy link
Contributor

williamdes commented Dec 19, 2020

Seems to be a Doctum 5.3.0-dev bug from the source code, I see no reason to remove the phpdoc tag (from an external view)

Nonsense myself .. 😄

At

* @param \Closure|null $callback
it needs to be removed ^^


Seems like https://stackoverflow.com/questions/14513356/phpdoc-documenting-a-function-with-a-variable-number-of-arguments will be usefull for the event helper function

@rodrigopedra
Copy link
Contributor Author

Hi @williamdes , thanks for the quick review.

Besides the one for Response@throw, the additional errors weren't in the original #35673 .

I will wait for the maintainers to take a look on those first as to me it is tricky and could be a matter of opinion.

  • The Response@throw documents a supported feature added to avoid a BC
  • The cache helper one uses a @param dynamic syntax that is strange to me, but can be there for a reason
  • The event helper docblock matches the Illuminate\Contracts\Events\Dispatcher@dispatch docblock, therefore I think we could copy the method signature and delegate that. But if someone rebound the events string in the container to something else it could lead to a BC. So I will leave the decision to the maintainers for now.

@GrahamCampbell
Copy link
Member

We are not changing the mailer stuff yet. We marked it as void, however some people are still using the return value, and we have no good way of providing an alternative for their use case yet, so that's how we arrived having a void contract, but mixed in reality. The mailer component may be getting some refactoring in 9.x if we decide to switch to symfony mailer. The issue with the void-mixed stuff may be resolved properly, at that point.

@williamdes
Copy link
Contributor

Hi @GrahamCampbell
So to fix #35673 a PR with only phpdoc fixes is needed ?

@GrahamCampbell
Copy link
Member

The cache and validation fixes look good, though. Please submit a PR fixing that on 6.x (if the code exists on 6.x, otherwise 8.x is fine).

@williamdes
Copy link
Contributor

And for 5.x issues ?

@rodrigopedra
Copy link
Contributor Author

Hey @GrahamCampbell , thanks for your review

Wouldn't reverting the return for Illuminate\Mail\PendingMail@send make it good? The other fixes on the mailer docblocks are legitimate in my opinion (removing an extra semicolon and fixing setGlobalToAndRemoveCcAndBcc to conform with interface)

If you think so I just pushed a commit to revert the send return to my fork.

@williamdes
Copy link
Contributor

Hey @GrahamCampbell , thanks for your review

Wouldn't reverting the return for Illuminate\Mail\PendingMail@send make it good? The other fixes on the mailer docblocks are legitimate in my opinion (removing an extra semicolon and fixing setGlobalToAndRemoveCcAndBcc to conform with interface)

If you think so I just pushed a commit to revert the send return to my fork.

I think you can re-open a pull-request :)

@taylorotwell taylorotwell reopened this Dec 20, 2020
@taylorotwell
Copy link
Member

@rodrigopedra re-opened. Is this ready to go?

@GrahamCampbell
Copy link
Member

Some of these need fixing on the 6.x series, first.

@rodrigopedra
Copy link
Contributor Author

Hi @taylorotwell I just force-pushed again to force re-syncing the PR.

So now there are just docblock changes. No code changes. I think it is good to go.

Again, I left the Illuminate\Http\Client\Response@throw as it is now, inconsistent but documenting a supported dynamic parameter.

I also didn't change the cache and event helpers docblocks.

I think the event one could be changed, please refer to comment #35675 (comment) for more details.

I can send the needed fixes for 6.x too.

@rodrigopedra
Copy link
Contributor Author

If you want I can make the changes from comment #35675 (comment) before merging.

@williamdes
Copy link
Contributor

By the way I just want to say that the variadic is not well documented
Sorry for the spamming but it is important to say

Please refer to 20Tauri/DoxyDoxygen#135 (comment)

@taylorotwell taylorotwell merged commit d30dbeb into laravel:8.x Dec 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants