/** * @covers \Weasel\Annotation\DocblockLexer::peek * @expectedException \InvalidArgumentException */ public function testBadPeek() { $testIn = '@ 1 \\ true "foo" bar'; $lexer = new DocblockLexer($testIn); $lexer->peek(-1); }
protected function _ParamValue(DocblockLexer $lexer, $location, $namespaces) { $next = $lexer->peek(1, true); if ($next === DocblockLexer::T_IDENTIFIER) { // Might be an enum then... $enum = $this->_Enum($lexer, $location, $namespaces); return $enum; } $cur = $lexer->next(true); switch ($cur['type']) { case DocblockLexer::T_INTEGER: $param = array('integer', $cur['token']); break; case DocblockLexer::T_FLOAT: $param = array('float', $cur['token']); break; case DocblockLexer::T_BOOLEAN: $param = array('boolean', $cur['token']); break; case DocblockLexer::T_QUOTED_STRING: $param = array('string', $cur['token']); break; case DocblockLexer::T_AT: $object = $this->_Annotation($lexer, $location, $namespaces); return $object; break; case DocblockLexer::T_OPEN_BRACE: $array = $this->_Array($lexer, $location, $namespaces); return array('array', $array); default: throw new \Exception("Parse error got {$cur["type"]} ({$cur['token']})"); } return $param; }