Skip to content

Commit 379f8cd

Browse files
committed
Debug/TokenList: small simplifications
* The `level` index already contains the condition count, so no need for doing a `count()` within the sniff. * No need to use `str_pad()` for a title with fixed length.
1 parent e4e05a4 commit 379f8cd

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

PHPCSDebug/Sniffs/Debug/TokenListSniff.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ public function process(File $phpcsFile, $stackPtr)
8686
echo \PHP_EOL;
8787
echo \str_pad('Ptr', $ptrPadding, ' ', \STR_PAD_BOTH),
8888
$sep, \str_pad('Ln', ($linePadding + 1), ' ', \STR_PAD_BOTH),
89-
$sep, \str_pad('Col', 4, ' ', \STR_PAD_BOTH),
89+
$sep, 'Col ',
9090
$sep, 'Cond',
9191
$sep, \str_pad('Token Type', 26), // Longest token type name is 26 chars.
9292
$sep, '[len]: Content', \PHP_EOL;
@@ -116,12 +116,10 @@ public function process(File $phpcsFile, $stackPtr)
116116
}
117117
}
118118

119-
$conditionCount = \count($token['conditions']);
120-
121119
echo \str_pad($ptr, $ptrPadding, ' ', \STR_PAD_LEFT),
122120
$sep, 'L', \str_pad($token['line'], $linePadding, '0', \STR_PAD_LEFT),
123121
$sep, 'C', \str_pad($token['column'], 3, ' ', \STR_PAD_LEFT),
124-
$sep, 'CC', \str_pad($conditionCount, 2, ' ', \STR_PAD_LEFT),
122+
$sep, 'CC', \str_pad($token['level'], 2, ' ', \STR_PAD_LEFT),
125123
$sep, \str_pad($token['type'], 26), // Longest token type name is 26 chars.
126124
$sep, '[', $token['length'], ']: ', $content, \PHP_EOL;
127125
}

0 commit comments

Comments
 (0)