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 unary 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.unaryOperatorTypeSpecifyingExtension` service tag:
14: *
15: * ```
16: * services:
17: * -
18: * class: App\PHPStan\MyExtension
19: * tags:
20: * - phpstan.broker.unaryOperatorTypeSpecifyingExtension
21: * ```
22: *
23: * @api
24: */
25: #[ExtensionInterface(tag: BrokerFactory::UNARY_OPERATOR_TYPE_SPECIFYING_EXTENSION_TAG)]
26: interface UnaryOperatorTypeSpecifyingExtension
27: {
28:
29: public function isOperatorSupported(string $operatorSigil, Type $operand): bool;
30:
31: public function specifyType(string $operatorSigil, Type $operand): Type;
32:
33: }
34: