From 11b86893f7bcb838778d23711317cf6e256890da Mon Sep 17 00:00:00 2001 From: Paulo Roberto Ribeiro Date: Thu, 1 Dec 2011 20:18:58 -0200 Subject: [PATCH] Refactoring: using && instead of nested if's --- lib/Twig/Lexer.php | 6 ++---- 1 files changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/Twig/Lexer.php b/lib/Twig/Lexer.php index 007e7a1..371868b 100644 --- a/lib/Twig/Lexer.php +++ b/lib/Twig/Lexer.php @@ -222,10 +222,8 @@ class Twig_Lexer implements Twig_LexerInterface // numbers elseif (preg_match(self::REGEX_NUMBER, $this->code, $match, null, $this->cursor)) { $number = (float) $match[0]; // floats - if (ctype_digit($match[0])) { - if ($number <= PHP_INT_MAX) { - $number = (int) $match[0]; // integers lower than the maximum - } + if (ctype_digit($match[0]) && $number <= PHP_INT_MAX) { + $number = (int) $match[0]; // integers lower than the maximum } $this->pushToken(Twig_Token::NUMBER_TYPE, $number); $this->moveCursor($match[0]); -- 1.7.2.5