Commit e7ab4f7 1 parent 03c26f2 commit e7ab4f7 Copy full SHA for e7ab4f7
File tree 1 file changed +27
-1
lines changed
1 file changed +27
-1
lines changed Original file line number Diff line number Diff line change 4
4
5
5
use PHPStan \Analyser \Scope ;
6
6
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
+ */
8
34
interface ExceptionTypeResolver
9
35
{
10
36
You can’t perform that action at this time.
0 commit comments