@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | /** |
76 | 76 | * The message for the mixed type warning. |
77 | 77 | */ |
78 | - private const MESSAGE_TAG_MIXED_TYPE = 'We suggest that you avoid the "mixed" type and declare the ' . |
|
78 | + private const MESSAGE_TAG_MIXED_TYPE = 'We suggest that you avoid the "mixed" type and declare the '. |
|
79 | 79 | 'required types in detail.'; |
80 | 80 | |
81 | 81 | /** |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | { |
206 | 206 | $varOfThisTag = $this->getArgumentTokenOfTag(); |
207 | 207 | |
208 | - return '/(?P<type>[\w|\|\[\]]*) ?(?P<var>' . preg_quote($varOfThisTag['content'], '/') . |
|
208 | + return '/(?P<type>[\w|\|\[\]]*) ?(?P<var>'.preg_quote($varOfThisTag['content'], '/'). |
|
209 | 209 | ') ?(?P<desc>.*)/m'; |
210 | 210 | } |
211 | 211 | |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | |
245 | 245 | $this->varTokens = array_filter( |
246 | 246 | $this->tokens, |
247 | - function (int $tokenPos) use ($varPositions): bool { |
|
247 | + function(int $tokenPos) use ($varPositions): bool { |
|
248 | 248 | return in_array($tokenPos, $varPositions, true); |
249 | 249 | }, |
250 | 250 | ARRAY_FILTER_USE_KEY, |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | $this->stackPos - 1, |
269 | 269 | ); |
270 | 270 | |
271 | - $tagPosBeforeThis = array_filter($tagPosBeforeThis, function (int $position) { |
|
271 | + $tagPosBeforeThis = array_filter($tagPosBeforeThis, function(int $position) { |
|
272 | 272 | return $this->tokens[$position]['content'] === '@param'; |
273 | 273 | }); |
274 | 274 |
@@ -233,27 +233,27 @@ discard block |
||
233 | 233 | |
234 | 234 | // Insert new line between groups. |
235 | 235 | if ($isGroupSwitch) { |
236 | - $newContent .= $lineStartingPadding . '*' . $eolChar; |
|
236 | + $newContent .= $lineStartingPadding.'*'.$eolChar; |
|
237 | 237 | } |
238 | 238 | |
239 | 239 | // Create the new Tag. |
240 | 240 | // WARNING We do not need a line break in the tag summary. |
241 | - $newContent .= $lineStartingPadding . '* ' . trim($thisTagContent); |
|
241 | + $newContent .= $lineStartingPadding.'* '.trim($thisTagContent); |
|
242 | 242 | |
243 | 243 | if ($tag['contents']) { |
244 | 244 | $prevLine = $tag['line']; |
245 | 245 | foreach ($tag['contents'] as $subToken) { |
246 | 246 | // If we have a line switch, we need to create the correct indentation from before ... |
247 | 247 | if ($withLineSwitch = $subToken['line'] > $prevLine) { |
248 | - $newContent .= $eolChar . |
|
249 | - $lineStartingPadding . '*' . |
|
248 | + $newContent .= $eolChar. |
|
249 | + $lineStartingPadding.'*'. |
|
250 | 250 | str_repeat(' ', $subToken['column'] - strlen($lineStartingPadding) - 2); |
251 | 251 | |
252 | 252 | $prevLine = $subToken['line']; |
253 | 253 | } |
254 | 254 | |
255 | 255 | // ... if we have no line switch, then an additional whitespace is enough. |
256 | - $newContent .= ($withLineSwitch ? '' : ' ') . $subToken['content']; |
|
256 | + $newContent .= ($withLineSwitch ? '' : ' ').$subToken['content']; |
|
257 | 257 | } |
258 | 258 | } |
259 | 259 | |
@@ -263,7 +263,7 @@ discard block |
||
263 | 263 | $withReturn = $isReturn; |
264 | 264 | } |
265 | 265 | |
266 | - $newContent .= $lineStartingPadding . '*/' . $eolChar; |
|
266 | + $newContent .= $lineStartingPadding.'*/'.$eolChar; |
|
267 | 267 | |
268 | 268 | return $newContent; |
269 | 269 | } |
@@ -336,7 +336,7 @@ discard block |
||
336 | 336 | |
337 | 337 | $fixer->addContentBefore( |
338 | 338 | $tokenPos, |
339 | - $this->file->eolChar . $lineStartPadding . '* ', |
|
339 | + $this->file->eolChar.$lineStartPadding.'* ', |
|
340 | 340 | ); |
341 | 341 | |
342 | 342 | $fixer->endChangeset(); |
@@ -352,7 +352,7 @@ discard block |
||
352 | 352 | $barrier = 0; |
353 | 353 | $tokens = $this->docTagHelper->getTagTokens(); |
354 | 354 | |
355 | - $tokens = array_filter($tokens, function (array $token) use (&$barrier): bool { |
|
355 | + $tokens = array_filter($tokens, function(array $token) use (&$barrier): bool { |
|
356 | 356 | $allowed = true; |
357 | 357 | |
358 | 358 | if ($barrier) { |
@@ -448,7 +448,7 @@ discard block |
||
448 | 448 | { |
449 | 449 | $tagCounts = $this->docTagHelper->getTagCounts($tokens); |
450 | 450 | |
451 | - uasort($tokens, function (array $leftToken, array $rightToken) use ($tagCounts): int { |
|
451 | + uasort($tokens, function(array $leftToken, array $rightToken) use ($tagCounts): int { |
|
452 | 452 | return $this->compareTokensForSorting($leftToken, $rightToken, $tagCounts); |
453 | 453 | }); |
454 | 454 |
@@ -101,12 +101,12 @@ discard block |
||
101 | 101 | $file->fixer->beginChangeset(); |
102 | 102 | |
103 | 103 | if ($this->isCustomArrayType($returnTypeHint)) { |
104 | - $returnTypeHint = ($returnTypeHint[0] === '?' ? '?' : '') . 'array'; |
|
104 | + $returnTypeHint = ($returnTypeHint[0] === '?' ? '?' : '').'array'; |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | $file->fixer->addContent( |
108 | 108 | $this->token['parenthesis_closer'], |
109 | - ': ' . $returnTypeHint, |
|
109 | + ': '.$returnTypeHint, |
|
110 | 110 | ); |
111 | 111 | |
112 | 112 | $file->fixer->endChangeset(); |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | |
143 | 143 | // We add the question mark if there is a nullable type. |
144 | 144 | if (in_array($type, self::NULL_TYPES, true) && ($typeCount > 1)) { |
145 | - $returnTypeHint = '?' . $returnTypeHint; |
|
145 | + $returnTypeHint = '?'.$returnTypeHint; |
|
146 | 146 | continue; // We still need this continue to prevent further execution of the questionmark. |
147 | 147 | } |
148 | 148 | |
@@ -291,7 +291,7 @@ discard block |
||
291 | 291 | */ |
292 | 292 | private function loadFixableTypes(?array $returnTypes): array |
293 | 293 | { |
294 | - return array_filter($returnTypes ?? [], function (string $returnType): bool { |
|
294 | + return array_filter($returnTypes ?? [], function(string $returnType): bool { |
|
295 | 295 | return $this->isFixableReturnType($returnType); |
296 | 296 | }); |
297 | 297 | } |
@@ -210,12 +210,12 @@ |
||
210 | 210 | if ($pointerToAddAssertion < $docCommentClosePointer && array_key_exists($pointerAfterDocComment + 1, $tokens)) { |
211 | 211 | $phpcsFile->fixer->addContentBefore( |
212 | 212 | $pointerAfterDocComment + 1, |
213 | - $indentation . $assertion . $phpcsFile->eolChar |
|
213 | + $indentation.$assertion.$phpcsFile->eolChar |
|
214 | 214 | ); |
215 | 215 | } else { |
216 | 216 | $phpcsFile->fixer->addContent( |
217 | 217 | $pointerToAddAssertion, |
218 | - $phpcsFile->eolChar . $indentation . $assertion |
|
218 | + $phpcsFile->eolChar.$indentation.$assertion |
|
219 | 219 | ); |
220 | 220 | } |
221 | 221 |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | return implode( |
200 | 200 | $file->eolChar, |
201 | 201 | array_map( |
202 | - function (UseStatement $useStatement) use ($file): string { |
|
202 | + function(UseStatement $useStatement) use ($file): string { |
|
203 | 203 | $unqualifiedName = NamespaceHelper::getUnqualifiedNameFromFullyQualifiedName( |
204 | 204 | $useStatement->getFullyQualifiedTypeName(), |
205 | 205 | ); |
@@ -301,7 +301,7 @@ discard block |
||
301 | 301 | */ |
302 | 302 | private function sortUseStatements(): void |
303 | 303 | { |
304 | - uasort($this->useStatements, function (UseStatement $prevStatement, UseStatement $nextStatement) { |
|
304 | + uasort($this->useStatements, function(UseStatement $prevStatement, UseStatement $nextStatement) { |
|
305 | 305 | return $this->compareUseStatements($prevStatement, $nextStatement); |
306 | 306 | }); |
307 | 307 | } |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | * |
44 | 44 | * @var string |
45 | 45 | */ |
46 | - private const MESSAGE_WRONG_POSITION = 'Your php structure is at a wrong position. ' . |
|
46 | + private const MESSAGE_WRONG_POSITION = 'Your php structure is at a wrong position. '. |
|
47 | 47 | 'The sorting order is: T_USE, T_CONST, T_VARIABLE, T_FUNCTION. We expect a %s (%s).'; |
48 | 48 | |
49 | 49 | /** |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | */ |
95 | 95 | private function loadTokensForPositions(array $subTokenPoss): array |
96 | 96 | { |
97 | - $subTokens = array_map(function (int $position): array { |
|
97 | + $subTokens = array_map(function(int $position): array { |
|
98 | 98 | return $this->tokens[$position]; |
99 | 99 | }, $subTokenPoss); |
100 | 100 | |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | */ |
124 | 124 | private function removeUnwantedTokens(array $subTokens): array |
125 | 125 | { |
126 | - return array_filter($subTokens, function (array $subToken, int $tokenPos): bool { |
|
126 | + return array_filter($subTokens, function(array $subToken, int $tokenPos): bool { |
|
127 | 127 | switch ($subToken['code']) { |
128 | 128 | case T_VARIABLE: |
129 | 129 | $return = (new PropertyHelper($this->file))->isProperty($tokenPos); |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | */ |
151 | 151 | private function sortTokens(array $subTokens): array |
152 | 152 | { |
153 | - uasort($subTokens, function (array $leftToken, array $rightToken): int { |
|
153 | + uasort($subTokens, function(array $leftToken, array $rightToken): int { |
|
154 | 154 | // Don't change the structure by default. |
155 | 155 | $return = $leftToken['line'] <=> $rightToken['line']; |
156 | 156 |
@@ -104,7 +104,7 @@ |
||
104 | 104 | $commaPointers = TokenHelper::findNextAll($file, T_COMMA, $usePos + 1, $endPos); |
105 | 105 | foreach ($commaPointers as $commaPos) { |
106 | 106 | $pointerAfterComma = TokenHelper::findNextEffective($file, $commaPos + 1); |
107 | - $fixer->replaceToken($commaPos, ';' . $file->eolChar . $indentation . 'use '); |
|
107 | + $fixer->replaceToken($commaPos, ';'.$file->eolChar.$indentation.'use '); |
|
108 | 108 | for ($iteratedPointer = $commaPos + 1; $iteratedPointer < $pointerAfterComma; $iteratedPointer++) { |
109 | 109 | $fixer->replaceToken($iteratedPointer, ''); |
110 | 110 | } |
@@ -41,7 +41,7 @@ |
||
41 | 41 | * |
42 | 42 | * @var File|null |
43 | 43 | */ |
44 | - protected File|null $file = null; |
|
44 | + protected File | null $file = null; |
|
45 | 45 | |
46 | 46 | /** |
47 | 47 | * A list of forbidden functions with their alternatives. |
@@ -30,7 +30,7 @@ |
||
30 | 30 | $this->getFile()->fixer->addContent( |
31 | 31 | $docTagClosingPos, |
32 | 32 | sprintf( |
33 | - "\n" . str_repeat(' ', ($this->tokens[$docTagClosingPos]['level']) * 4) . '%s', |
|
33 | + "\n".str_repeat(' ', ($this->tokens[$docTagClosingPos]['level']) * 4).'%s', |
|
34 | 34 | trim($collectedAttrContent), |
35 | 35 | ), |
36 | 36 | ); |