@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | private function checkForFluentSetterErrors(File $phpcsFile, int $functionPos, int $classPos): void |
111 | 111 | { |
112 | 112 | $tokens = $phpcsFile->getTokens(); |
113 | - $errorData = $phpcsFile->getDeclarationName($classPos) . '::' . $phpcsFile->getDeclarationName($functionPos); |
|
113 | + $errorData = $phpcsFile->getDeclarationName($classPos).'::'.$phpcsFile->getDeclarationName($functionPos); |
|
114 | 114 | |
115 | 115 | $functionToken = $tokens[$functionPos]; |
116 | 116 | $openBracePtr = $functionToken['scope_opener']; |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | |
227 | 227 | $phpcsFile->fixer->beginChangeset(); |
228 | 228 | $phpcsFile->fixer->addNewlineBefore($closingBracePtr - 1); |
229 | - $phpcsFile->fixer->addContentBefore($closingBracePtr - 1, $expectedReturnSpaces . 'return $this;'); |
|
229 | + $phpcsFile->fixer->addContentBefore($closingBracePtr - 1, $expectedReturnSpaces.'return $this;'); |
|
230 | 230 | $phpcsFile->fixer->addNewlineBefore($closingBracePtr - 1); |
231 | 231 | $phpcsFile->fixer->endChangeset(); |
232 | 232 | } |
@@ -2,7 +2,7 @@ discard block |
||
2 | 2 | |
3 | 3 | declare(strict_types=1); |
4 | 4 | |
5 | -require_once __DIR__ . '/../vendor/autoload.php'; |
|
5 | +require_once __DIR__.'/../vendor/autoload.php'; |
|
6 | 6 | |
7 | 7 | $directory = new RecursiveDirectoryIterator($baseFolder = './src/Standards/BestIt/Sniffs'); |
8 | 8 | $iterator = new RecursiveIteratorIterator($directory); |
@@ -74,8 +74,8 @@ discard block |
||
74 | 74 | foreach ($regexIterator as $file) { |
75 | 75 | [$file] = $file; |
76 | 76 | |
77 | - $simpleClassName = str_replace([$baseFolder . DIRECTORY_SEPARATOR, '.php', 'Sniff'], '', $file); |
|
78 | - $fullQualifiedClassName = 'BestIt\\Sniffs\\' . str_replace('/', '\\', $simpleClassName) . 'Sniff'; |
|
77 | + $simpleClassName = str_replace([$baseFolder.DIRECTORY_SEPARATOR, '.php', 'Sniff'], '', $file); |
|
78 | + $fullQualifiedClassName = 'BestIt\\Sniffs\\'.str_replace('/', '\\', $simpleClassName).'Sniff'; |
|
79 | 79 | |
80 | 80 | $hasSuppresses = (bool) preg_match_all( |
81 | 81 | '/->isSniffSuppressed\((?P<code>\s*.*\s*)\)/mU', |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | ksort($codes); |
146 | 146 | |
147 | 147 | file_put_contents( |
148 | - $tmpFile = __DIR__ . DIRECTORY_SEPARATOR . 'table.md', |
|
148 | + $tmpFile = __DIR__.DIRECTORY_SEPARATOR.'table.md', |
|
149 | 149 | <<<EOD |
150 | 150 | | Sniff | Description | suppressable | |
151 | 151 | | ----- | ----------- | ------------ | |
@@ -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 ($i = $commaPos + 1; $i < $pointerAfterComma; $i++) { |
109 | 109 | $fixer->replaceToken($i, ''); |
110 | 110 | } |
@@ -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 | } |
@@ -120,7 +120,7 @@ |
||
120 | 120 | /** |
121 | 121 | * Returns the position of the summary or null. |
122 | 122 | * |
123 | - * @return int|null |
|
123 | + * @return integer |
|
124 | 124 | */ |
125 | 125 | private function getSummaryPosition(): ?int |
126 | 126 | { |
@@ -111,7 +111,7 @@ |
||
111 | 111 | |
112 | 112 | $this->file->fixer->addContent( |
113 | 113 | $position, |
114 | - $this->file->eolChar . str_repeat(' ', $token['level']) . ' *' |
|
114 | + $this->file->eolChar.str_repeat(' ', $token['level']).' *' |
|
115 | 115 | ); |
116 | 116 | |
117 | 117 | $this->file->fixer->endChangeset(); |
@@ -73,7 +73,7 @@ |
||
73 | 73 | /** |
74 | 74 | * Default method for fixing exceptions. |
75 | 75 | * |
76 | - * @param CodeWarning $exception |
|
76 | + * @param CodeError $exception |
|
77 | 77 | * |
78 | 78 | * @return void |
79 | 79 | */ |
@@ -4,7 +4,6 @@ |
||
4 | 4 | |
5 | 5 | namespace BestIt\Sniffs\DocTags; |
6 | 6 | |
7 | -use BestIt\CodeSniffer\Helper\TokenHelper; |
|
8 | 7 | use function array_column; |
9 | 8 | use function array_map; |
10 | 9 | use function implode; |
@@ -230,27 +230,27 @@ discard block |
||
230 | 230 | |
231 | 231 | // Insert new line between groups. |
232 | 232 | if ($isGroupSwitch) { |
233 | - $newContent .= $lineStartingPadding . '*' . $eolChar; |
|
233 | + $newContent .= $lineStartingPadding.'*'.$eolChar; |
|
234 | 234 | } |
235 | 235 | |
236 | 236 | // Create the new Tag. |
237 | 237 | // WARNING We do not need a line break in the tag summary. |
238 | - $newContent .= $lineStartingPadding . '* ' . trim($thisTagContent); |
|
238 | + $newContent .= $lineStartingPadding.'* '.trim($thisTagContent); |
|
239 | 239 | |
240 | 240 | if ($tag['contents']) { |
241 | 241 | $prevLine = $tag['line']; |
242 | 242 | foreach ($tag['contents'] as $subToken) { |
243 | 243 | // If we have a line switch, we need to create the correct indentation from before ... |
244 | 244 | if ($withLineSwitch = $subToken['line'] > $prevLine) { |
245 | - $newContent .= $eolChar . |
|
246 | - $lineStartingPadding . '*' . |
|
245 | + $newContent .= $eolChar. |
|
246 | + $lineStartingPadding.'*'. |
|
247 | 247 | str_repeat(' ', $subToken['column'] - strlen($lineStartingPadding) - 2); |
248 | 248 | |
249 | 249 | $prevLine = $subToken['line']; |
250 | 250 | } |
251 | 251 | |
252 | 252 | // ... if we have no line switch, then an additional whitespace is enough. |
253 | - $newContent .= ($withLineSwitch ? '' : ' ') . $subToken['content']; |
|
253 | + $newContent .= ($withLineSwitch ? '' : ' ').$subToken['content']; |
|
254 | 254 | } |
255 | 255 | } |
256 | 256 | |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | $withReturn = $isReturn; |
261 | 261 | } |
262 | 262 | |
263 | - $newContent .= $lineStartingPadding . '*/' . $eolChar; |
|
263 | + $newContent .= $lineStartingPadding.'*/'.$eolChar; |
|
264 | 264 | |
265 | 265 | return $newContent; |
266 | 266 | } |
@@ -332,7 +332,7 @@ discard block |
||
332 | 332 | |
333 | 333 | $fixer->addContentBefore( |
334 | 334 | $token['pointer'], |
335 | - $this->file->eolChar . $lineStartPadding . '* ' |
|
335 | + $this->file->eolChar.$lineStartPadding.'* ' |
|
336 | 336 | ); |
337 | 337 | |
338 | 338 | $fixer->endChangeset(); |
@@ -348,7 +348,7 @@ discard block |
||
348 | 348 | $barrier = 0; |
349 | 349 | $tokens = $this->docTagHelper->getTagTokens(); |
350 | 350 | |
351 | - $tokens = array_filter($tokens, function (array $token) use (&$barrier): bool { |
|
351 | + $tokens = array_filter($tokens, function(array $token) use (&$barrier): bool { |
|
352 | 352 | $allowed = true; |
353 | 353 | |
354 | 354 | if ($barrier) { |
@@ -443,7 +443,7 @@ discard block |
||
443 | 443 | { |
444 | 444 | $tagCounts = $this->docTagHelper->getTagCounts($tokens); |
445 | 445 | |
446 | - usort($tokens, function (array $leftToken, array $rightToken) use ($tagCounts): int { |
|
446 | + usort($tokens, function(array $leftToken, array $rightToken) use ($tagCounts): int { |
|
447 | 447 | return $this->compareTokensForSorting($leftToken, $rightToken, $tagCounts); |
448 | 448 | }); |
449 | 449 |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | $tokenIdent = $this->getTokenName(); |
100 | 100 | |
101 | 101 | throw (new CodeError( |
102 | - static::CODE_MISSING_DOC_BLOCK_PREFIX . ucfirst($tokenIdent), |
|
102 | + static::CODE_MISSING_DOC_BLOCK_PREFIX.ucfirst($tokenIdent), |
|
103 | 103 | self::MESSAGE_MISSING_DOC_BLOCK, |
104 | 104 | $this->stackPos |
105 | 105 | ))->setPayload([lcfirst($tokenIdent)]); |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | $tokenIdent = $this->getTokenName(); |
124 | 124 | |
125 | 125 | $exception = (new CodeError( |
126 | - static::CODE_NO_MULTI_LINE_DOC_BLOCK_PREFIX . ucfirst($tokenIdent), |
|
126 | + static::CODE_NO_MULTI_LINE_DOC_BLOCK_PREFIX.ucfirst($tokenIdent), |
|
127 | 127 | self::MESSAGE_NO_MULTI_LINE_DOC_BLOCK_PREFIX, |
128 | 128 | $docCommentPos |
129 | 129 | ))->setPayload([lcfirst($tokenIdent)]); |