1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-26 20:34:47 +01:00

Fix #3529 - static intersected with itself is static

This commit is contained in:
Matthew Brown 2020-06-06 20:10:50 -04:00
parent ce445636e7
commit 3d7288afcb
2 changed files with 12 additions and 0 deletions

View File

@ -492,6 +492,10 @@ class TypeParser
$intersect_static = true;
}
if (!$keyed_intersection_types && $intersect_static) {
return new TNamedObject('static');
}
$first_type = array_shift($keyed_intersection_types);
if ($intersect_static

View File

@ -189,6 +189,14 @@ class TypeParseTest extends TestCase
$this->assertSame('Iterator<mixed, int>&Traversable', (string) Type::parseString('Iterator<int>&Traversable'));
}
/**
* @return void
*/
public function testStaticAndStatic()
{
$this->assertSame('static', (string) Type::parseString('static&static'));
}
/**
* @return void
*/