1414class Fixer
1515{
1616 /**
17- * The number of times we have looped over a file.
18- *
1917 * @var int
2018 */
2119 protected $ loops = 0 ;
2220
2321 /**
24- * The character used when we are adding new lines.
25- *
2622 * @var string
2723 */
2824 protected $ eolChar = "\n" ;
@@ -40,19 +36,19 @@ class Fixer
4036 /**
4137 * The list of tokens that make up the file contents.
4238 *
43- * This is a simplified list which just contains the token content and nothing
44- * else. This is the array that is updated as fixes are made, not the file's
45- * token array. Imploding this array will give you the file content back.
39+ * This is a simplified list which just contains the token content and nothing else.
40+ * This is the array that is updated as fixes are made, not the file's token array.
41+ * Imploding this array will give you the file content back.
4642 *
47- * @var array<int, string>
43+ * @var array
4844 */
4945 protected $ tokens = [];
5046
5147 /**
5248 * A list of tokens that have already been fixed.
5349 *
54- * We don't allow the same token to be fixed more than once each time
55- * through a file as this can easily cause conflicts between sniffs.
50+ * We don't allow the same token to be fixed more than once each time through a file
51+ * as this can easily cause conflicts between sniffs.
5652 *
5753 * @var int[]
5854 */
@@ -61,18 +57,16 @@ class Fixer
6157 /**
6258 * The last value of each fixed token.
6359 *
64- * If a token is being "fixed" back to its last value, the fix is
65- * probably conflicting with another.
60+ * If a token is being "fixed" back to its last value, the fix is probably conflicting with another.
6661 *
67- * @var array<int, string>
62+ * @var array
6863 */
6964 protected $ oldTokenValues = [];
7065
7166 /**
7267 * A list of tokens that have been fixed during a changeset.
7368 *
74- * All changes in changeset must be able to be applied, or else
75- * the entire changeset is rejected.
69+ * All changes in changeset must be able to be applied, or else the entire changeset is rejected.
7670 *
7771 * @var array
7872 */
@@ -100,8 +94,6 @@ class Fixer
10094 protected $ numFixes = 0 ;
10195
10296 /**
103- * Starts fixing a new file.
104- *
10597 * @param Ruleset $ruleset
10698 * @param Tokenizer $tokenizer
10799 *
@@ -134,8 +126,6 @@ public function startFile(array $tokens): void
134126 }
135127
136128 /**
137- * Attempt to fix the file by processing it until no fixes are made.
138- *
139129 * @param string $file
140130 *
141131 * @return bool
@@ -181,8 +171,6 @@ public function fixFile(string $file): bool
181171 }
182172
183173 /**
184- * Generates a text diff of the original file and the new content.
185- *
186174 * @param string $filePath File path to diff the file against.
187175 *
188176 * @return string
@@ -242,8 +230,6 @@ public function generateDiff(string $filePath): string
242230 }
243231
244232 /**
245- * Get the current content of the file, as a string.
246- *
247233 * @return string
248234 */
249235 public function getContents (): string
@@ -254,12 +240,10 @@ public function getContents(): string
254240 }
255241
256242 /**
257- * Get the current fixed content of a token.
258- *
259243 * This function takes changesets into account so should be used
260244 * instead of directly accessing the token array.
261245 *
262- * @param int $tokenPosition The position of the token in the token stack.
246+ * @param int $tokenPosition
263247 *
264248 * @return string
265249 */
@@ -331,12 +315,10 @@ public function rollbackChangeset(): void
331315 }
332316
333317 /**
334- * Replace the entire contents of a token.
318+ * @param int $tokenPosition
319+ * @param string $content
335320 *
336- * @param int $tokenPosition The position of the token in the token stack.
337- * @param string $content The new content of the token.
338- *
339- * @return bool If the change was accepted.
321+ * @return bool
340322 */
341323 public function replaceToken (int $ tokenPosition , string $ content ): bool
342324 {
@@ -384,11 +366,9 @@ public function replaceToken(int $tokenPosition, string $content): bool
384366 }
385367
386368 /**
387- * Reverts the previous fix made to a token.
369+ * @param int $tokenPosition
388370 *
389- * @param int $tokenPosition The position of the token in the token stack.
390- *
391- * @return bool If a change was reverted.
371+ * @return bool
392372 */
393373 public function revertToken (int $ tokenPosition ): bool
394374 {
@@ -404,11 +384,9 @@ public function revertToken(int $tokenPosition): bool
404384 }
405385
406386 /**
407- * Adds a newline to end of a token's content.
408- *
409- * @param int $tokenPosition The position of the token in the token stack.
387+ * @param int $tokenPosition
410388 *
411- * @return bool If the change was accepted.
389+ * @return bool
412390 */
413391 public function addNewline (int $ tokenPosition ): bool
414392 {
@@ -418,11 +396,9 @@ public function addNewline(int $tokenPosition): bool
418396 }
419397
420398 /**
421- * Adds a newline to the start of a token's content.
422- *
423- * @param int $tokenPosition The position of the token in the token stack.
399+ * @param int $tokenPosition
424400 *
425- * @return bool If the change was accepted.
401+ * @return bool
426402 */
427403 public function addNewlineBefore (int $ tokenPosition ): bool
428404 {
@@ -432,12 +408,10 @@ public function addNewlineBefore(int $tokenPosition): bool
432408 }
433409
434410 /**
435- * Adds content to the end of a token's current content.
436- *
437- * @param int $tokenPosition The position of the token in the token stack.
438- * @param string $content The content to add.
411+ * @param int $tokenPosition
412+ * @param string $content
439413 *
440- * @return bool If the change was accepted.
414+ * @return bool
441415 */
442416 public function addContent (int $ tokenPosition , string $ content ): bool
443417 {
@@ -447,12 +421,10 @@ public function addContent(int $tokenPosition, string $content): bool
447421 }
448422
449423 /**
450- * Adds content to the start of a token's current content.
424+ * @param int $tokenPosition
425+ * @param string $content
451426 *
452- * @param int $tokenPosition The position of the token in the token stack.
453- * @param string $content The content to add.
454- *
455- * @return bool If the change was accepted.
427+ * @return bool
456428 */
457429 public function addContentBefore (int $ tokenPosition , string $ content ): bool
458430 {
0 commit comments