1: <?php declare(strict_types = 1);
2:
3: namespace PHPStan\Type;
4:
5: use PHPStan\Broker\BrokerFactory;
6: use PHPStan\DependencyInjection\ExtensionInterface;
7:
8: /**
9: * This is the extension interface to implement if you want to describe
10: * how arithmetic operators like +, -, *, ^, / should infer types
11: * for PHP extensions that overload the behaviour, like GMP.
12: *
13: * To register it in the configuration file use the `phpstan.broker.operatorTypeSpecifyingExtension` service tag:
14: *
15: * ```
16: * services:
17: * -
18: * class: App\PHPStan\MyExtension
19: * tags:
20: * - phpstan.broker.operatorTypeSpecifyingExtension
21: * ```
22: *
23: * Learn more: https://github.com/phpstan/phpstan/pull/2114
24: *
25: * @api
26: */
27: #[ExtensionInterface(tag: BrokerFactory::OPERATOR_TYPE_SPECIFYING_EXTENSION_TAG)]
28: interface OperatorTypeSpecifyingExtension
29: {
30:
31: public function isOperatorSupported(string $operatorSigil, Type $leftSide, Type $rightSide): bool;
32:
33: public function specifyType(string $operatorSigil, Type $leftSide, Type $rightSide): Type;
34:
35: }
36: