1
0
mirror of https://github.com/danog/psalm.git synced 2025-01-22 05:41:20 +01:00

Fix #974 - fix handling of brackets

This commit is contained in:
Matthew Brown 2018-09-05 22:36:32 -04:00
parent 84459286ac
commit e6d1a44a59
2 changed files with 14 additions and 0 deletions

View File

@ -406,6 +406,10 @@ abstract class Type
);
}
if ($parse_tree instanceof ParseTree\MethodTree) {
throw new TypeParseTreeException('Misplaced brackets');
}
if (!$parse_tree instanceof ParseTree\Value) {
throw new \InvalidArgumentException('Unrecognised parse tree type ' . get_class($parse_tree));
}

View File

@ -489,6 +489,16 @@ class TypeParseTest extends TestCase
Type::parseString(':array');
}
/**
* @expectedException \Psalm\Exception\TypeParseTreeException
*
* @return void
*/
public function testBadBrackets()
{
Type::parseString('max(a)');
}
/**
* @expectedException \Psalm\Exception\TypeParseTreeException
*