mirror of
https://github.com/danog/psalm.git
synced 2024-11-26 20:34:47 +01:00
Fix
This commit is contained in:
parent
68f3f246f5
commit
6ce32a48d5
@ -697,8 +697,13 @@ abstract class Type
|
||||
TIntRange::convertToIntRange($type_1_atomic),
|
||||
TIntRange::convertToIntRange($type_2_atomic)
|
||||
);
|
||||
if ($intersection_atomic) {
|
||||
if ($intersection_atomic
|
||||
&& ($intersection_atomic->min_bound !== null || $intersection_atomic->max_bound !== null)
|
||||
) {
|
||||
$intersection_performed = true;
|
||||
if ($intersection_atomic->min_bound === $intersection_atomic->max_bound) {
|
||||
return new TLiteralInt($intersection_atomic->min_bound);
|
||||
}
|
||||
return $intersection_atomic;
|
||||
}
|
||||
}
|
||||
|
@ -213,6 +213,13 @@ class TypeParseTest extends TestCase
|
||||
$this->assertSame('array{a: int}', (string) Type::parseString('array{a: int}&array{a?: int}'));
|
||||
}
|
||||
|
||||
|
||||
public function testIntersectionOfIntranges(): void
|
||||
{
|
||||
$this->assertSame('array{a: int<3, 4>}', (string) Type::parseString('array{a: int<2, 4>}&array{a: int<3, 6>}'));
|
||||
$this->assertSame('array{a: 4}', Type::parseString('array{a: 4}&array{a: int<3, 6>}')->getId(true));
|
||||
}
|
||||
|
||||
public function testIntersectionOfTKeyedArrayWithConflictingProperties(): void
|
||||
{
|
||||
$this->expectException(TypeParseTreeException::class);
|
||||
|
Loading…
Reference in New Issue
Block a user