/** * @param string $name * @return BaseToken * @throws Exceptions\ParserException */ public function getVariable($name) { if (!array_key_exists($name, $this->variables)) { $token = $this->stack->current(); throw new Exceptions\ParserException(sprintf('Undefined variable "%s" at position %d on line %d', $name, $token->getPosition(), $token->getLine())); } return TokenFactory::createFromPHPType($this->variables[$name]); }
/** * @expectedException \Exception * @expectedExceptionMessage Unsupported PHP type: "object" */ public function testUnsupportedTypeThrowsException() { TokenFactory::createFromPHPType(new \StdClass()); }