Skip to content

Commit 94c109a

Browse files
committed
refactor: fix param types
1 parent ac36601 commit 94c109a

File tree

5 files changed

+8
-6
lines changed

5 files changed

+8
-6
lines changed

system/CLI/CLI.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1068,7 +1068,7 @@ public static function table(array $tbody, array $thead = [])
10681068

10691069
foreach ($tableRows[$row] as $col) {
10701070
// Sets the size of this column in the current row
1071-
$allColsLengths[$row][$column] = static::strlen($col);
1071+
$allColsLengths[$row][$column] = static::strlen((string) $col);
10721072

10731073
// If the current column does not have a value among the larger ones
10741074
// or the value of this is greater than the existing one
@@ -1088,7 +1088,7 @@ public static function table(array $tbody, array $thead = [])
10881088
$column = 0;
10891089

10901090
foreach ($tableRows[$row] as $col) {
1091-
$diff = $maxColsLengths[$column] - static::strlen($col);
1091+
$diff = $maxColsLengths[$column] - static::strlen((string) $col);
10921092

10931093
if ($diff !== 0) {
10941094
$tableRows[$row][$column] .= str_repeat(' ', $diff);
@@ -1108,7 +1108,7 @@ public static function table(array $tbody, array $thead = [])
11081108
$cols = '+';
11091109

11101110
foreach ($tableRows[$row] as $col) {
1111-
$cols .= str_repeat('-', static::strlen($col) + 2) . '+';
1111+
$cols .= str_repeat('-', static::strlen((string) $col) + 2) . '+';
11121112
}
11131113
$table .= $cols . PHP_EOL;
11141114
}

system/Database/Query.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ protected function matchSimpleBinds(string $sql, array $binds, int $bindCount, i
359359
$escapedValue = '(' . implode(',', $escapedValue) . ')';
360360
}
361361

362-
$sql = substr_replace($sql, $escapedValue, $matches[0][$c][1], $ml);
362+
$sql = substr_replace($sql, (string) $escapedValue, $matches[0][$c][1], $ml);
363363
} while ($c !== 0);
364364

365365
return $sql;

system/Format/XMLFormatter.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,8 @@ protected function normalizeXMLTag($key)
9393
'\\x{FDF0}-\\x{FFFD}\\x{10000}-\\x{EFFFF}';
9494
$validName = $startChar . '\\.\\d\\x{B7}\\x{300}-\\x{36F}\\x{203F}-\\x{2040}';
9595

96+
$key = (string) $key;
97+
9698
$key = trim($key);
9799
$key = preg_replace("/[^{$validName}-]+/u", '', $key);
98100
$key = preg_replace("/^[^{$startChar}]+/u", 'item$0', $key);

system/Helpers/number_helper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ function number_to_size($num, int $precision = 1, ?string $locale = null)
2626
// Strip any formatting & ensure numeric input
2727
try {
2828
// @phpstan-ignore-next-line
29-
$num = 0 + str_replace(',', '', $num);
29+
$num = 0 + str_replace(',', '', (string) $num);
3030
} catch (ErrorException $ee) {
3131
// Catch "Warning: A non-numeric value encountered"
3232
return false;

tests/system/Commands/ClearDebugbarTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ protected function createDummyDebugbarJson(): void
4141

4242
// create 10 dummy debugbar json files
4343
for ($i = 0; $i < 10; $i++) {
44-
$path = str_replace($time, $time - $i, $path);
44+
$path = str_replace((string) $time, (string) ($time - $i), $path);
4545
file_put_contents($path, "{}\n");
4646

4747
$time -= $i;

0 commit comments

Comments
 (0)