Skip to content

Commit ce48368

Browse files
authored
fix(support): use Closure instead of callable when calling preg_replace_callback (#1231)
1 parent 805c041 commit ce48368

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

packages/support/src/Regex/functions.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,9 @@ function matches(string $subject, string $pattern, int $offset = 0): bool
122122
* @param non-empty-string $pattern The pattern to search for.
123123
* @param null|positive-int $limit The maximum possible replacements for $pattern within $haystack.
124124
*/
125-
function replace(array|string $haystack, array|string $pattern, callable|array|string $replacement, ?int $limit = null): string
125+
function replace(array|string $haystack, array|string $pattern, Closure|array|string $replacement, ?int $limit = null): string
126126
{
127-
if (is_callable($replacement)) {
127+
if ($replacement instanceof Closure) {
128128
return (string) call_preg('preg_replace_callback', static fn (): ?string => preg_replace_callback(
129129
$pattern,
130130
$replacement,

0 commit comments

Comments
 (0)