Skip to content

Commit

Permalink
Rich PHPDoc for ExceptionTypeResolver
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrejmirtes committed Nov 8, 2023
1 parent 03c26f2 commit e7ab4f7
Showing 1 changed file with 27 additions and 1 deletion.
28 changes: 27 additions & 1 deletion src/Rules/Exceptions/ExceptionTypeResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,33 @@

use PHPStan\Analyser\Scope;

/** @api */
/**
* @api
*
* This interface allows you to write custom logic that can dynamically decide
* whether an exception is checked or unchecked type.
*
* Because the interface accepts a Scope, you can ask about the place in the code where
* it's being decided - a file, a namespace or a class name.
*
* There can only be a single ExceptionTypeResolver per project, and you can register it
* in your configuration file like this:
*
* ```
* services:
* exceptionTypeResolver!:
* class: PHPStan\Rules\Exceptions\ExceptionTypeResolver
* ```
*
* You can also take advantage of the `PHPStan\Rules\Exceptions\DefaultExceptionTypeResolver`
* by injecting it into the constructor of your ExceptionTypeResolver
* and delegate the logic of the classes and places you don't care about.
*
* DefaultExceptionTypeResolver decides the type of the exception based on configuration
* parameters like `exceptions.uncheckedExceptionClasses` etc.
*
* Learn more: https://phpstan.org/blog/bring-your-exceptions-under-control
*/
interface ExceptionTypeResolver
{

Expand Down

0 comments on commit e7ab4f7

Please sign in to comment.