Skip to content

docs: remove unneeded @throws in CodeIgniter #7540

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

Merged
merged 2 commits into from
Jun 15, 2023

Conversation

kenjis
Copy link
Member

@kenjis kenjis commented Jun 4, 2023

Description
Closes #7434
See #7434 (comment)

Checklist:

  • Securely signed commits
  • [] Component(s) with PHPDoc blocks, only if necessary or adds value
  • [] Unit testing, with >80% coverage
  • [] User guide updated
  • Conforms to style guide

@@ -310,8 +310,6 @@ private function configureKint(): void
* makes all of the pieces work together.
*
* @return ResponseInterface|void
*
* @throws RedirectException
Copy link
Member

Choose a reason for hiding this comment

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

since the method has LogicException throw, how about change to @throws LogicException ?

Copy link
Member Author

Choose a reason for hiding this comment

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

I think we should write Exceptions in @throws which should be caught in the client code.
LogicException should not be caught.

Copy link
Member

Choose a reason for hiding this comment

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

I think adding @throws doesn't mean it have to be caught in client code. It's a way of explicitly telling that calling the function may throw this exception.

Copy link
Member Author

Choose a reason for hiding this comment

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

@paulbalandan Do you think we should write all Exceptions that may be thrown?

Copy link
Member

Choose a reason for hiding this comment

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

Not really all. Only those that are meant to be checked by the framework and/or user. Please read this PHPStan article for details.

Copy link
Member Author

@kenjis kenjis Jun 4, 2023

Choose a reason for hiding this comment

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

I read the article.
I think checked exceptions should be caught. So we should write only checked exceptions in @throws.
Something wrong with my understanding?

@iRedds
Copy link
Collaborator

iRedds commented Jun 6, 2023

You forgot to fix \CodeIgniter\Test\FeatureTestTrait and \CodeIgniter\Test\FeatureTestCase.

@kenjis kenjis force-pushed the docs-remove-throws branch from 2d7ba06 to 0012fe3 Compare June 8, 2023 01:40
@kenjis
Copy link
Member Author

kenjis commented Jun 8, 2023

@iRedds Thanks. Removed.

@kenjis kenjis merged commit 712ddbf into codeigniter4:develop Jun 15, 2023
@kenjis kenjis deleted the docs-remove-throws branch June 15, 2023 07:52
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.

Bug: PhpStorm warnings in public/index.php
4 participants