public static function createForUnparsableToken(Token $token, int $code = 0, \Throwable $previous = null) : ParseException { return new ParseException(sprintf('Could not parse the token "%s" (type: %s).', $token->getValue(), $token->getType()), $code, $previous); }
/** * Parses expressions such as '$username'. * * {@inheritdoc} * * @throws ParseException */ public function parse(Token $token) { try { return new VariableValue(substr($token->getValue(), 1)); } catch (\TypeError $error) { throw ExpressionLanguageExceptionFactory::createForUnparsableToken($token, 0, $error); } }