@@ -59,7 +59,7 @@ |
||
59 | 59 | // Satisfy php md |
60 | 60 | unset($callback); |
61 | 61 | |
62 | - return $this->isValidContentInTrait($tagContent, function (array $matches): bool { |
|
62 | + return $this->isValidContentInTrait($tagContent, function(array $matches): bool { |
|
63 | 63 | return (bool) filter_var($matches['mail'], FILTER_VALIDATE_EMAIL); |
64 | 64 | }); |
65 | 65 | } |
@@ -105,7 +105,7 @@ |
||
105 | 105 | protected function processTagContent(?string $tagContent = null): void |
106 | 106 | { |
107 | 107 | if (!$this->isValidContent($tagContent)) { |
108 | - $this->getFile()->{'add' . ($this->asError() ? 'Error' : 'Warning')}(...$this->getReportData($tagContent)); |
|
108 | + $this->getFile()->{'add'.($this->asError() ? 'Error' : 'Warning')}(...$this->getReportData($tagContent)); |
|
109 | 109 | } |
110 | 110 | } |
111 | 111 | } |
@@ -22,7 +22,7 @@ |
||
22 | 22 | /** |
23 | 23 | * The message for the error. |
24 | 24 | */ |
25 | - private const MESSAGE_TAG_MISSING_DATES = 'Please provide the version since when its deprecated and when it will ' . |
|
25 | + private const MESSAGE_TAG_MISSING_DATES = 'Please provide the version since when its deprecated and when it will '. |
|
26 | 26 | 'be removed (Pattern: %s).'; |
27 | 27 | |
28 | 28 | /** |
@@ -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; |
@@ -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 | | ----- | ----------- | ------------ | |
@@ -132,7 +132,7 @@ |
||
132 | 132 | */ |
133 | 133 | private function isCheckAlreadyDone(int $mathPos): bool |
134 | 134 | { |
135 | - $checkMarker = $this->file->getFilename() . $mathPos; |
|
135 | + $checkMarker = $this->file->getFilename().$mathPos; |
|
136 | 136 | $isDone = @self::$alreadyDoneChecks[$checkMarker]; |
137 | 137 | |
138 | 138 | self::$alreadyDoneChecks[$checkMarker] = true; |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | private function isTooSimpleGetter(string $propertyName, int $methodPosition): bool |
153 | 153 | { |
154 | 154 | return $this->matchesMethodContentToRegex( |
155 | - '/return \$this->' . $propertyName . '\s*;$/m', |
|
155 | + '/return \$this->'.$propertyName.'\s*;$/m', |
|
156 | 156 | $methodPosition, |
157 | 157 | ); |
158 | 158 | } |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | $parameterName = current($parameters); |
177 | 177 | |
178 | 178 | $isTooSimpleSetter = $this->matchesMethodContentToRegex( |
179 | - '/\$this->' . $propertyName . '\s*=\s*\\' . $parameterName . '\s*;' . |
|
179 | + '/\$this->'.$propertyName.'\s*=\s*\\'.$parameterName.'\s*;'. |
|
180 | 180 | // finish with the assignment or wait for the fluent return. |
181 | 181 | '($|\s*return\s*\$this\s*;$)/m', |
182 | 182 | $methodPosition, |
@@ -224,8 +224,8 @@ discard block |
||
224 | 224 | } |
225 | 225 | |
226 | 226 | $propertyName = substr($this->tokens[$propertyPointer]['content'], 1); |
227 | - $setterPosition = $this->findMethod(self::METHOD_PREFIX_SETTER . ucfirst($propertyName)); |
|
228 | - $getterPosition = $this->findMethod(self::METHOD_PREFIX_GETTER . ucfirst($propertyName)); |
|
227 | + $setterPosition = $this->findMethod(self::METHOD_PREFIX_SETTER.ucfirst($propertyName)); |
|
228 | + $getterPosition = $this->findMethod(self::METHOD_PREFIX_GETTER.ucfirst($propertyName)); |
|
229 | 229 | |
230 | 230 | if ( |
231 | 231 | $getterPosition && $setterPosition && $this->isTooSimpleSetter($propertyName, $setterPosition) && |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | /** |
33 | 33 | * Error message for multiple returns. |
34 | 34 | */ |
35 | - private const WARNING_MULTIPLE_RETURNS_FOUND = 'Multiple returns detected. Did you refactor your method? Please ' . |
|
35 | + private const WARNING_MULTIPLE_RETURNS_FOUND = 'Multiple returns detected. Did you refactor your method? Please '. |
|
36 | 36 | 'do not use an early return if your method/function still is cluttered.'; |
37 | 37 | |
38 | 38 | /** |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | $this->token['scope_closer'], |
62 | 62 | ); |
63 | 63 | |
64 | - return array_filter($returnPositions, function (int $returnPos): bool { |
|
64 | + return array_filter($returnPositions, function(int $returnPos): bool { |
|
65 | 65 | $possibleClosure = $this->file->findPrevious([T_CLOSURE, T_FUNCTION], $returnPos - 1, $this->stackPos); |
66 | 66 | |
67 | 67 | return $possibleClosure === $this->stackPos; |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | if (count($returnPositions) > 1) { |
81 | 81 | array_shift($returnPositions); |
82 | 82 | |
83 | - array_walk($returnPositions, function (int $returnPos): void { |
|
83 | + array_walk($returnPositions, function(int $returnPos): void { |
|
84 | 84 | $this->file->addWarning( |
85 | 85 | self::WARNING_MULTIPLE_RETURNS_FOUND, |
86 | 86 | $returnPos, |