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:
parent
84459286ac
commit
e6d1a44a59
@ -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));
|
||||
}
|
||||
|
@ -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
|
||||
*
|
||||
|
Loading…
x
Reference in New Issue
Block a user