@@ -87,7 +87,7 @@ |
||
87 | 87 | /** |
88 | 88 | * Loads the tokens for the positions. |
89 | 89 | * |
90 | - * @param array $subTokenPoss |
|
90 | + * @param integer[] $subTokenPoss |
|
91 | 91 | * |
92 | 92 | * @return array |
93 | 93 | */ |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | * |
43 | 43 | * @var string |
44 | 44 | */ |
45 | - private const MESSAGE_WRONG_POSITION = 'Your php structure is at a wrong position. ' . |
|
45 | + private const MESSAGE_WRONG_POSITION = 'Your php structure is at a wrong position. '. |
|
46 | 46 | 'The sorting order is: T_USE, T_CONST, T_VARIABLE, T_FUNCTION. We expect a %s (%s).'; |
47 | 47 | |
48 | 48 | /** |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | */ |
94 | 94 | private function loadTokensForPositions(array $subTokenPoss): array |
95 | 95 | { |
96 | - $subTokens = array_map(function (int $position): array { |
|
96 | + $subTokens = array_map(function(int $position): array { |
|
97 | 97 | return $this->tokens[$position]; |
98 | 98 | }, $subTokenPoss); |
99 | 99 | |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | */ |
123 | 123 | private function removeUnwantedTokens(array $subTokens): array |
124 | 124 | { |
125 | - return array_filter($subTokens, function (array $subToken): bool { |
|
125 | + return array_filter($subTokens, function(array $subToken): bool { |
|
126 | 126 | switch ($subToken['code']) { |
127 | 127 | case T_VARIABLE: |
128 | 128 | $return = (new PropertyHelper($this->file))->isProperty($subToken['pointer']); |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | */ |
162 | 162 | private function sortTokens(array $subTokens): array |
163 | 163 | { |
164 | - uasort($subTokens, function (array $leftToken, array $rightToken): int { |
|
164 | + uasort($subTokens, function(array $leftToken, array $rightToken): int { |
|
165 | 165 | // Don't change the structure by default. |
166 | 166 | $return = $leftToken['line'] <=> $rightToken['line']; |
167 | 167 |
@@ -35,7 +35,7 @@ |
||
35 | 35 | /** |
36 | 36 | * The message for the mixed type warning. |
37 | 37 | */ |
38 | - private const MESSAGE_MIXED_TYPE = 'We suggest that you avoid the "mixed" type and declare the ' . |
|
38 | + private const MESSAGE_MIXED_TYPE = 'We suggest that you avoid the "mixed" type and declare the '. |
|
39 | 39 | 'required types in detail.'; |
40 | 40 | |
41 | 41 | /** |
@@ -45,7 +45,7 @@ |
||
45 | 45 | ); |
46 | 46 | |
47 | 47 | if ($sniffName) { |
48 | - $sniffClassName .= '.' . $sniffName; |
|
48 | + $sniffClassName .= '.'.$sniffName; |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | return $sniffClassName; |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | array_walk( |
87 | 87 | $allTags, |
88 | 88 | // TODO: Removed Duplicates |
89 | - function (array $tag, int $tagPos) use (&$checkedTags, $tagRules): void { |
|
89 | + function(array $tag, int $tagPos) use (&$checkedTags, $tagRules): void { |
|
90 | 90 | $tagContent = substr($tag['content'], 1); |
91 | 91 | |
92 | 92 | if (!in_array($tagContent, $checkedTags)) { |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | $tagPos, |
102 | 102 | // We use an error code containing the tag name because we can't configure this rules from |
103 | 103 | // the outside and need specific code to exclude the rule for this special tag. |
104 | - static::CODE_TAG_OCCURRENCE_MAX_PREFIX . ucfirst($tagContent), |
|
104 | + static::CODE_TAG_OCCURRENCE_MAX_PREFIX.ucfirst($tagContent), |
|
105 | 105 | [ |
106 | 106 | $tagContent, |
107 | 107 | $maxCount, |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | |
127 | 127 | array_walk( |
128 | 128 | $rulesWithReq, |
129 | - function (array $tagRule, string $tag) use ($checkedRule): void { |
|
129 | + function(array $tagRule, string $tag) use ($checkedRule): void { |
|
130 | 130 | $minCount = $tagRule[$checkedRule]; |
131 | 131 | $tagCount = count($this->findTokensForTag($tag)); |
132 | 132 | |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | $this->getDocCommentPos(), |
137 | 137 | // We use an error code containing the tag name because we can't configure this rules from the |
138 | 138 | // outside and need specific code to exclude the rule for this special tag. |
139 | - static::CODE_TAG_OCCURRENCE_MIN_PREFIX . ucfirst($tag), |
|
139 | + static::CODE_TAG_OCCURRENCE_MIN_PREFIX.ucfirst($tag), |
|
140 | 140 | [ |
141 | 141 | $tag, |
142 | 142 | $minCount, |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | { |
160 | 160 | $allTags = $this->getAllTags(); |
161 | 161 | |
162 | - return array_filter($allTags, function (array $tag) use ($tagName): bool { |
|
162 | + return array_filter($allTags, function(array $tag) use ($tagName): bool { |
|
163 | 163 | return substr($tag['content'], 1) === $tagName; |
164 | 164 | }); |
165 | 165 | } |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | { |
204 | 204 | $processedTagRules = $this->getProcessedTagRules(); |
205 | 205 | |
206 | - $processedTagRules = array_filter($processedTagRules, function (array $tagRule) use ($requiredRule): bool { |
|
206 | + $processedTagRules = array_filter($processedTagRules, function(array $tagRule) use ($requiredRule): bool { |
|
207 | 207 | return array_key_exists($requiredRule, $tagRule); |
208 | 208 | }); |
209 | 209 | return $processedTagRules; |
@@ -242,8 +242,8 @@ discard block |
||
242 | 242 | { |
243 | 243 | $processedTagRules = $this->getTagRules(); |
244 | 244 | |
245 | - array_walk($processedTagRules, function (&$tagRule) { |
|
246 | - $tagRule = array_map(function ($valueOrCallback) { |
|
245 | + array_walk($processedTagRules, function(&$tagRule) { |
|
246 | + $tagRule = array_map(function($valueOrCallback) { |
|
247 | 247 | return is_callable($valueOrCallback, true) |
248 | 248 | ? Closure::fromCallable($valueOrCallback)->call($this) |
249 | 249 | : $valueOrCallback; |
@@ -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 | } |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | $tokenIdent = $this->getTokenName(); |
89 | 89 | |
90 | 90 | $exception = (new CodeError( |
91 | - static::CODE_MISSING_DOC_BLOCK_PREFIX . ucfirst($tokenIdent), |
|
91 | + static::CODE_MISSING_DOC_BLOCK_PREFIX.ucfirst($tokenIdent), |
|
92 | 92 | self::MESSAGE_MISSING_DOC_BLOCK, |
93 | 93 | $this->stackPos |
94 | 94 | ))->setPayload([lcfirst($tokenIdent)]); |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | $tokenIdent = $this->getTokenName(); |
115 | 115 | |
116 | 116 | $exception = (new CodeError( |
117 | - static::CODE_NO_MULTI_LINE_DOC_BLOCK_PREFIX . ucfirst($tokenIdent), |
|
117 | + static::CODE_NO_MULTI_LINE_DOC_BLOCK_PREFIX.ucfirst($tokenIdent), |
|
118 | 118 | self::MESSAGE_NO_MULTI_LINE_DOC_BLOCK_PREFIX, |
119 | 119 | $docCommentPos |
120 | 120 | ))->setPayload([lcfirst($tokenIdent)]); |
@@ -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 | | ----- | ----------- | ------------ | |