@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | 'context' => ['comment.docblock'] |
71 | 71 | ]), |
72 | 72 | |
73 | - 'call' => new Rule(new RegexMatcher('/(' . self::IDENTIFIER . ')\s*\(/iu'), ['priority' => -1]), |
|
73 | + 'call' => new Rule(new RegexMatcher('/('.self::IDENTIFIER.')\s*\(/iu'), ['priority' => -1]), |
|
74 | 74 | |
75 | 75 | 'keyword' => new Rule(new WordMatcher([ |
76 | 76 | 'do', 'if', 'in', 'for', 'let', 'new', 'try', 'var', 'case', 'else', 'enum', 'eval', |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | ]) |
100 | 100 | ], |
101 | 101 | |
102 | - 'variable' => new Rule(new RegexMatcher('/\b(?<!\.)(' . self::IDENTIFIER . ':?)/iu'), [ |
|
102 | + 'variable' => new Rule(new RegexMatcher('/\b(?<!\.)('.self::IDENTIFIER.':?)/iu'), [ |
|
103 | 103 | 'priority' => -1, |
104 | 104 | 'enabled' => $this->variables |
105 | 105 | ]), |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | |
39 | 39 | protected function execute(InputInterface $input, OutputInterface $output) |
40 | 40 | { |
41 | - $dir = __DIR__ . static::DIRECTORY; |
|
41 | + $dir = __DIR__.static::DIRECTORY; |
|
42 | 42 | $iterator = new RecursiveIteratorIterator( |
43 | 43 | new RecursiveDirectoryIterator( |
44 | 44 | $dir, |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | $times = []; |
80 | 80 | $memory = []; |
81 | 81 | |
82 | - for ($i = (int) $input->getOption('times'), $progress = new ProgressBar($output, $i); $i > 0; $i--) { |
|
82 | + for ($i = (int)$input->getOption('times'), $progress = new ProgressBar($output, $i); $i > 0; $i--) { |
|
83 | 83 | $progress->display(); |
84 | 84 | $result = $this->benchmark($source, $language, $formatter); |
85 | 85 | $times = array_merge_recursive($times, $result['times']); |
@@ -130,17 +130,17 @@ discard block |
||
130 | 130 | gc_collect_cycles(); // force garbage collector |
131 | 131 | $memory = $this->getMemory(); |
132 | 132 | |
133 | - $tokenization = $this->_benchmark(function () use ($language, $source) { |
|
133 | + $tokenization = $this->_benchmark(function() use ($language, $source) { |
|
134 | 134 | return $language->tokenize($source); |
135 | 135 | }); |
136 | 136 | $tokens = $tokenization['result']; |
137 | 137 | |
138 | - $parsing = $this->_benchmark(function () use ($language, $tokens) { |
|
138 | + $parsing = $this->_benchmark(function() use ($language, $tokens) { |
|
139 | 139 | return $language->parse($tokens); |
140 | 140 | }); |
141 | 141 | $parsed = $tokenization['result']; |
142 | 142 | |
143 | - $formatting = $this->_benchmark(function () use ($formatter, $parsed) { |
|
143 | + $formatting = $this->_benchmark(function() use ($formatter, $parsed) { |
|
144 | 144 | return $formatter->format($parsed); |
145 | 145 | }); |
146 | 146 |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | $this->separator($file, $table); |
56 | 56 | |
57 | 57 | foreach ($data['times'] as $set => $times) { |
58 | - $result = array_map(function ($time) use ($data, $input) { |
|
58 | + $result = array_map(function($time) use ($data, $input) { |
|
59 | 59 | return $input->getOption('relative') ? $data['size'] / $time : $time * 1000; |
60 | 60 | }, $times); |
61 | 61 | |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | } |
70 | 70 | |
71 | 71 | foreach ($data['memory'] as $set => $memory) { |
72 | - $result = array_map(function ($memory) use ($data, $input) { |
|
72 | + $result = array_map(function($memory) use ($data, $input) { |
|
73 | 73 | $bytes = $input->getOption('relative') ? $memory / $data['size'] : $memory; |
74 | 74 | return $this->formatBytes($bytes); |
75 | 75 | }, $memory); |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | $table->render(); |
83 | 83 | } |
84 | 84 | |
85 | - $summary = array_filter($summary, function ($key) use ($input) { |
|
85 | + $summary = array_filter($summary, function($key) use ($input) { |
|
86 | 86 | return fnmatch($input->getOption('summary') ?: '*', $key); |
87 | 87 | }, ARRAY_FILTER_USE_KEY); |
88 | 88 | |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | |
125 | 125 | private function format($number) |
126 | 126 | { |
127 | - return is_numeric($number) ? number_format((float) $number, 2) : $number; |
|
127 | + return is_numeric($number) ? number_format((float)$number, 2) : $number; |
|
128 | 128 | } |
129 | 129 | |
130 | 130 | private function avarage(array $result) |
@@ -136,8 +136,8 @@ discard block |
||
136 | 136 | { |
137 | 137 | $mean = array_sum($result) / count($result); |
138 | 138 | |
139 | - return sqrt(array_sum(array_map(function ($result) use ($mean) { |
|
140 | - return pow((float) $result - $mean, 2); |
|
139 | + return sqrt(array_sum(array_map(function($result) use ($mean) { |
|
140 | + return pow((float)$result - $mean, 2); |
|
141 | 141 | }, $result)) / count($result)); |
142 | 142 | } |
143 | 143 |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | new Rule(new RegexMatcher('/interface\s+([\w\\\]+)/i')), |
86 | 86 | new Rule(new DelegateRegexMatcher( |
87 | 87 | '/implements\s+((?:[\w\\\]+)(?:,\s*([\w\\\]+))+)/i', |
88 | - function ($match, TokenFactoryInterface $factory) { |
|
88 | + function($match, TokenFactoryInterface $factory) { |
|
89 | 89 | foreach (preg_split('/,\s*/', $match[1][0], 0, PREG_SPLIT_OFFSET_CAPTURE) as $interface) { |
90 | 90 | yield $factory->create(Token::NAME, [ |
91 | 91 | 'pos' => $match[1][1] + $interface[1], |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | new Rule( |
131 | 131 | new DelegateRegexMatcher( |
132 | 132 | '/#(\[(?>[^\[\]]+|(?1))*\])/m', |
133 | - function ( |
|
133 | + function( |
|
134 | 134 | $match, |
135 | 135 | TokenFactoryInterface $factory |
136 | 136 | ) use ( |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | { |
34 | 34 | protected function execute(InputInterface $input, OutputInterface $output) |
35 | 35 | { |
36 | - if (! class_exists(VarExporter::class)) { |
|
36 | + if (!class_exists(VarExporter::class)) { |
|
37 | 37 | $output->writeln( |
38 | 38 | '<error>This command will not work if you installed project with composer install --no-dev' |
39 | 39 | ); |
@@ -44,8 +44,8 @@ discard block |
||
44 | 44 | $output->writeln($this->generate($output)); |
45 | 45 | } else { |
46 | 46 | file_put_contents( |
47 | - __DIR__ . '/../../../Config/metadata.php', |
|
48 | - "<?php\n\nreturn " . $this->generate($output) . ";\n" |
|
47 | + __DIR__.'/../../../Config/metadata.php', |
|
48 | + "<?php\n\nreturn ".$this->generate($output).";\n" |
|
49 | 49 | ); |
50 | 50 | } |
51 | 51 | |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | |
64 | 64 | protected function generate(OutputInterface $output) |
65 | 65 | { |
66 | - $dir = __DIR__ . '/../../../Language' . DIRECTORY_SEPARATOR; |
|
66 | + $dir = __DIR__.'/../../../Language'.DIRECTORY_SEPARATOR; |
|
67 | 67 | $iterator = new RecursiveIteratorIterator( |
68 | 68 | new RecursiveDirectoryIterator($dir, RecursiveDirectoryIterator::SKIP_DOTS), |
69 | 69 | RecursiveIteratorIterator::LEAVES_ONLY |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | } |
89 | 89 | } |
90 | 90 | |
91 | - usort($result, function ($a, $b) { |
|
91 | + usort($result, function($a, $b) { |
|
92 | 92 | return $a[0] <=> $b[0]; |
93 | 93 | }); |
94 | 94 |
@@ -51,7 +51,7 @@ |
||
51 | 51 | $child->expects($this->once())->method('setRule')->with($rule); |
52 | 52 | $child->expects($this->once())->method('setType')->with(3); |
53 | 53 | |
54 | - $factory = new DelegateTokenFactory(function () { |
|
54 | + $factory = new DelegateTokenFactory(function() { |
|
55 | 55 | }, $child); |
56 | 56 | $factory->setBase('token'); |
57 | 57 | $factory->setClass(Token::class); |
@@ -105,7 +105,7 @@ |
||
105 | 105 | |
106 | 106 | public function toString(): string |
107 | 107 | { |
108 | - return 'matches ' . var_export($this->_tokens, true) . ' tokens'; |
|
108 | + return 'matches '.var_export($this->_tokens, true).' tokens'; |
|
109 | 109 | } |
110 | 110 | |
111 | 111 | private function getTokens($tokens) |
@@ -25,7 +25,7 @@ |
||
25 | 25 | { |
26 | 26 | public function testConvertingOffsetToLineAndColumn() |
27 | 27 | { |
28 | - $source = "test" . PHP_EOL . "test2"; |
|
28 | + $source = "test".PHP_EOL."test2"; |
|
29 | 29 | |
30 | 30 | $this->assertEquals(['line' => 2, 'pos' => 2], StringHelper::positionToLine($source, 4 + strlen(PHP_EOL) + 1)); |
31 | 31 | } |
@@ -18,8 +18,8 @@ |
||
18 | 18 | |
19 | 19 | namespace Kadet\Highlighter\Tests; |
20 | 20 | |
21 | -require_once __DIR__ . '/MatcherTestCase.php'; |
|
22 | -require_once __DIR__ . '/Mocks/MockGreedyLanguage.php'; |
|
21 | +require_once __DIR__.'/MatcherTestCase.php'; |
|
22 | +require_once __DIR__.'/Mocks/MockGreedyLanguage.php'; |
|
23 | 23 | |
24 | 24 | use Kadet\Highlighter\KeyLighter; |
25 | 25 | use Kadet\Highlighter\Language\Language; |