Skip to content

Commit 697fe90

Browse files
authored
Merge pull request #69 from PHPCSStandards/feature/debug-tokenlist-minor-tweak
Debug/Tokenlist: minor readability improvement
2 parents 459dd4b + 887e721 commit 697fe90

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

PHPCSDebug/Sniffs/Debug/TokenListSniff.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ public function process(File $phpcsFile, $stackPtr)
128128
$sep, 'CC', \str_pad($token['level'], 2, ' ', \STR_PAD_LEFT),
129129
$sep, '(', \str_pad($parenthesesCount, 2, ' ', \STR_PAD_LEFT), ')',
130130
$sep, \str_pad($token['type'], 26), // Longest token type name is 26 chars.
131-
$sep, '[', $token['length'], ']: ', $content, \PHP_EOL;
131+
$sep, '[', \str_pad($token['length'], 3, ' ', \STR_PAD_LEFT), ']: ', $content, \PHP_EOL;
132132
}
133133

134134
// Only do this once per file.

PHPCSDebug/Tests/Debug/TokenListUnitTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,10 @@ public function testOutput()
3939
$expected = "\n";
4040
$expected .= 'Ptr | Ln | Col | Cond | ( #) | Token Type | [len]: Content' . "\n";
4141
$expected .= '-------------------------------------------------------------------------' . "\n";
42-
$expected .= ' 0 | L1 | C 1 | CC 0 | ( 0) | T_OPEN_TAG | [5]: <?php' . "\n\n";
43-
$expected .= ' 1 | L2 | C 1 | CC 0 | ( 0) | T_WHITESPACE | [0]: ' . "\n\n";
44-
$expected .= ' 2 | L3 | C 1 | CC 0 | ( 0) | T_FUNCTION | [8]: function' . "\n";
45-
$expected .= ' 3 | L3 | C 9 | CC 0 | ( 0) | T_WHITESPACE | [0]: ' . "\n\n";
42+
$expected .= ' 0 | L1 | C 1 | CC 0 | ( 0) | T_OPEN_TAG | [ 5]: <?php' . "\n\n";
43+
$expected .= ' 1 | L2 | C 1 | CC 0 | ( 0) | T_WHITESPACE | [ 0]: ' . "\n\n";
44+
$expected .= ' 2 | L3 | C 1 | CC 0 | ( 0) | T_FUNCTION | [ 8]: function' . "\n";
45+
$expected .= ' 3 | L3 | C 9 | CC 0 | ( 0) | T_WHITESPACE | [ 0]: ' . "\n\n";
4646

4747
$this->expectOutputString($expected);
4848
$this->setOutputCallback([$this, 'normalizeLineEndings']);

0 commit comments

Comments
 (0)