1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-30 04:39:00 +01:00

Fix #983 - allow more than two types to be intersected

This commit is contained in:
Matt Brown 2018-09-07 11:09:07 -04:00
parent 4d676afaef
commit bafd3cde1f
2 changed files with 10 additions and 1 deletions

View File

@ -396,6 +396,7 @@ class ParseTree
}
if ($current_parent && $current_parent instanceof ParseTree\IntersectionTree) {
$current_leaf = $current_parent;
break;
}

View File

@ -132,7 +132,7 @@ class TypeParseTest extends TestCase
*/
public function testIntersection()
{
$this->assertSame('I1&I2', (string) Type::parseString('I1&I2'));
$this->assertSame('I1&I2&I3', (string) Type::parseString('I1&I2&I3'));
}
/**
@ -170,6 +170,14 @@ class TypeParseTest extends TestCase
);
}
/**
* @return void
*/
public function testIntersectionAfterGeneric()
{
$this->assertSame('Countable&iterable<int>&I', (string) Type::parseString('Countable&iterable<int>&I'));
}
/**
* @return void
*/