| 1: | <?php declare(strict_types = 1); |
| 2: | |
| 3: | namespace PHPStan\Type; |
| 4: | |
| 5: | /** |
| 6: | * This is the extension interface to implement if you want to describe |
| 7: | * how unary operators like -, +, ~ should infer types |
| 8: | * for PHP extensions that overload the behaviour, like GMP. |
| 9: | * |
| 10: | * To register it in the configuration file use the `phpstan.broker.unaryOperatorTypeSpecifyingExtension` service tag: |
| 11: | * |
| 12: | * ``` |
| 13: | * services: |
| 14: | * - |
| 15: | * class: App\PHPStan\MyExtension |
| 16: | * tags: |
| 17: | * - phpstan.broker.unaryOperatorTypeSpecifyingExtension |
| 18: | * ``` |
| 19: | * |
| 20: | * @api |
| 21: | */ |
| 22: | interface UnaryOperatorTypeSpecifyingExtension |
| 23: | { |
| 24: | |
| 25: | public function isOperatorSupported(string $operatorSigil, Type $operand): bool; |
| 26: | |
| 27: | public function specifyType(string $operatorSigil, Type $operand): Type; |
| 28: | |
| 29: | } |
| 30: |