Completed
Pull Request — master (#10)
by
unknown
05:11
created
src/SubLexer/StringSubLexer.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -18,12 +18,12 @@
 block discarded – undo
18 18
         //if it did match a string, ensure that the same string would not match a number
19 19
         $num_token = (new NumberSubLexer())->getTokenAt($code, $cursor);
20 20
         //if we could just as well find a number here
21
-        if($num_token instanceof Token)
21
+        if ($num_token instanceof Token)
22 22
         {
23 23
             $str_len = ($cursor + strlen($matches[0])) - $cursor;
24 24
             $num_len = $num_token->getEnd() - $num_token->getStart();
25 25
             // finding '2017' in '2017-01-01' is not good enough
26
-            if($num_len >= $str_len)
26
+            if ($num_len >= $str_len)
27 27
                 return $num_token;
28 28
         }
29 29
 
Please login to merge, or discard this patch.
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -12,8 +12,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
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(
Please login to merge, or discard this patch.