|
15 | 15 | use PHPStan\Type\BooleanType;
|
16 | 16 | use PHPStan\Type\Constant\ConstantArrayTypeBuilder;
|
17 | 17 | use PHPStan\Type\Constant\ConstantBooleanType;
|
| 18 | +use PHPStan\Type\Constant\ConstantFloatType; |
18 | 19 | use PHPStan\Type\Constant\ConstantIntegerType;
|
19 | 20 | use PHPStan\Type\Constant\ConstantStringType;
|
20 | 21 | use PHPStan\Type\ConstantTypeHelper;
|
@@ -1604,13 +1605,13 @@ public function getTestData(): iterable
|
1604 | 1605 |
|
1605 | 1606 | yield 'unary minus' => [
|
1606 | 1607 | $this->constantArray([
|
1607 |
| - [new ConstantStringType('minusInt'), $this->numericStringOrInt()], // should be nullable |
1608 |
| - [new ConstantStringType('minusFloat'), TypeCombinator::union(new FloatType(), $this->numericStringOrInt())], // should be nullable && should not include int |
| 1608 | + [new ConstantStringType('minusInt'), TypeCombinator::union(new ConstantIntegerType(-1), new ConstantStringType('-1'))], // should be nullable |
| 1609 | + [new ConstantStringType('minusFloat'), TypeCombinator::union(new ConstantFloatType(-0.1), new ConstantStringType('-0.1'))], // should be nullable |
1609 | 1610 | [new ConstantStringType('minusIntRange'), TypeCombinator::union(IntegerRangeType::fromInterval(null, 0), $this->numericString())],
|
1610 | 1611 | ]),
|
1611 | 1612 | '
|
1612 |
| - SELECT -o.intColumn as minusInt, |
1613 |
| - -o.floatColumn as minusFloat, |
| 1613 | + SELECT -1 as minusInt, |
| 1614 | + -0.1 as minusFloat, |
1614 | 1615 | -COUNT(o.intColumn) as minusIntRange
|
1615 | 1616 | FROM QueryResult\Entities\One o
|
1616 | 1617 | ',
|
|
0 commit comments