File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44
55use PHPStan \Analyser \Scope ;
66
7- /** @api */
7+ /**
8+ * @api
9+ *
10+ * This interface allows you to write custom logic that can dynamically decide
11+ * whether an exception is checked or unchecked type.
12+ *
13+ * Because the interface accepts a Scope, you can ask about the place in the code where
14+ * it's being decided - a file, a namespace or a class name.
15+ *
16+ * There can only be a single ExceptionTypeResolver per project, and you can register it
17+ * in your configuration file like this:
18+ *
19+ * ```
20+ * services:
21+ * exceptionTypeResolver!:
22+ * class: PHPStan\Rules\Exceptions\ExceptionTypeResolver
23+ * ```
24+ *
25+ * You can also take advantage of the `PHPStan\Rules\Exceptions\DefaultExceptionTypeResolver`
26+ * by injecting it into the constructor of your ExceptionTypeResolver
27+ * and delegate the logic of the classes and places you don't care about.
28+ *
29+ * DefaultExceptionTypeResolver decides the type of the exception based on configuration
30+ * parameters like `exceptions.uncheckedExceptionClasses` etc.
31+ *
32+ * Learn more: https://phpstan.org/blog/bring-your-exceptions-under-control
33+ */
834interface ExceptionTypeResolver
935{
1036
You can’t perform that action at this time.
0 commit comments