@@ -366,7 +366,7 @@ discard block |
||
366 | 366 | $count = \count($parts); |
367 | 367 | |
368 | 368 | if ($count > $expected) { |
369 | - $this->tokens[$index] = new Token([T_WHITESPACE, implode('', \array_slice($parts, 0, $expected)).rtrim($parts[$count - 1], "\r\n")]); |
|
369 | + $this->tokens[$index] = new Token([T_WHITESPACE, implode('', \array_slice($parts, 0, $expected)) . rtrim($parts[$count - 1], "\r\n")]); |
|
370 | 370 | } |
371 | 371 | } |
372 | 372 | |
@@ -444,7 +444,7 @@ discard block |
||
444 | 444 | |
445 | 445 | $pos = strrpos($content, "\n"); |
446 | 446 | if ($pos + 2 <= \strlen($content)) { // preserve indenting where possible |
447 | - $newContent = $ending.substr($content, $pos + 1); |
|
447 | + $newContent = $ending . substr($content, $pos + 1); |
|
448 | 448 | } else { |
449 | 449 | $newContent = $ending; |
450 | 450 | } |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | $indent = $this->indent; |
102 | 102 | |
103 | 103 | // change indent to expected one |
104 | - $content = Preg::replaceCallback('/^(?: )+/m', function (array $matches) use ($indent) { |
|
104 | + $content = Preg::replaceCallback('/^(?: )+/m', function(array $matches) use ($indent) { |
|
105 | 105 | return $this->getExpectedIndent($matches[0], $indent); |
106 | 106 | }, $content); |
107 | 107 | |
@@ -115,19 +115,19 @@ discard block |
||
115 | 115 | |
116 | 116 | // @TODO this can be removed when we have a transformer for "T_OPEN_TAG" to "T_OPEN_TAG + T_WHITESPACE" |
117 | 117 | if (false !== strpos($tokens[$index - 1]->getContent(), "\n")) { |
118 | - $content = "\n".$content; |
|
118 | + $content = "\n" . $content; |
|
119 | 119 | $previousTokenHasTrailingLinebreak = true; |
120 | 120 | } |
121 | 121 | |
122 | 122 | $indent = $this->indent; |
123 | 123 | $newContent = Preg::replaceCallback( |
124 | 124 | '/(\R)(\h+)/', // find indent |
125 | - function (array $matches) use ($indent) { |
|
125 | + function(array $matches) use ($indent) { |
|
126 | 126 | // normalize mixed indent |
127 | 127 | $content = Preg::replace('/(?:(?<! ) {1,3})?\t/', ' ', $matches[2]); |
128 | 128 | |
129 | 129 | // change indent to expected one |
130 | - return $matches[1].$this->getExpectedIndent($content, $indent); |
|
130 | + return $matches[1] . $this->getExpectedIndent($content, $indent); |
|
131 | 131 | }, |
132 | 132 | $content |
133 | 133 | ); |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | |
89 | 89 | $expectedIndent = $this->getExpectedIndentAt($tokens, $index); |
90 | 90 | if ($currentIndent !== $expectedIndent) { |
91 | - $tokens[$index - 1] = new Token([T_WHITESPACE, $lineEnding.$expectedIndent]); |
|
91 | + $tokens[$index - 1] = new Token([T_WHITESPACE, $lineEnding . $expectedIndent]); |
|
92 | 92 | } |
93 | 93 | } |
94 | 94 | } |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | } |
113 | 113 | |
114 | 114 | if ($this->currentLineRequiresExtraIndentLevel($tokens, $i, $index)) { |
115 | - return $currentIndent.$indent; |
|
115 | + return $currentIndent . $indent; |
|
116 | 116 | } |
117 | 117 | |
118 | 118 | return $currentIndent; |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | $content = $tokens[$index]->getContent(); |
166 | 166 | |
167 | 167 | if ($tokens[$index]->isWhitespace() && $tokens[$index - 1]->isGivenKind(T_OPEN_TAG)) { |
168 | - $content = $tokens[$index - 1]->getContent().$content; |
|
168 | + $content = $tokens[$index - 1]->getContent() . $content; |
|
169 | 169 | } |
170 | 170 | |
171 | 171 | if (Preg::match('/\R/', $content)) { |
@@ -75,7 +75,7 @@ |
||
75 | 75 | && 1 === Preg::match('/(.*)\h$/', $token->getContent(), $openTagMatches) |
76 | 76 | && 1 === Preg::match('/^(\R)(.*)$/s', $tokens[$index + 1]->getContent(), $whitespaceMatches) |
77 | 77 | ) { |
78 | - $tokens[$index] = new Token([T_OPEN_TAG, $openTagMatches[1].$whitespaceMatches[1]]); |
|
78 | + $tokens[$index] = new Token([T_OPEN_TAG, $openTagMatches[1] . $whitespaceMatches[1]]); |
|
79 | 79 | if ('' === $whitespaceMatches[2]) { |
80 | 80 | $tokens->clearAt($index + 1); |
81 | 81 | } else { |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | continue; |
74 | 74 | } |
75 | 75 | |
76 | - [$previousUnset, , $previousUnsetBraceEnd] = $previousUnsetCall; |
|
76 | + [$previousUnset,, $previousUnsetBraceEnd] = $previousUnsetCall; |
|
77 | 77 | |
78 | 78 | // Merge the tokens inside the 'unset' call into the previous one 'unset' call. |
79 | 79 | $tokensAddCount = $this->moveTokens( |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | $added = 0; |
177 | 177 | for ($i = $start + 1; $i < $end; $i += 2) { |
178 | 178 | if ($tokens[$i]->isWhitespace() && $tokens[$to + 1]->isWhitespace()) { |
179 | - $tokens[$to + 1] = new Token([T_WHITESPACE, $tokens[$to + 1]->getContent().$tokens[$i]->getContent()]); |
|
179 | + $tokens[$to + 1] = new Token([T_WHITESPACE, $tokens[$to + 1]->getContent() . $tokens[$i]->getContent()]); |
|
180 | 180 | } else { |
181 | 181 | $tokens->insertAt(++$to, clone $tokens[$i]); |
182 | 182 | ++$end; |
@@ -36,9 +36,9 @@ |
||
36 | 36 | 'Properties should be set to `null` instead of using `unset`.', |
37 | 37 | [new CodeSample("<?php\nunset(\$this->a);\n")], |
38 | 38 | null, |
39 | - 'Risky when relying on attributes to be removed using `unset` rather than be set to `null`.'. |
|
40 | - ' Changing variables to `null` instead of unsetting means these still show up when looping over class variables'. |
|
41 | - ' and reference properties remain unbroken.'. |
|
39 | + 'Risky when relying on attributes to be removed using `unset` rather than be set to `null`.' . |
|
40 | + ' Changing variables to `null` instead of unsetting means these still show up when looping over class variables' . |
|
41 | + ' and reference properties remain unbroken.' . |
|
42 | 42 | ' With PHP 7.4, this rule might introduce `null` assignments to properties whose type declaration does not allow it.' |
43 | 43 | ); |
44 | 44 | } |
@@ -116,7 +116,7 @@ |
||
116 | 116 | protected function applyFix(\SplFileInfo $file, Tokens $tokens): void |
117 | 117 | { |
118 | 118 | $functionsAnalyzer = new FunctionsAnalyzer(); |
119 | - $excludedFunctions = array_map(static function (string $function) { |
|
119 | + $excludedFunctions = array_map(static function(string $function) { |
|
120 | 120 | return strtolower($function); |
121 | 121 | }, $this->configuration[self::OPTION_NOISE_REMAINING_USAGES_EXCLUDE]); |
122 | 122 |
@@ -137,7 +137,7 @@ |
||
137 | 137 | $braceOpenCount = 1; |
138 | 138 | $meaningfulTokenIndexes = [$openIndex]; |
139 | 139 | |
140 | - for ($i = $openIndex + 1;; ++$i) { |
|
140 | + for ($i = $openIndex + 1; ; ++$i) { |
|
141 | 141 | if ($tokens[$i]->isWhitespace() || $tokens[$i]->isComment()) { |
142 | 142 | continue; |
143 | 143 | } |
@@ -124,19 +124,19 @@ discard block |
||
124 | 124 | if ($tokens[$index]->isGivenKind(CT::T_GROUP_IMPORT_BRACE_OPEN)) { |
125 | 125 | $groupEndIndex = $tokens->findBlockEnd(Tokens::BLOCK_TYPE_GROUP_IMPORT_BRACE, $index); |
126 | 126 | $groupImports = array_map( |
127 | - static function (string $import) { |
|
127 | + static function(string $import) { |
|
128 | 128 | return trim($import); |
129 | 129 | }, |
130 | 130 | explode(',', $tokens->generatePartialCode($index + 1, $groupEndIndex - 1)) |
131 | 131 | ); |
132 | 132 | foreach ($groupImports as $groupImport) { |
133 | - $groupImportParts = array_map(static function (string $import) { |
|
133 | + $groupImportParts = array_map(static function(string $import) { |
|
134 | 134 | return trim($import); |
135 | 135 | }, explode(' as ', $groupImport)); |
136 | 136 | if (2 === \count($groupImportParts)) { |
137 | - $this->imports[$groupImportParts[1]] = $import.$groupImportParts[0]; |
|
137 | + $this->imports[$groupImportParts[1]] = $import . $groupImportParts[0]; |
|
138 | 138 | } else { |
139 | - $this->imports[] = $import.$groupImport; |
|
139 | + $this->imports[] = $import . $groupImport; |
|
140 | 140 | } |
141 | 141 | } |
142 | 142 | } elseif ($tokens[$index]->isGivenKind(T_AS)) { |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | |
224 | 224 | $tokens->insertAt($classBeginIndex, new Token([ |
225 | 225 | T_CONSTANT_ENCAPSED_STRING, |
226 | - "'".$this->makeClassFQN($namespacePrefix, $classImport, $classString)."'", |
|
226 | + "'" . $this->makeClassFQN($namespacePrefix, $classImport, $classString) . "'", |
|
227 | 227 | ])); |
228 | 228 | } |
229 | 229 | |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | private function makeClassFQN(string $namespacePrefix, $classImport, string $classString): string |
234 | 234 | { |
235 | 235 | if (false === $classImport) { |
236 | - return ('' !== $namespacePrefix ? ($namespacePrefix.'\\') : '').$classString; |
|
236 | + return ('' !== $namespacePrefix ? ($namespacePrefix . '\\') : '') . $classString; |
|
237 | 237 | } |
238 | 238 | |
239 | 239 | $classStringArray = explode('\\', $classString); |