Skip to content

Commit 1100343

Browse files
committed
Allow null in str_*() functions
1 parent 19d03c3 commit 1100343

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

bootstrap.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,13 @@ function fdiv(float $num1, float $num2): float { return p\Php80::fdiv($num1, $nu
2626
function preg_last_error_msg(): string { return p\Php80::preg_last_error_msg(); }
2727
}
2828
if (!function_exists('str_contains')) {
29-
function str_contains(string $haystack, string $needle): bool { return p\Php80::str_contains($haystack, $needle); }
29+
function str_contains(?string $haystack, ?string $needle): bool { return p\Php80::str_contains($haystack ?? '', $needle ?? ''); }
3030
}
3131
if (!function_exists('str_starts_with')) {
32-
function str_starts_with(string $haystack, string $needle): bool { return p\Php80::str_starts_with($haystack, $needle); }
32+
function str_starts_with(?string $haystack, ?string $needle): bool { return p\Php80::str_starts_with($haystack ?? '', $needle ?? ''); }
3333
}
3434
if (!function_exists('str_ends_with')) {
35-
function str_ends_with(string $haystack, string $needle): bool { return p\Php80::str_ends_with($haystack, $needle); }
35+
function str_ends_with(?string $haystack, ?string $needle): bool { return p\Php80::str_ends_with($haystack ?? '', $needle ?? ''); }
3636
}
3737
if (!function_exists('get_debug_type')) {
3838
function get_debug_type($value): string { return p\Php80::get_debug_type($value); }

0 commit comments

Comments
 (0)