[ExpressionLanguage] Avoid dependency on ctype

This avoids ExpressionLanguage library dependency on ctype.
This commit is contained in:
Michal Čihař 2017-04-07 07:35:24 +02:00 committed by Fabien Potencier
parent d48fae7f8c
commit 81de5fef4b
1 changed files with 1 additions and 1 deletions

View File

@ -45,7 +45,7 @@ class Lexer
if (preg_match('/[0-9]+(?:\.[0-9]+)?/A', $expression, $match, null, $cursor)) {
// numbers
$number = (float) $match[0]; // floats
if (ctype_digit($match[0]) && $number <= PHP_INT_MAX) {
if (preg_match('/^[0-9]+$/', $match[0]) && $number <= PHP_INT_MAX) {
$number = (int) $match[0]; // integers lower than the maximum
}
$tokens[] = new Token(Token::NUMBER_TYPE, $number, $cursor + 1);