Small improve

This commit is contained in:
bzick 2015-01-07 17:00:54 +03:00
parent 22fb471c89
commit 8d6bfb00d1
2 changed files with 3 additions and 4 deletions

View File

@ -261,9 +261,6 @@ class Compiler
$p = $scope->tpl->parseParams($tokens, $p);
if (is_numeric($p["step"])) {
if($p['to'] === false) {
throw new InvalidArgumentException("Invalid value for parameter 'to'");
}
if ($p["step"] > 0) {
$condition = "$var <= {$p['to']}";
if ($p["last"]) {

View File

@ -1467,11 +1467,13 @@ class Template extends Render
if ($tokens->is(Tokenizer::MACRO_STRING)) {
$key = $tokens->getAndNext();
if ($defaults && !isset($defaults[$key])) {
throw new \Exception("Unknown parameter '$key'");
throw new InvalidUsageException("Unknown parameter '$key'");
}
if ($tokens->is("=")) {
$tokens->next();
$params[$key] = $this->parseExpr($tokens);
} else {
throw new InvalidUsageException("Invalid value for parameter '$key' ");
}
} elseif ($tokens->is(Tokenizer::MACRO_SCALAR, '"', T_VARIABLE, "[", '(')) {
$params[] = $this->parseExpr($tokens);