@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | |
| 63 | 63 | 'comment' => new Rule(new CommentMatcher(['//'], [['/*', '*/']]), ['priority' => 3]), |
| 64 | 64 | |
| 65 | - 'call' => new Rule(new RegexMatcher('/(' . self::IDENTIFIER . ')\s*\(/iu'), ['priority' => -1]), |
|
| 65 | + 'call' => new Rule(new RegexMatcher('/('.self::IDENTIFIER.')\s*\(/iu'), ['priority' => -1]), |
|
| 66 | 66 | |
| 67 | 67 | 'keyword' => new Rule(new WordMatcher([ |
| 68 | 68 | 'do', 'if', 'in', 'for', 'let', 'new', 'try', 'var', 'case', 'else', 'enum', 'eval', |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | ]) |
| 92 | 92 | ], |
| 93 | 93 | |
| 94 | - 'variable' => new Rule(new RegexMatcher('/\b(?<!\.)(' . self::IDENTIFIER . ':?)/iu'), [ |
|
| 94 | + 'variable' => new Rule(new RegexMatcher('/\b(?<!\.)('.self::IDENTIFIER.':?)/iu'), [ |
|
| 95 | 95 | 'priority' => -1, |
| 96 | 96 | 'enabled' => $this->variables |
| 97 | 97 | ]), |
@@ -19,7 +19,7 @@ |
||
| 19 | 19 | new Rule(new RegexMatcher('/(?:[)\w]\??:|\bas\b)\s*(\w+)/si'), [ |
| 20 | 20 | 'context' => ['!meta.json', '!string', '!comment'] |
| 21 | 21 | ]), |
| 22 | - new Rule(new RegexMatcher('/(?:(?=(<\w+(?1)?>))|\G)<(\w+)/six', [ 2 => Token::NAME ]), [ |
|
| 22 | + new Rule(new RegexMatcher('/(?:(?=(<\w+(?1)?>))|\G)<(\w+)/six', [2 => Token::NAME]), [ |
|
| 23 | 23 | 'context' => ['!meta.json', '!string', '!comment'] |
| 24 | 24 | ]), |
| 25 | 25 | ], |
@@ -67,7 +67,7 @@ |
||
| 67 | 67 | |
| 68 | 68 | public function set($style) |
| 69 | 69 | { |
| 70 | - $escape = "\e[".implode(';', array_map(function ($style, $name) { |
|
| 70 | + $escape = "\e[".implode(';', array_map(function($style, $name) { |
|
| 71 | 71 | return $this->_style($style, $name); |
| 72 | 72 | }, array_keys($style), $style)).'m'; |
| 73 | 73 | |
@@ -40,15 +40,15 @@ |
||
| 40 | 40 | } |
| 41 | 41 | $result .= $this->_content(substr($source, $last)); |
| 42 | 42 | |
| 43 | - return $result . ($this->_options['lines']['enable'] ? $this->formatLineEnd($this->_line++) : ''); |
|
| 43 | + return $result.($this->_options['lines']['enable'] ? $this->formatLineEnd($this->_line++) : ''); |
|
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | private function _content($text) |
| 47 | 47 | { |
| 48 | 48 | $content = $this->content($text); |
| 49 | 49 | |
| 50 | - return $this->_options['lines']['enable'] ? preg_replace_callback('/\R/u', function ($feed) { |
|
| 51 | - return $this->formatLineEnd($this->_line++) . $feed[0] . $this->formatLineStart($this->_line); |
|
| 50 | + return $this->_options['lines']['enable'] ? preg_replace_callback('/\R/u', function($feed) { |
|
| 51 | + return $this->formatLineEnd($this->_line++).$feed[0].$this->formatLineStart($this->_line); |
|
| 52 | 52 | }, $content) : $content; |
| 53 | 53 | } |
| 54 | 54 | |
@@ -60,7 +60,7 @@ |
||
| 60 | 60 | return sprintf( |
| 61 | 61 | '<%s class="%s">', |
| 62 | 62 | $this->_tag, |
| 63 | - $this->_prefix . str_replace('.', " {$this->_prefix}", $token->name) |
|
| 63 | + $this->_prefix.str_replace('.', " {$this->_prefix}", $token->name) |
|
| 64 | 64 | ); |
| 65 | 65 | } |
| 66 | 66 | |
@@ -37,7 +37,7 @@ |
||
| 37 | 37 | public function __construct(array $options = []) |
| 38 | 38 | { |
| 39 | 39 | parent::__construct(array_replace_recursive([ |
| 40 | - 'styles' => include __DIR__ . '/../Styles/Cli/Default.php' |
|
| 40 | + 'styles' => include __DIR__.'/../Styles/Cli/Default.php' |
|
| 41 | 41 | ], $options)); |
| 42 | 42 | |
| 43 | 43 | $this->_styles = $this->_options['styles']; |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | public function __construct(array $options = []) |
| 37 | 37 | { |
| 38 | 38 | parent::__construct(array_replace_recursive([ |
| 39 | - 'styles' => include __DIR__ . '/../Styles/Cli/Default.php' |
|
| 39 | + 'styles' => include __DIR__.'/../Styles/Cli/Default.php' |
|
| 40 | 40 | ], $options)); |
| 41 | 41 | |
| 42 | 42 | $this->_styles = $this->_options['styles']; |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | |
| 45 | 45 | public function format(Tokens $tokens) |
| 46 | 46 | { |
| 47 | - return parent::format($tokens) . Console::reset(); |
|
| 47 | + return parent::format($tokens).Console::reset(); |
|
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | protected function token(Token $token) |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | |
| 63 | 63 | protected function formatLineStart($line) |
| 64 | 64 | { |
| 65 | - return str_pad($line, 5, ' ', STR_PAD_LEFT) . ' | ' . Console::set(Console::current()); |
|
| 65 | + return str_pad($line, 5, ' ', STR_PAD_LEFT).' | '.Console::set(Console::current()); |
|
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | protected function formatLineEnd($line) |
@@ -44,17 +44,17 @@ |
||
| 44 | 44 | ]), |
| 45 | 45 | |
| 46 | 46 | 'variable' => [ |
| 47 | - new Rule(new RegexMatcher('/(?<!`)(\$' . $namespace . '[a-z_]\w*)/i', $namespaceGroup), [ |
|
| 47 | + new Rule(new RegexMatcher('/(?<!`)(\$'.$namespace.'[a-z_]\w*)/i', $namespaceGroup), [ |
|
| 48 | 48 | 'context' => $variableRules, |
| 49 | 49 | 'priority' => 0, |
| 50 | 50 | ]), |
| 51 | - new Rule(new RegexMatcher('/[^`](\$\{' . $namespace . '.*?\})/i', $namespaceGroup), [ |
|
| 51 | + new Rule(new RegexMatcher('/[^`](\$\{'.$namespace.'.*?\})/i', $namespaceGroup), [ |
|
| 52 | 52 | 'context' => $variableRules, |
| 53 | 53 | 'priority' => 0, |
| 54 | 54 | ]), |
| 55 | 55 | ], |
| 56 | 56 | |
| 57 | - 'variable.splat' => new Rule(new RegexMatcher('/[^`](\@' . $namespace . '[a-z_]\w*)/i', $namespaceGroup), [ |
|
| 57 | + 'variable.splat' => new Rule(new RegexMatcher('/[^`](\@'.$namespace.'[a-z_]\w*)/i', $namespaceGroup), [ |
|
| 58 | 58 | 'context' => $variableRules, |
| 59 | 59 | 'priority' => 0, |
| 60 | 60 | ]), |
@@ -43,8 +43,8 @@ |
||
| 43 | 43 | ])), |
| 44 | 44 | ], |
| 45 | 45 | 'diff' => [ |
| 46 | - 'add' => new Rule(new RegexMatcher('/(?:^\+.*?(?>\R|$))+/mi', [ 0 => Token::NAME ])), |
|
| 47 | - 'remove' => new Rule(new RegexMatcher('/(?:^-.*?(?>\R|$))+/mi', [ 0 => Token::NAME ])), |
|
| 46 | + 'add' => new Rule(new RegexMatcher('/(?:^\+.*?(?>\R|$))+/mi', [0 => Token::NAME])), |
|
| 47 | + 'remove' => new Rule(new RegexMatcher('/(?:^-.*?(?>\R|$))+/mi', [0 => Token::NAME])), |
|
| 48 | 48 | ], |
| 49 | 49 | ]); |
| 50 | 50 | } |