Skip to content

Commit

Permalink
Merge pull request #14822 from cakephp/type-error-php-8
Browse files Browse the repository at this point in the history
Fix TypeError on PHP 8
  • Loading branch information
markstory committed Jul 22, 2020
2 parents 61403ca + 7706031 commit b487171
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Utility/Text.php
Original file line number Diff line number Diff line change
Expand Up @@ -226,13 +226,13 @@ public static function insert(string $str, array $data, array $options = []): st

$dataKeys = array_keys($data);
$hashKeys = array_map('crc32', $dataKeys);
/** @var array<string, string> $tempData */
/** @var array<string, string|int> $tempData */
$tempData = array_combine($dataKeys, $hashKeys);
krsort($tempData);

foreach ($tempData as $key => $hashVal) {
$key = sprintf($format, preg_quote($key, '/'));
$str = preg_replace($key, $hashVal, $str);
$str = preg_replace($key, (string)$hashVal, $str);
}
/** @var array<string, mixed> $dataReplacements */
$dataReplacements = array_combine($hashKeys, array_values($data));
Expand Down

0 comments on commit b487171

Please sign in to comment.