| 1: | <?php declare(strict_types = 1); |
| 2: | |
| 3: | namespace PHPStan\Type; |
| 4: | |
| 5: | use PHPStan\Turbo\ReferencedByTurboExtension; |
| 6: | |
| 7: | /** |
| 8: | * A type whose value is known at analysis time — a compile-time constant scalar. |
| 9: | * |
| 10: | * Implemented by ConstantIntegerType, ConstantFloatType, ConstantStringType, |
| 11: | * ConstantBooleanType, and NullType. |
| 12: | * |
| 13: | * Use Type::isConstantValue() to check if a type is constant without instanceof, |
| 14: | * and Type::getConstantScalarTypes() to extract constant types from unions. |
| 15: | * |
| 16: | * @api |
| 17: | */ |
| 18: | #[InstanceofDeprecated(insteadUse: 'Type::isConstantScalarValue() or Type::getConstantScalarTypes() or Type::getConstantScalarValues()')] |
| 19: | #[ReferencedByTurboExtension(key: 'constantScalarType')] |
| 20: | interface ConstantScalarType extends Type |
| 21: | { |
| 22: | |
| 23: | /** @return int|float|string|bool|null */ |
| 24: | public function getValue(); |
| 25: | |
| 26: | } |
| 27: |