Skip to content

Commit e9e2e0e

Browse files
💄 Clean comment and typing
1 parent 6d70b46 commit e9e2e0e

18 files changed

+78
-170
lines changed

TwigCS/Config/Config.php

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@
1111
class Config
1212
{
1313
/**
14-
* Default configuration.
15-
*
1614
* @var array
1715
*/
1816
public static $defaultConfig = [
@@ -23,8 +21,6 @@ class Config
2321
];
2422

2523
/**
26-
* Current configuration.
27-
*
2824
* @var array
2925
*/
3026
protected $config;
@@ -38,8 +34,6 @@ public function __construct(array $config = [])
3834
}
3935

4036
/**
41-
* Find all files to process, based on a file or directory and exclude patterns.
42-
*
4337
* @return Finder
4438
*
4539
* @throws Exception
@@ -75,8 +69,6 @@ public function findFiles(): Finder
7569
}
7670

7771
/**
78-
* Get a configuration value for the given $key.
79-
*
8072
* @param string $key
8173
*
8274
* @return mixed

TwigCS/Report/SniffViolation.php

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -16,43 +16,31 @@ class SniffViolation
1616
const LEVEL_FATAL = 'FATAL';
1717

1818
/**
19-
* Level of the message among `notice`, `warning`, `error`
20-
*
2119
* @var int
2220
*/
2321
protected $level;
2422

2523
/**
26-
* Text message associated with the violation.
27-
*
2824
* @var string
2925
*/
3026
protected $message;
3127

3228
/**
33-
* Line number for the violation.
34-
*
3529
* @var int|null
3630
*/
3731
protected $line;
3832

3933
/**
40-
* Position of the violation on the current line.
41-
*
4234
* @var int|null
4335
*/
4436
protected $linePosition;
4537

4638
/**
47-
* File in which the violation has been found.
48-
*
4939
* @var string
5040
*/
5141
protected $filename;
5242

5343
/**
54-
* Sniff that has produce this violation.
55-
*
5644
* @var SniffInterface|null
5745
*/
5846
protected $sniff;
@@ -75,8 +63,6 @@ public function __construct(int $level, string $message, string $filename, int $
7563
}
7664

7765
/**
78-
* Get the level of this violation.
79-
*
8066
* @return int
8167
*/
8268
public function getLevel(): int
@@ -85,8 +71,6 @@ public function getLevel(): int
8571
}
8672

8773
/**
88-
* Get a human-readable of the level of this violation.
89-
*
9074
* @return string
9175
*/
9276
public function getLevelAsString(): string
@@ -106,8 +90,6 @@ public function getLevelAsString(): string
10690
}
10791

10892
/**
109-
* Get the integer value for a given string $level.
110-
*
11193
* @param string $level
11294
*
11395
* @return int
@@ -129,8 +111,6 @@ public static function getLevelAsInt(string $level): int
129111
}
130112

131113
/**
132-
* Get the text message of this violation.
133-
*
134114
* @return string
135115
*/
136116
public function getMessage(): string
@@ -139,8 +119,6 @@ public function getMessage(): string
139119
}
140120

141121
/**
142-
* Get the line number where this violation occured.
143-
*
144122
* @return int|null
145123
*/
146124
public function getLine(): ?int
@@ -149,8 +127,6 @@ public function getLine(): ?int
149127
}
150128

151129
/**
152-
* Get the filename (and path) where this violation occured.
153-
*
154130
* @return string
155131
*/
156132
public function getFilename(): string
@@ -159,8 +135,6 @@ public function getFilename(): string
159135
}
160136

161137
/**
162-
* Set the position in the line where this violation occured.
163-
*
164138
* @param int|null $linePosition
165139
*
166140
* @return self
@@ -173,8 +147,6 @@ public function setLinePosition(?int $linePosition): SniffViolation
173147
}
174148

175149
/**
176-
* Get the position in the line, if any.
177-
*
178150
* @return int|null
179151
*/
180152
public function getLinePosition(): ?int
@@ -183,8 +155,6 @@ public function getLinePosition(): ?int
183155
}
184156

185157
/**
186-
* Set the sniff that was not met.
187-
*
188158
* @param SniffInterface $sniff
189159
*
190160
* @return self
@@ -197,8 +167,6 @@ public function setSniff(SniffInterface $sniff): SniffViolation
197167
}
198168

199169
/**
200-
* Get the sniff that was not met.
201-
*
202170
* @return SniffInterface|null
203171
*/
204172
public function getSniff(): ?SniffInterface

TwigCS/Report/TextFormatter.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@ class TextFormatter
1919
const ERROR_LINE_WIDTH = 120;
2020

2121
/**
22-
* Input-output helper object.
23-
*
2422
* @var SymfonyStyle
2523
*/
2624
protected $io;

TwigCS/Ruleset/Ruleset.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,6 @@ public function addSniff(SniffInterface $sniff): Ruleset
3838
}
3939

4040
/**
41-
* Create a new set of rule.
42-
*
4341
* @param string $standardName
4442
*
4543
* @return Ruleset

TwigCS/Runner/Fixer.php

Lines changed: 25 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,11 @@
1414
class 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

Comments
 (0)