Passed
Pull Request — master (#77)
by Björn
02:32
created
src/Standards/BestIt/Sniffs/DocTags/ReturnTagSniff.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@
 block discarded – undo
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
     /**
Please login to merge, or discard this patch.
src/Standards/BestIt/Sniffs/SuppressingTrait.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@
 block discarded – undo
45 45
         );
46 46
 
47 47
         if ($sniffName) {
48
-            $sniffClassName .= '.' . $sniffName;
48
+            $sniffClassName .= '.'.$sniffName;
49 49
         }
50 50
 
51 51
         return $sniffClassName;
Please login to merge, or discard this patch.
src/Standards/BestIt/Sniffs/DocTags/AbstractRequiredTagsSniff.php 2 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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;
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -232,7 +232,7 @@
 block discarded – undo
232 232
      * @param string $rule
233 233
      * @param string $tag
234 234
      *
235
-     * @return bool|string
235
+     * @return string|false
236 236
      */
237 237
     private function hasFixCallback(string $rule, string $tag)
238 238
     {
Please login to merge, or discard this patch.
src/Standards/BestIt/Sniffs/Functions/FluentSetterSniff.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
     }
Please login to merge, or discard this patch.
build/refreshReadmeTable.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 | ----- | ----------- | ------------ |
Please login to merge, or discard this patch.
src/Standards/BestIt/Sniffs/DocTags/TagSortingSniff.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
     /**
152 152
      * The callback to sort tokens.
153 153
      *
154
-     * 1. @return goes to the bottom
154
+     * 1. @return integer to the bottom
155 155
      * 2. Single tags are group alphabetically in the top group.
156 156
      * 3. Groups are sorted then by occurrence, that the largest group is the last one before the return.
157 157
      * 4. Same annotations are kept in the order of their code.
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
      * @param array $rightToken Provided by usort.
161 161
      * @param array $tagCounts Saves the occurence count for every tag.
162 162
      *
163
-     * @return int
163
+     * @return integer
164 164
      */
165 165
     private function compareTokensForSorting(array $leftToken, array $rightToken, array $tagCounts): int
166 166
     {
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -230,27 +230,27 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
332 332
 
333 333
         $fixer->addContentBefore(
334 334
             $token['pointer'],
335
-            $this->file->getEolChar() . $lineStartPadding . '* '
335
+            $this->file->getEolChar().$lineStartPadding.'* '
336 336
         );
337 337
 
338 338
         $fixer->endChangeset();
@@ -348,7 +348,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
src/Standards/BestIt/Sniffs/Formatting/TraitUseDeclarationSniff.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -104,7 +104,7 @@
 block discarded – undo
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
             }
Please login to merge, or discard this patch.
src/Standards/BestIt/Sniffs/Formatting/AlphabeticallySortedUsesSniff.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
     }
Please login to merge, or discard this patch.
src/Standards/BestIt/Sniffs/Commenting/RequiredDocBlockSniff.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -94,13 +94,13 @@  discard block
 block discarded – undo
94 94
 
95 95
             if ($tokenIdent == $this->registeredTokens[T_VARIABLE]) {
96 96
                 $exception = (new CodeError(
97
-                    static::CODE_MISSING_DOC_BLOCK_PREFIX . ucfirst($tokenIdent),
97
+                    static::CODE_MISSING_DOC_BLOCK_PREFIX.ucfirst($tokenIdent),
98 98
                     self::MESSAGE_MISSING_DOC_BLOCK_VAR,
99 99
                     $this->stackPos
100 100
                 ))->setPayload([lcfirst($tokenIdent)]);
101 101
             } else {
102 102
                 $exception = (new CodeError(
103
-                    static::CODE_MISSING_DOC_BLOCK_PREFIX . ucfirst($tokenIdent),
103
+                    static::CODE_MISSING_DOC_BLOCK_PREFIX.ucfirst($tokenIdent),
104 104
                     self::MESSAGE_MISSING_DOC_BLOCK,
105 105
                     $this->stackPos
106 106
                 ))->setPayload([lcfirst($tokenIdent)]);
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
             $tokenIdent = $this->getTokenName();
128 128
 
129 129
             $exception = (new CodeError(
130
-                static::CODE_NO_MULTI_LINE_DOC_BLOCK_PREFIX . ucfirst($tokenIdent),
130
+                static::CODE_NO_MULTI_LINE_DOC_BLOCK_PREFIX.ucfirst($tokenIdent),
131 131
                 self::MESSAGE_NO_MULTI_LINE_DOC_BLOCK_PREFIX,
132 132
                 $docCommentPos
133 133
             ))->setPayload([lcfirst($tokenIdent)]);
Please login to merge, or discard this patch.