@@ -101,7 +101,7 @@ |
||
101 | 101 | $lastTokenEndIndex = 0; |
102 | 102 | foreach (\array_slice($scannedTokens, 0, $nbScannedTokensToUse) as $token) { |
103 | 103 | if (DocLexer::T_STRING === $token['type']) { |
104 | - $token['value'] = '"'.str_replace('"', '""', $token['value']).'"'; |
|
104 | + $token['value'] = '"' . str_replace('"', '""', $token['value']) . '"'; |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | $missingTextLength = $token['position'] - $lastTokenEndIndex; |
@@ -37,7 +37,7 @@ |
||
37 | 37 | $filePath = $file->getRealPath(); |
38 | 38 | |
39 | 39 | if (1 === Preg::match('/\s/', $filePath)) { |
40 | - $filePath = '"'.$filePath.'"'; |
|
40 | + $filePath = '"' . $filePath . '"'; |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | $options = [ |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | implode( |
55 | 55 | PHP_EOL, |
56 | 56 | array_map( |
57 | - static function (string $line) use ($isDecorated, $lineTemplate) { |
|
57 | + static function(string $line) use ($isDecorated, $lineTemplate) { |
|
58 | 58 | if ($isDecorated) { |
59 | 59 | $count = 0; |
60 | 60 | $line = Preg::replaceCallback( |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | '/^(\-.*)/', |
64 | 64 | '/^(@.*)/', |
65 | 65 | ], |
66 | - static function (array $matches) { |
|
66 | + static function(array $matches) { |
|
67 | 67 | if ('+' === $matches[0][0]) { |
68 | 68 | $colour = 'green'; |
69 | 69 | } elseif ('-' === $matches[0][0]) { |
@@ -69,16 +69,16 @@ discard block |
||
69 | 69 | $versionSuffix = ''; |
70 | 70 | |
71 | 71 | if (isset($package['dist']['reference'])) { |
72 | - $versionSuffix = '#'.$package['dist']['reference']; |
|
72 | + $versionSuffix = '#' . $package['dist']['reference']; |
|
73 | 73 | } |
74 | 74 | |
75 | - return $package['version'].$versionSuffix; |
|
75 | + return $package['version'] . $versionSuffix; |
|
76 | 76 | } |
77 | 77 | |
78 | 78 | public function getVersion(): string |
79 | 79 | { |
80 | 80 | if ($this->isInstalledByComposer()) { |
81 | - return Application::VERSION.':'.$this->getComposerVersion(); |
|
81 | + return Application::VERSION . ':' . $this->getComposerVersion(); |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | return Application::VERSION; |
@@ -108,6 +108,6 @@ discard block |
||
108 | 108 | |
109 | 109 | private function getComposerInstalledFile(): string |
110 | 110 | { |
111 | - return __DIR__.'/../../../composer/installed.json'; |
|
111 | + return __DIR__ . '/../../../composer/installed.json'; |
|
112 | 112 | } |
113 | 113 | } |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | */ |
36 | 36 | public function getInvalidErrors(): array |
37 | 37 | { |
38 | - return array_filter($this->errors, static function (Error $error) { |
|
38 | + return array_filter($this->errors, static function(Error $error) { |
|
39 | 39 | return Error::TYPE_INVALID === $error->getType(); |
40 | 40 | }); |
41 | 41 | } |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | */ |
48 | 48 | public function getExceptionErrors(): array |
49 | 49 | { |
50 | - return array_filter($this->errors, static function (Error $error) { |
|
50 | + return array_filter($this->errors, static function(Error $error) { |
|
51 | 51 | return Error::TYPE_EXCEPTION === $error->getType(); |
52 | 52 | }); |
53 | 53 | } |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | */ |
60 | 60 | public function getLintErrors(): array |
61 | 61 | { |
62 | - return array_filter($this->errors, static function (Error $error) { |
|
62 | + return array_filter($this->errors, static function(Error $error) { |
|
63 | 63 | return Error::TYPE_LINT === $error->getType(); |
64 | 64 | }); |
65 | 65 | } |
@@ -75,11 +75,11 @@ discard block |
||
75 | 75 | */ |
76 | 76 | public static function stableSort(array $elements, callable $getComparedValue, callable $compareValues): array |
77 | 77 | { |
78 | - array_walk($elements, static function (&$element, int $index) use ($getComparedValue): void { |
|
78 | + array_walk($elements, static function(&$element, int $index) use ($getComparedValue): void { |
|
79 | 79 | $element = [$element, $index, $getComparedValue($element)]; |
80 | 80 | }); |
81 | 81 | |
82 | - usort($elements, static function ($a, $b) use ($compareValues) { |
|
82 | + usort($elements, static function($a, $b) use ($compareValues) { |
|
83 | 83 | $comparison = $compareValues($a[2], $b[2]); |
84 | 84 | |
85 | 85 | if (0 !== $comparison) { |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | return $a[1] <=> $b[1]; |
90 | 90 | }); |
91 | 91 | |
92 | - return array_map(static function (array $item) { |
|
92 | + return array_map(static function(array $item) { |
|
93 | 93 | return $item[0]; |
94 | 94 | }, $elements); |
95 | 95 | } |
@@ -107,10 +107,10 @@ discard block |
||
107 | 107 | // `usort(): Array was modified by the user comparison function` warning for mocked objects. |
108 | 108 | return self::stableSort( |
109 | 109 | $fixers, |
110 | - static function (FixerInterface $fixer) { |
|
110 | + static function(FixerInterface $fixer) { |
|
111 | 111 | return $fixer->getPriority(); |
112 | 112 | }, |
113 | - static function (int $a, int $b) { |
|
113 | + static function(int $a, int $b) { |
|
114 | 114 | return $b <=> $a; |
115 | 115 | } |
116 | 116 | ); |
@@ -129,14 +129,14 @@ discard block |
||
129 | 129 | throw new \InvalidArgumentException('Array of names cannot be empty.'); |
130 | 130 | } |
131 | 131 | |
132 | - $names = array_map(static function (string $name) { |
|
132 | + $names = array_map(static function(string $name) { |
|
133 | 133 | return sprintf('`%s`', $name); |
134 | 134 | }, $names); |
135 | 135 | |
136 | 136 | $last = array_pop($names); |
137 | 137 | |
138 | 138 | if ($names) { |
139 | - return implode(', ', $names).' and '.$last; |
|
139 | + return implode(', ', $names) . ' and ' . $last; |
|
140 | 140 | } |
141 | 141 | |
142 | 142 | return $last; |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | */ |
48 | 48 | public function __sleep(): array |
49 | 49 | { |
50 | - throw new \BadMethodCallException('Cannot serialize '.__CLASS__); |
|
50 | + throw new \BadMethodCallException('Cannot serialize ' . __CLASS__); |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | /** |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | */ |
59 | 59 | public function __wakeup(): void |
60 | 60 | { |
61 | - throw new \BadMethodCallException('Cannot unserialize '.__CLASS__); |
|
61 | + throw new \BadMethodCallException('Cannot unserialize ' . __CLASS__); |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | /** |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | $currentIndent = $matches[0]; |
130 | 130 | $currentIndentLength = \strlen($currentIndent); |
131 | 131 | |
132 | - $content = $indent.substr($tokens[$end]->getContent(), $currentIndentLength); |
|
132 | + $content = $indent . substr($tokens[$end]->getContent(), $currentIndentLength); |
|
133 | 133 | $tokens[$end] = new Token([T_END_HEREDOC, $content]); |
134 | 134 | |
135 | 135 | if ($end === $start + 1) { |
@@ -144,11 +144,11 @@ discard block |
||
144 | 144 | $content = $tokens[$index]->getContent(); |
145 | 145 | |
146 | 146 | if ('' !== $currentIndent) { |
147 | - $content = Preg::replace('/(?<=\v)(?!'.$currentIndent.')\h+/', '', $content); |
|
147 | + $content = Preg::replace('/(?<=\v)(?!' . $currentIndent . ')\h+/', '', $content); |
|
148 | 148 | } |
149 | 149 | |
150 | 150 | $regexEnd = $last && !$currentIndent ? '(?!\v|$)' : '(?!\v)'; |
151 | - $content = Preg::replace('/(?<=\v)'.$currentIndent.$regexEnd.'/', $indent, $content); |
|
151 | + $content = Preg::replace('/(?<=\v)' . $currentIndent . $regexEnd . '/', $indent, $content); |
|
152 | 152 | |
153 | 153 | $tokens[$index] = new Token([$tokens[$index]->getId(), $content]); |
154 | 154 | } |
@@ -164,9 +164,9 @@ discard block |
||
164 | 164 | $content = $tokens[$index]->getContent(); |
165 | 165 | |
166 | 166 | if (!\in_array($content[0], ["\r", "\n"], true) && (!$currentIndent || $currentIndent === substr($content, 0, $currentIndentLength))) { |
167 | - $content = $indent.substr($content, $currentIndentLength); |
|
167 | + $content = $indent . substr($content, $currentIndentLength); |
|
168 | 168 | } elseif ($currentIndent) { |
169 | - $content = Preg::replace('/^(?!'.$currentIndent.')\h+/', '', $content); |
|
169 | + $content = Preg::replace('/^(?!' . $currentIndent . ')\h+/', '', $content); |
|
170 | 170 | } |
171 | 171 | |
172 | 172 | $tokens[$index] = new Token([T_ENCAPSED_AND_WHITESPACE, $content]); |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | $content = $tokens[$index]->getContent(); |
183 | 183 | |
184 | 184 | if ($tokens[$index]->isWhitespace() && $tokens[$index - 1]->isGivenKind(T_OPEN_TAG)) { |
185 | - $content = $tokens[$index - 1]->getContent().$content; |
|
185 | + $content = $tokens[$index - 1]->getContent() . $content; |
|
186 | 186 | } |
187 | 187 | |
188 | 188 | if (1 === Preg::match('/\R(\h*)$/', $content, $matches)) { |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | |
125 | 125 | $content = Preg::replace( |
126 | 126 | '/(\R+)\h*$/', |
127 | - '$1'.$scopes[$currentScope]['initial_indent'].($indent ? $this->whitespacesConfig->getIndent() : ''), |
|
127 | + '$1' . $scopes[$currentScope]['initial_indent'] . ($indent ? $this->whitespacesConfig->getIndent() : ''), |
|
128 | 128 | $token->getContent() |
129 | 129 | ); |
130 | 130 | |
@@ -132,8 +132,8 @@ discard block |
||
132 | 132 | $previousLineNewIndent = $this->extractIndent($content); |
133 | 133 | } else { |
134 | 134 | $content = Preg::replace( |
135 | - '/(\R)'.preg_quote($scopes[$currentScope]['initial_indent'], '/').'(\h*)$/', |
|
136 | - '$1'.$scopes[$currentScope]['new_indent'].'$2', |
|
135 | + '/(\R)' . preg_quote($scopes[$currentScope]['initial_indent'], '/') . '(\h*)$/', |
|
136 | + '$1' . $scopes[$currentScope]['new_indent'] . '$2', |
|
137 | 137 | $token->getContent() |
138 | 138 | ); |
139 | 139 | } |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | return false; |
253 | 253 | } |
254 | 254 | |
255 | - return (bool) Preg::match('/\R/', $this->computeNewLineContent($tokens, $index)); |
|
255 | + return (bool)Preg::match('/\R/', $this->computeNewLineContent($tokens, $index)); |
|
256 | 256 | } |
257 | 257 | |
258 | 258 | private function computeNewLineContent(Tokens $tokens, int $index): string |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | $content = $tokens[$index]->getContent(); |
261 | 261 | |
262 | 262 | if (0 !== $index && $tokens[$index - 1]->equalsAny([[T_OPEN_TAG], [T_CLOSE_TAG]])) { |
263 | - $content = Preg::replace('/\S/', '', $tokens[$index - 1]->getContent()).$content; |
|
263 | + $content = Preg::replace('/\S/', '', $tokens[$index - 1]->getContent()) . $content; |
|
264 | 264 | } |
265 | 265 | |
266 | 266 | return $content; |