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

Improve implicit throws documentation #9887

Open
wants to merge 4 commits into
base: 1.11.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion website/src/_posts/bring-your-exceptions-under-control.md
Expand Up @@ -118,7 +118,7 @@ PHPStan needs to be careful with interpreting of the existing code. No tool unti

The first option is safer so that's what PHPStan does by default. In this mode you can write `@throws void` to mark a function that definitely doesn't throw an exception.

To flip the switch and always interpret the absent `@throws` as no exception being thrown, turn `exceptions.implicitThrows` off in your configuration:
However, if another function call in the same scope declares `@throws` with an exception class, PHPStan will instead interpret the absent `@throws` as no exception being thrown. To flip the switch and always enable this mode, turn `exceptions.implicitThrows` off in your configuration:

```neon
parameters:
Expand Down
2 changes: 1 addition & 1 deletion website/src/_posts/precise-try-catch-finally-analysis.md
Expand Up @@ -57,7 +57,7 @@ try {

By default, functions without any `@throws` annotation are considered to throw any exception, so all existing code will be interpreted very closely to the previous behavior.

But once you start adding `@throws` to your functions and methods, they will take priority over the ones with only implicit `@throws`. As you add more `@throws` annotations, you get rewarded with more precise analysis!
But once you start adding `@throws` to your functions and methods, they will override the ones with only implicit `@throws`. As you add more `@throws` annotations, you get rewarded with more precise analysis!

There will be more exception-related features in the near future, stay tuned!

Expand Down