diff --git a/PHPCSDebug/Sniffs/Debug/TokenListSniff.php b/PHPCSDebug/Sniffs/Debug/TokenListSniff.php index 67aef3c..9568200 100644 --- a/PHPCSDebug/Sniffs/Debug/TokenListSniff.php +++ b/PHPCSDebug/Sniffs/Debug/TokenListSniff.php @@ -82,7 +82,7 @@ public function process(File $phpcsFile, $stackPtr) $tokens = $phpcsFile->getTokens(); $last = ($phpcsFile->numTokens - 1); - $ptrPadding = \max(3, \strlen($last)); + $ptrPadding = \max(3, \strlen((string) $last)); $linePadding = \strlen($tokens[$last]['line']); $sep = ' | '; @@ -132,7 +132,7 @@ public function process(File $phpcsFile, $stackPtr) $sep, 'L', \str_pad($token['line'], $linePadding, '0', \STR_PAD_LEFT), $sep, 'C', \str_pad($token['column'], 3, ' ', \STR_PAD_LEFT), $sep, 'CC', \str_pad($token['level'], 2, ' ', \STR_PAD_LEFT), - $sep, '(', \str_pad($parenthesesCount, 2, ' ', \STR_PAD_LEFT), ')', + $sep, '(', \str_pad((string) $parenthesesCount, 2, ' ', \STR_PAD_LEFT), ')', $sep, \str_pad($token['type'], 26), // Longest token type name is 26 chars. $sep, '[', \str_pad($token['length'], 3, ' ', \STR_PAD_LEFT), ']:', ($onlyEol === false ? ' ' : ''), $content, \PHP_EOL; diff --git a/Scripts/CheckSniffCompleteness.php b/Scripts/CheckSniffCompleteness.php index 77eb508..ed52e23 100644 --- a/Scripts/CheckSniffCompleteness.php +++ b/Scripts/CheckSniffCompleteness.php @@ -364,18 +364,19 @@ public function isComplete() $current = ($i + 1); if (($current % 60) === 0 || $current === $sniffCount) { - $padding = \strlen($sniffCount); + $padding = \strlen((string) $sniffCount); $filling = ''; if ($current === $sniffCount) { $lines = \ceil($current / 60); if ($lines > 1) { - $filling = \str_repeat(' ', (($lines * 60) - $sniffCount)); + $filling = \str_repeat(' ', (int) (($lines * 60) - $sniffCount)); } } - echo $filling, ' ', \str_pad($current, $padding, ' ', \STR_PAD_LEFT), ' / ', $sniffCount, - ' (', \str_pad(\round(($current / $sniffCount) * 100), 3, ' ', \STR_PAD_LEFT), '%)', \PHP_EOL; + echo $filling, ' ', \str_pad((string) $current, $padding, ' ', \STR_PAD_LEFT), ' / ', $sniffCount, + ' (', \str_pad((string) \round(($current / $sniffCount) * 100), 3, ' ', \STR_PAD_LEFT), '%)', + \PHP_EOL; } } }