| @@ -177,18 +177,18 @@ | ||
| 177 | 177 | |
| 178 | 178 | case (0x07FF & $bytes) == $bytes: | 
| 179 | 179 | return chr(0xc0 | ($bytes >> 6)) | 
| 180 | - . chr(0x80 | ($bytes & 0x3F)); | |
| 180 | + . chr(0x80 | ($bytes & 0x3F)); | |
| 181 | 181 | |
| 182 | 182 | case (0xFFFF & $bytes) == $bytes: | 
| 183 | 183 | return chr(0xe0 | ($bytes >> 12)) | 
| 184 | - . chr(0x80 | (($bytes >> 6) & 0x3F)) | |
| 185 | - . chr(0x80 | ($bytes & 0x3F)); | |
| 184 | + . chr(0x80 | (($bytes >> 6) & 0x3F)) | |
| 185 | + . chr(0x80 | ($bytes & 0x3F)); | |
| 186 | 186 | |
| 187 | 187 | default: | 
| 188 | 188 | return chr(0xF0 | ($bytes >> 18)) | 
| 189 | - . chr(0x80 | (($bytes >> 12) & 0x3F)) | |
| 190 | - . chr(0x80 | (($bytes >> 6) & 0x3F)) | |
| 191 | - . chr(0x80 | ($bytes & 0x3F)); | |
| 189 | + . chr(0x80 | (($bytes >> 12) & 0x3F)) | |
| 190 | + . chr(0x80 | (($bytes >> 6) & 0x3F)) | |
| 191 | + . chr(0x80 | ($bytes & 0x3F)); | |
| 192 | 192 | } | 
| 193 | 193 | } | 
| 194 | 194 | } | 
| @@ -15,7 +15,7 @@ discard block | ||
| 15 | 15 | |
| 16 | 16 | class Lexer extends AbstractLexer | 
| 17 | 17 |  { | 
| 18 | - const STATE_INITIAL = 0; | |
| 18 | + const STATE_INITIAL = 0; | |
| 19 | 19 | const STATE_INSTRING = 1; | 
| 20 | 20 | const STATE_INHEREDOC = 2; | 
| 21 | 21 | |
| @@ -45,7 +45,7 @@ discard block | ||
| 45 | 45 | self::STATE_INITIAL => [ | 
| 46 | 46 | self::REGEX_SPACE => false, | 
| 47 | 47 | self::REGEX_COMMENT => false, | 
| 48 | -                self::REGEX_COMMENT_ML => function () { | |
| 48 | +                self::REGEX_COMMENT_ML => function() { | |
| 49 | 49 | $pos = strpos($this->content, '*/', $this->count); | 
| 50 | 50 |                      if (false === $pos) { | 
| 51 | 51 | $this->line += substr_count(substr($this->content, $this->count), "\n"); | 
| @@ -54,29 +54,29 @@ discard block | ||
| 54 | 54 | $this->line += substr_count(substr($this->content, $this->count, $pos - $this->count + 2), "\n"); | 
| 55 | 55 | $this->count = $pos + 2; | 
| 56 | 56 | }, | 
| 57 | -                self::REGEX_DQUOTE => function () { | |
| 57 | +                self::REGEX_DQUOTE => function() { | |
| 58 | 58 | $this->begin(self::STATE_INSTRING); | 
| 59 | 59 | $this->textBuffer = ''; | 
| 60 | 60 | }, | 
| 61 | -                self::REGEX_BOOL => function (&$yylval) { | |
| 61 | +                self::REGEX_BOOL => function(&$yylval) { | |
| 62 | 62 | $yylval = TypeCaster::toBool($yylval); | 
| 63 | 63 | |
| 64 | 64 | return Token::T_BOOL; | 
| 65 | 65 | }, | 
| 66 | -                self::REGEX_NULL => function (&$yylval) { | |
| 66 | +                self::REGEX_NULL => function(&$yylval) { | |
| 67 | 67 | $yylval = null; | 
| 68 | 68 | |
| 69 | 69 | return Token::T_NULL; | 
| 70 | 70 | }, | 
| 71 | -                self::REGEX_NUM => function (&$yylval) { | |
| 71 | +                self::REGEX_NUM => function(&$yylval) { | |
| 72 | 72 | $yylval = TypeCaster::toNum($yylval); | 
| 73 | 73 | |
| 74 | 74 | return Token::T_NUM; | 
| 75 | 75 | }, | 
| 76 | -                self::REGEX_NAME => function () { | |
| 76 | +                self::REGEX_NAME => function() { | |
| 77 | 77 | return Token::T_NAME; | 
| 78 | 78 | }, | 
| 79 | -                self::REGEX_HEREDOC => function (&$yylval) { | |
| 79 | +                self::REGEX_HEREDOC => function(&$yylval) { | |
| 80 | 80 | $needle = "\n" . $yylval; | 
| 81 | 81 | $pos = strpos($this->content, $needle, $this->count); | 
| 82 | 82 |                      if (false === $pos) { | 
| @@ -90,21 +90,21 @@ discard block | ||
| 90 | 90 | |
| 91 | 91 | return Token::T_END_STR; | 
| 92 | 92 | }, | 
| 93 | -                self::REGEX_TOKEN => function ($yylval) { | |
| 93 | +                self::REGEX_TOKEN => function($yylval) { | |
| 94 | 94 | return $yylval; | 
| 95 | 95 | }, | 
| 96 | -                self::REGEX_VAR => function () { | |
| 96 | +                self::REGEX_VAR => function() { | |
| 97 | 97 | return Token::T_VAR; | 
| 98 | 98 | }, | 
| 99 | -                self::REGEX_ANY => function ($yylval) { | |
| 99 | +                self::REGEX_ANY => function($yylval) { | |
| 100 | 100 |                      $this->error('Unexpected char \'' . $yylval . '\''); | 
| 101 | 101 | }, | 
| 102 | -                self::EOF => function () { | |
| 102 | +                self::EOF => function() { | |
| 103 | 103 | return Token::T_EOF; | 
| 104 | 104 | }, | 
| 105 | 105 | ], | 
| 106 | 106 | self::STATE_INSTRING => [ | 
| 107 | -                '[^\\\"$]+' => function (&$yylval) { | |
| 107 | +                '[^\\\"$]+' => function(&$yylval) { | |
| 108 | 108 | $this->textBuffer .= $yylval; | 
| 109 | 109 |                      if ('$' == substr($this->content, $this->count, 1)) { | 
| 110 | 110 | $yylval = $this->textBuffer; | 
| @@ -113,7 +113,7 @@ discard block | ||
| 113 | 113 | return Token::T_STRING; | 
| 114 | 114 | } | 
| 115 | 115 | }, | 
| 116 | -                '?:\\\(.)' => function ($yylval) { | |
| 116 | +                '?:\\\(.)' => function($yylval) { | |
| 117 | 117 |                      switch ($yylval) { | 
| 118 | 118 | case 'n': | 
| 119 | 119 | $this->textBuffer .= "\n"; | 
| @@ -146,7 +146,7 @@ discard block | ||
| 146 | 146 | break; | 
| 147 | 147 | } | 
| 148 | 148 | }, | 
| 149 | -                '\$' => function (&$yylval) { | |
| 149 | +                '\$' => function(&$yylval) { | |
| 150 | 150 |                      if (preg_match('/^{([A-Za-z0-9_]+)}/', substr($this->content, $this->count), $matches)) { | 
| 151 | 151 | $this->count += strlen($matches[0]); | 
| 152 | 152 | $yylval = $matches[1]; | 
| @@ -156,13 +156,13 @@ discard block | ||
| 156 | 156 | |
| 157 | 157 | $this->textBuffer .= $yylval; | 
| 158 | 158 | }, | 
| 159 | -                self::REGEX_DQUOTE => function (&$yylval) { | |
| 159 | +                self::REGEX_DQUOTE => function(&$yylval) { | |
| 160 | 160 | $yylval = $this->textBuffer; | 
| 161 | 161 | $this->begin(self::STATE_INITIAL); | 
| 162 | 162 | |
| 163 | 163 | return Token::T_END_STR; | 
| 164 | 164 | }, | 
| 165 | -                self::EOF => function () { | |
| 165 | +                self::EOF => function() { | |
| 166 | 166 |                      $this->error('Unterminated string'); | 
| 167 | 167 | }, | 
| 168 | 168 | ], | 
| @@ -16,7 +16,7 @@ discard block | ||
| 16 | 16 | abstract class AbstractLexer | 
| 17 | 17 |  { | 
| 18 | 18 | const STATE_INITIAL = 0; | 
| 19 | - const EOF = '<<EOF>>'; | |
| 19 | + const EOF = '<<EOF>>'; | |
| 20 | 20 | |
| 21 | 21 | private $regexes = []; | 
| 22 | 22 | private $tokenMaps = []; | 
| @@ -61,7 +61,7 @@ discard block | ||
| 61 | 61 | $this->line += substr_count($matches[0], "\n"); | 
| 62 | 62 |              } else { | 
| 63 | 63 | $i = 0; | 
| 64 | - $matches = [ '' ]; | |
| 64 | + $matches = ['']; | |
| 65 | 65 | } | 
| 66 | 66 | |
| 67 | 67 |              if ($this->tokenMaps[$this->state][$i - 1]) { | 
| @@ -31,7 +31,7 @@ discard block | ||
| 31 | 31 |              throw new Exception('Macro with the same name already registered.'); | 
| 32 | 32 | } | 
| 33 | 33 | |
| 34 | - $this->macro[$macro->getName()] = [ $macro, 'execute' ]; | |
| 34 | + $this->macro[$macro->getName()] = [$macro, 'execute']; | |
| 35 | 35 | } | 
| 36 | 36 | |
| 37 | 37 | public function setVariable($name, $value) | 
| @@ -184,7 +184,7 @@ discard block | ||
| 184 | 184 | $required = $this->consumeOptionalAssignementOperator(); | 
| 185 | 185 | $realValue = $this->parseValue($required, $valueIsKey); | 
| 186 | 186 |                  if ($valueIsKey) { | 
| 187 | - return new ObjectNode([ $value => $realValue ]); | |
| 187 | + return new ObjectNode([$value => $realValue]); | |
| 188 | 188 | } | 
| 189 | 189 | break; | 
| 190 | 190 | case Token::T_BOOL: | 
| @@ -353,7 +353,7 @@ discard block | ||
| 353 | 353 | return $includeValue; | 
| 354 | 354 | } | 
| 355 | 355 | |
| 356 | - $files = [ $path ]; | |
| 356 | + $files = [$path]; | |
| 357 | 357 | } | 
| 358 | 358 | |
| 359 | 359 | $token = $this->token; | 
| @@ -378,14 +378,14 @@ discard block | ||
| 378 | 378 | |
| 379 | 379 | public function resolvePath($file) | 
| 380 | 380 |      { | 
| 381 | -        return $this->relativeToCurrentFile(function () use ($file) { | |
| 381 | +        return $this->relativeToCurrentFile(function() use ($file) { | |
| 382 | 382 | return realpath($file); | 
| 383 | 383 | }); | 
| 384 | 384 | } | 
| 385 | 385 | |
| 386 | 386 | private function glob($pattern) | 
| 387 | 387 |      { | 
| 388 | -        return $this->relativeToCurrentFile(function () use ($pattern) { | |
| 388 | +        return $this->relativeToCurrentFile(function() use ($pattern) { | |
| 389 | 389 |              return array_map('realpath', glob($pattern) ?: []); | 
| 390 | 390 | }); | 
| 391 | 391 | } |