Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Fix @throws DocBlock about LogicException #29699

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

Closed

Conversation

gido
Copy link
Contributor

@gido gido commented Dec 27, 2018

Q A
Branch? master
Bug fix? no
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets #...
License MIT
Doc PR symfony/symfony-docs#...

This is a follow-up of #28536. \RuntimeException were replaced by \LogicException but the DocBlock documentation wasn't updated accordingly.

When working on it, I found some inconsistency: In some component the exception raised is from the SPL (\LogicException) and in other the exception is from the component itself (when the LogicException exist). What is the policy in this case ?

@ogizanagi
Copy link
Contributor

Well, logic exceptions aren't even supposed to be documented actually. It makes no sense as it represents a broken code path (either a misconfiguration or developer mistake) and should never be caught.
When it occurs, the exception message should be explicit enough. I'm not sure documenting it in the docblock is of any interest.

/**
* Create a new Transport Serializer.
*
* @return self
Copy link
Member

Choose a reason for hiding this comment

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

We tend to avoid adding docs that do not add any additional information (here everything is in the method signature). The same goes for the description above.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Make sense, done.

@chalasr
Copy link
Member

chalasr commented Dec 29, 2018

I agree with @ogizanagi, such exceptions are thrown to provide a meaningful error instead of a fatal one (class not found). Documenting them would not bring any value. 👎 for me

@fabpot
Copy link
Member

fabpot commented Jan 1, 2019

Closing as 2 member of the core voted against this PR.

@fabpot fabpot closed this Jan 1, 2019
@gido
Copy link
Contributor Author

gido commented Jan 1, 2019

I understand the point about non documenting LogicException in this case.

But the current DocBlock is still wrong (mentions of RuntimeException). Would you accept a PR that remove them?

@fabpot
Copy link
Member

fabpot commented Jan 1, 2019

Yes, removing docblocks is always great!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants