@@ 160-175 (lines=16) @@ | ||
157 | } |
|
158 | ||
159 | ||
160 | private function fixSpacesFromNamespaceToUseStatements(int $position, int $linesToNextUse) |
|
161 | { |
|
162 | $nextLinePosition = WhitespaceFinder::findNextEmptyLinePosition($this->file, $position); |
|
163 | ||
164 | if ($linesToNextUse < $this->emptyLinesBeforeUseStatement) { |
|
165 | for ($i = $linesToNextUse; $i < $this->emptyLinesBeforeUseStatement; $i++) { |
|
166 | $this->file->fixer->addContent($nextLinePosition, PHP_EOL); |
|
167 | } |
|
168 | ||
169 | } else { |
|
170 | for ($i = $linesToNextUse; $i > $this->emptyLinesBeforeUseStatement; $i--) { |
|
171 | $this->file->fixer->replaceToken($nextLinePosition, ''); |
|
172 | $nextLinePosition = WhitespaceFinder::findNextEmptyLinePosition($this->file, $nextLinePosition); |
|
173 | } |
|
174 | } |
|
175 | } |
|
176 | ||
177 | ||
178 | private function fixSpacesFromNamespaceToClass(int $position, int $linesToClass) |
|
@@ 178-192 (lines=15) @@ | ||
175 | } |
|
176 | ||
177 | ||
178 | private function fixSpacesFromNamespaceToClass(int $position, int $linesToClass) |
|
179 | { |
|
180 | $nextLinePosition = WhitespaceFinder::findNextEmptyLinePosition($this->file, $position); |
|
181 | if ($linesToClass < $this->emptyLinesAfterNamespace) { |
|
182 | for ($i = $linesToClass; $i < $this->emptyLinesAfterNamespace; $i++) { |
|
183 | $this->file->fixer->addContent($nextLinePosition, PHP_EOL); |
|
184 | } |
|
185 | ||
186 | } else { |
|
187 | for ($i = $linesToClass; $i > $this->emptyLinesAfterNamespace; $i--) { |
|
188 | $this->file->fixer->replaceToken($nextLinePosition, ''); |
|
189 | $nextLinePosition = WhitespaceFinder::findNextEmptyLinePosition($this->file, $nextLinePosition); |
|
190 | } |
|
191 | } |
|
192 | } |
|
193 | ||
194 | ||
195 | private function fixSpacesFromUseStatementToClass(int $position, int $linesToClass) |
|
@@ 195-209 (lines=15) @@ | ||
192 | } |
|
193 | ||
194 | ||
195 | private function fixSpacesFromUseStatementToClass(int $position, int $linesToClass) |
|
196 | { |
|
197 | if ($linesToClass < $this->emptyLinesAfterNamespace) { |
|
198 | for ($i = $linesToClass; $i < $this->emptyLinesAfterNamespace; $i++) { |
|
199 | $this->file->fixer->addContent($position, PHP_EOL); |
|
200 | } |
|
201 | ||
202 | } else { |
|
203 | $nextLinePosition = WhitespaceFinder::findNextEmptyLinePosition($this->file, $position); |
|
204 | for ($i = $linesToClass; $i > $this->emptyLinesAfterNamespace; $i--) { |
|
205 | $this->file->fixer->replaceToken($nextLinePosition, ''); |
|
206 | $nextLinePosition = WhitespaceFinder::findNextEmptyLinePosition($this->file, $nextLinePosition); |
|
207 | } |
|
208 | } |
|
209 | } |
|
210 | ||
211 | } |
|
212 |