@@ -30,7 +30,7 @@ |
||
30 | 30 | |
31 | 31 | public static function strings(array $strings, array $options = []) |
32 | 32 | { |
33 | - return array_map(function ($matcher) use ($options) { |
|
33 | + return array_map(function($matcher) use ($options) { |
|
34 | 34 | return new Rule( |
35 | 35 | $matcher instanceof MatcherInterface ? $matcher : new SubStringMatcher($matcher), |
36 | 36 | array_replace(['factory' => new TokenFactory(ContextualToken::class)], $options) |
@@ -61,7 +61,7 @@ |
||
61 | 61 | 'string.nowdoc' => new Rule( |
62 | 62 | new RegexMatcher('/<<\s*\'(\w+)\';(?P<string>.*?)\R\1/sm', [ |
63 | 63 | 'string' => Token::NAME, |
64 | - 0 => 'keyword.nowdoc' |
|
64 | + 0 => 'keyword.nowdoc' |
|
65 | 65 | ]), |
66 | 66 | ['context' => ['!comment']] |
67 | 67 | ), |
@@ -48,7 +48,7 @@ |
||
48 | 48 | * |
49 | 49 | * @return false|Token|null |
50 | 50 | */ |
51 | - public function create($name, $params = [ ]) |
|
51 | + public function create($name, $params = []) |
|
52 | 52 | { |
53 | 53 | if ($name !== null) { |
54 | 54 | $name = $this->getName($name); |
@@ -45,7 +45,7 @@ |
||
45 | 45 | |
46 | 46 | protected function processEnd(Context $context, Language $language, Result $result, TokenIterator $tokens) |
47 | 47 | { |
48 | - $closing = array_filter($context->stack, function ($name) { |
|
48 | + $closing = array_filter($context->stack, function($name) { |
|
49 | 49 | return in_array($name, $this->closes); |
50 | 50 | }); |
51 | 51 |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | public function setRules($rules) |
48 | 48 | { |
49 | 49 | if (empty($rules)) { |
50 | - $this->_rules = [ 'none' => Validator::CONTEXT_IN_ONE_OF ]; |
|
50 | + $this->_rules = ['none' => Validator::CONTEXT_IN_ONE_OF]; |
|
51 | 51 | } else { |
52 | 52 | foreach ($rules as $key => $rule) { |
53 | 53 | list($plain, $type) = $this->_parse($rule); |
@@ -59,8 +59,8 @@ discard block |
||
59 | 59 | private function _clean($rule, &$required) |
60 | 60 | { |
61 | 61 | if (strpos($rule, '.') !== false) { |
62 | - $parents = array_filter(array_keys($required), function ($key) use ($rule) { |
|
63 | - return fnmatch($key . '.*', $rule); |
|
62 | + $parents = array_filter(array_keys($required), function($key) use ($rule) { |
|
63 | + return fnmatch($key.'.*', $rule); |
|
64 | 64 | }); |
65 | 65 | |
66 | 66 | foreach ($parents as $remove) { |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | { |
165 | 165 | static $validator; |
166 | 166 | if (!$validator) { |
167 | - $validator = new DelegateValidator(function () { |
|
167 | + $validator = new DelegateValidator(function() { |
|
168 | 168 | return true; |
169 | 169 | }); |
170 | 170 | } |
@@ -63,7 +63,7 @@ |
||
63 | 63 | foreach (array_keys($this->_pending) as $position) { |
64 | 64 | uasort( |
65 | 65 | $this->_tokens[$position], |
66 | - Token::class . '::compare' |
|
66 | + Token::class.'::compare' |
|
67 | 67 | ); |
68 | 68 | } |
69 | 69 | $this->_pending = []; |
@@ -67,7 +67,7 @@ |
||
67 | 67 | protected function getDefaultInputDefinition() |
68 | 68 | { |
69 | 69 | $input = parent::getDefaultInputDefinition(); |
70 | - $input->setOptions(array_filter($input->getOptions(), function (InputOption $option) { |
|
70 | + $input->setOptions(array_filter($input->getOptions(), function(InputOption $option) { |
|
71 | 71 | return $option->getShortcut() != 'q'; |
72 | 72 | })); |
73 | 73 | $input->addOption(new InputOption('no-output', 's', InputOption::VALUE_NONE, 'Disables output, useful for debug')); |
@@ -83,10 +83,10 @@ discard block |
||
83 | 83 | } |
84 | 84 | |
85 | 85 | if ($this->wants('detailed-time')) { |
86 | - $this->_slashed('Times [s]', array_map(function ($t) { |
|
86 | + $this->_slashed('Times [s]', array_map(function($t) { |
|
87 | 87 | return number_format($t, 5); |
88 | 88 | }, $this->_times)); |
89 | - $this->_slashed('Performance [chars/s]', array_map(function ($t) { |
|
89 | + $this->_slashed('Performance [chars/s]', array_map(function($t) { |
|
90 | 90 | return number_format(strlen($this->_source) / $t); |
91 | 91 | }, $this->_times)); |
92 | 92 | } |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | } |
97 | 97 | |
98 | 98 | if ($this->wants('density')) { |
99 | - $this->_slashed('Token density [tokens/kB]', array_map(function ($c) { |
|
99 | + $this->_slashed('Token density [tokens/kB]', array_map(function($c) { |
|
100 | 100 | return number_format($c / strlen($this->_source) * 1024, 1); |
101 | 101 | }, $this->_counts)); |
102 | 102 | } |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | |
112 | 112 | protected function tokenize() |
113 | 113 | { |
114 | - $tokens = $this->benchmark(function () { |
|
114 | + $tokens = $this->benchmark(function() { |
|
115 | 115 | return $this->_language->tokenize($this->_source); |
116 | 116 | }, $this->_times['tokenization']); |
117 | 117 | |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | |
141 | 141 | protected function parse(Tokens $tokens) |
142 | 142 | { |
143 | - $tokens = $this->benchmark(function () use ($tokens) { |
|
143 | + $tokens = $this->benchmark(function() use ($tokens) { |
|
144 | 144 | return $this->_language->parse($tokens); |
145 | 145 | }, $this->_times['parsing']); |
146 | 146 | |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | |
155 | 155 | protected function format(Tokens $tokens) |
156 | 156 | { |
157 | - return $this->benchmark(function () use ($tokens) { |
|
157 | + return $this->benchmark(function() use ($tokens) { |
|
158 | 158 | return $this->_formatter->format($tokens); |
159 | 159 | }, $this->_times['formatting']); |
160 | 160 | } |
@@ -163,10 +163,10 @@ discard block |
||
163 | 163 | { |
164 | 164 | $this->_output->writeln(sprintf( |
165 | 165 | "$message %s: %s", |
166 | - implode(' / ', array_map(function ($f) { |
|
166 | + implode(' / ', array_map(function($f) { |
|
167 | 167 | return "<comment>{$f}</comment>"; |
168 | 168 | }, array_keys($data))), |
169 | - implode(' / ', array_map(function ($f) { |
|
169 | + implode(' / ', array_map(function($f) { |
|
170 | 170 | return "<info>{$f}</info>"; |
171 | 171 | }, array_values($data))) |
172 | 172 | )); |
@@ -30,13 +30,13 @@ discard block |
||
30 | 30 | if ($input->getOption('dry')) { |
31 | 31 | $output->writeln($this->generate()); |
32 | 32 | } else { |
33 | - $path = __DIR__ . '/../../../Docs/A-languages.md'; |
|
33 | + $path = __DIR__.'/../../../Docs/A-languages.md'; |
|
34 | 34 | |
35 | 35 | $output->writeln("<info>Opening file ./Docs/A-languages.md ...</info>", OutputInterface::VERBOSITY_VERBOSE); |
36 | 36 | $content = file_get_contents($path); |
37 | 37 | file_put_contents($path, preg_replace( |
38 | 38 | '/^<!-- aliasbegin -->\R.*?^<!-- aliasend -->\R/ms', |
39 | - "<!-- aliasbegin -->\n" . $this->generate() . "<!-- aliasend -->\n", |
|
39 | + "<!-- aliasbegin -->\n".$this->generate()."<!-- aliasend -->\n", |
|
40 | 40 | $content |
41 | 41 | )); |
42 | 42 | $output->writeln("<info>Closing file ./Docs/A-languages.md ...</info>", OutputInterface::VERBOSITY_VERBOSE); |
@@ -63,13 +63,13 @@ discard block |
||
63 | 63 | |
64 | 64 | ksort($result); |
65 | 65 | |
66 | - $return = "Class | Name | MIME | Extension\n"; |
|
67 | - $return .= "------|------|------|----------\n"; |
|
66 | + $return = "Class | Name | MIME | Extension\n"; |
|
67 | + $return .= "------|------|------|----------\n"; |
|
68 | 68 | foreach ($result as $class => $aliases) { |
69 | - $return .= '`' . $class . '` | '; |
|
70 | - $return .= (isset($aliases['name']) ? '`' . implode('`, `', $aliases['name']) . '`' : 'none') . ' | '; |
|
71 | - $return .= (isset($aliases['mime']) ? '`' . implode('`, `', $aliases['mime']) . '`' : 'none') . ' | '; |
|
72 | - $return .= (isset($aliases['extension']) ? '`' . implode('`, `', $aliases['extension']) . '`' : 'none') . "\n"; |
|
69 | + $return .= '`'.$class.'` | '; |
|
70 | + $return .= (isset($aliases['name']) ? '`'.implode('`, `', $aliases['name']).'`' : 'none').' | '; |
|
71 | + $return .= (isset($aliases['mime']) ? '`'.implode('`, `', $aliases['mime']).'`' : 'none').' | '; |
|
72 | + $return .= (isset($aliases['extension']) ? '`'.implode('`, `', $aliases['extension']).'`' : 'none')."\n"; |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | return $return; |