Utils: fixed parseDocComment() ignoring tags containing hyphens

This commit is contained in:
Dylan K. Taylor
2021-11-24 16:38:37 +00:00
parent 5c7125f190
commit b784a04e08
2 changed files with 7 additions and 1 deletions

View File

@ -90,6 +90,12 @@ class UtilsTest extends TestCase{
self::assertCount(0, $tags);
}
public function testParseDocCommentWithTagsContainingHyphens() : void{
$tags = Utils::parseDocComment("/** @phpstan-return list<string> */");
self::assertArrayHasKey("phpstan-return", $tags);
self::assertEquals("list<string>", $tags["phpstan-return"]);
}
public function testNamespacedNiceClosureName() : void{
//be careful with this test. The closure has to be declared on the same line as the assertion.
self::assertSame('closure@' . Filesystem::cleanPath(__FILE__) . '#L' . __LINE__, Utils::getNiceClosureName(function() : void{}));