Skip to content

Commit 40ae315

Browse files
janedbalondrejmirtes
authored andcommitted
Fix unary minus test
1 parent 012cf14 commit 40ae315

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

tests/Type/Doctrine/Query/QueryResultTypeWalkerTest.php

+5-4
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
use PHPStan\Type\BooleanType;
1616
use PHPStan\Type\Constant\ConstantArrayTypeBuilder;
1717
use PHPStan\Type\Constant\ConstantBooleanType;
18+
use PHPStan\Type\Constant\ConstantFloatType;
1819
use PHPStan\Type\Constant\ConstantIntegerType;
1920
use PHPStan\Type\Constant\ConstantStringType;
2021
use PHPStan\Type\ConstantTypeHelper;
@@ -1604,13 +1605,13 @@ public function getTestData(): iterable
16041605

16051606
yield 'unary minus' => [
16061607
$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
16091610
[new ConstantStringType('minusIntRange'), TypeCombinator::union(IntegerRangeType::fromInterval(null, 0), $this->numericString())],
16101611
]),
16111612
'
1612-
SELECT -o.intColumn as minusInt,
1613-
-o.floatColumn as minusFloat,
1613+
SELECT -1 as minusInt,
1614+
-0.1 as minusFloat,
16141615
-COUNT(o.intColumn) as minusIntRange
16151616
FROM QueryResult\Entities\One o
16161617
',

0 commit comments

Comments
 (0)