-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Console] Review Application docblocks #20813
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
Conversation
I'm 👎 on these changes. In theory, I agree with them, but as it makes merging more complex, and makes diffs between version non-readable, I think leaving them as is is the best thing to do. For new phpdocs, we should stick with the new "rules". |
Of course, I understand and expected your comment 😅 . |
Fixes on current docblocks are indeed acceptable :) |
@@ -103,7 +101,8 @@ public function setDispatcher(EventDispatcherInterface $dispatcher) | |||
* | |||
* @return int 0 if everything went fine, or an error code | |||
* | |||
* @throws \Exception When doRun returns Exception | |||
* @throws \Exception When doRun threw an exception and catchExceptions is false | |||
* @throws \Throwable When doRun threw a throwable |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be merged with the previous line \Exception|\Throwable
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can be, but the aim was to point the fact all throwables are not caught by the application (yet), and thus not handled nicely, whereas as this can be configured for exceptions by setting catchExceptions
to true.
#20808 replicates this behavior for throwables by adding a new catchThrowables
property.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should be removed entirely actually. It does not make any sense to document that it throws an exception when the inner code threw an exception. PHP does not require each class to document exceptions thrown in called codes (unlike Java)
This looks wrong to me. We don't document "rethrowing" |
My opinion on this is that it matters only when it has value for the end user. |
So, I'm not trying to be stubborn here, but simply explaining my thoughts on this in order to get yours 😃 What should be done here now?
|
I would vote for 2 |
Done. Thanks for the answers. :) |
@@ -832,7 +830,7 @@ protected function configureIO(InputInterface $input, OutputInterface $output) | |||
* | |||
* @return int 0 if everything went fine, or an error code | |||
* | |||
* @throws \Exception when the command being run threw an exception | |||
* @throws \Throwable|\Exception when the command being run threw a throwable |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be removed too here, as this is also documenting a rethrowing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed. 👍
Thank you @ogizanagi. |
This PR was squashed before being merged into the 2.7 branch (closes #20813). Discussion ---------- [Console] Review Application docblocks | Q | A | ------------- | --- | Branch? | 2.7 | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | N/A | License | MIT | Doc PR | N/A ~I know there must be a lot of other places in the core where there is some repeated or useless informations in docblocks, but everytime I dig into the `Application` class, I see this, and I don't want to repeat things for consistency when adding new methods 😅 (for instance in #20808, the `setCatchThrowables / areThrowablesCaught ` methods do not need a docblock description IMHO).~ ~This PR adapts docblocks where:~ - ~A docblock description is not required, as everything can be expressed in the `@return / @param` argument (the case mentioned above)~ - ~Information is redundant between description and tags, and the context does not have to be reminded again:~ ```diff /** * Adds an array of command objects. * * If a Command is not enabled it will not be added. * - * @param Command[] $commands An array of commands + * @param Command[] $commands */ public function addCommands(array $commands) { foreach ($commands as $command) { $this->add($command); } } ``` Commits ------- d8c18cc [Console] Review Application docblocks
I know there must be a lot of other places in the core where there is some repeated or useless informations in docblocks, but everytime I dig into theApplication
class, I see this, and I don't want to repeat things for consistency when adding new methods 😅 (for instance in #20808, thesetCatchThrowables / areThrowablesCaught
methods do not need a docblock description IMHO).This PR adapts docblocks where:A docblock description is not required, as everything can be expressed in the@return / @param
argument (the case mentioned above)Information is redundant between description and tags, and the context does not have to be reminded again: