@@ -12,8 +12,9 @@ discard block |
||
| 12 | 12 | public function getTokenAt($code, $cursor) |
| 13 | 13 | { |
| 14 | 14 | //if it doesn't match a string, return null |
| 15 | - if (!preg_match('/([a-z0-9_.]|\%[0-9a-f]{2})+/Ai', $code, $matches, null, $cursor)) |
|
| 16 | - return null; |
|
| 15 | + if (!preg_match('/([a-z0-9_.]|\%[0-9a-f]{2})+/Ai', $code, $matches, null, $cursor)) { |
|
| 16 | + return null; |
|
| 17 | + } |
|
| 17 | 18 | |
| 18 | 19 | //if it did match a string, ensure that the same string would not match a number |
| 19 | 20 | $num_token = (new NumberSubLexer())->getTokenAt($code, $cursor); |
@@ -23,8 +24,9 @@ discard block |
||
| 23 | 24 | $str_len = ($cursor + strlen($matches[0])) - $cursor; |
| 24 | 25 | $num_len = $num_token->getEnd() - $num_token->getStart(); |
| 25 | 26 | // finding '2017' in '2017-01-01' is not good enough |
| 26 | - if($num_len >= $str_len) |
|
| 27 | - return $num_token; |
|
| 27 | + if($num_len >= $str_len) { |
|
| 28 | + return $num_token; |
|
| 29 | + } |
|
| 28 | 30 | } |
| 29 | 31 | |
| 30 | 32 | return new Token( |