Skip to content

Commit 36e9411

Browse files
authored
Deprecated null as array offset in applyReplacements (#1231)
Closes #1228
1 parent dd932ae commit 36e9411

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/Traits/TButtonRenderer.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,15 @@ public function hasReplacements(): bool
8282
public function applyReplacements(Row $row, string $column): array
8383
{
8484
$value = $row->getValue($column);
85+
if (!is_scalar($value) && $value !== null) {
86+
return [false, null];
87+
}
88+
89+
// Ensure null is converted to string to avoid deprecation warning
90+
$key = gettype($value) === 'double' ? (int) $value : ($value ?? '');
8591

86-
if ((is_scalar($value) || $value === null) &&
87-
isset($this->replacements[gettype($value) === 'double' ? (int) $value : $value])) {
88-
return [true, $this->replacements[gettype($value) === 'double' ? (int) $value : $value]];
92+
if (isset($this->replacements[$key])) {
93+
return [true, $this->replacements[$key]];
8994
}
9095

9196
return [false, null];

0 commit comments

Comments
 (0)