| 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 arithmetic 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.operatorTypeSpecifyingExtension` service tag: |
| 11: | * |
| 12: | * ``` |
| 13: | * services: |
| 14: | * - |
| 15: | * class: App\PHPStan\MyExtension |
| 16: | * tags: |
| 17: | * - phpstan.broker.operatorTypeSpecifyingExtension |
| 18: | * ``` |
| 19: | * |
| 20: | * Learn more: https://github.com/phpstan/phpstan/pull/2114 |
| 21: | * |
| 22: | * @api |
| 23: | */ |
| 24: | interface OperatorTypeSpecifyingExtension |
| 25: | { |
| 26: | |
| 27: | public function isOperatorSupported(string $operatorSigil, Type $leftSide, Type $rightSide): bool; |
| 28: | |
| 29: | public function specifyType(string $operatorSigil, Type $leftSide, Type $rightSide): Type; |
| 30: | |
| 31: | } |
| 32: |