Skip to content

Commit

Permalink
fix function signature tests
Browse files Browse the repository at this point in the history
  • Loading branch information
xabbuh committed Jul 30, 2024
1 parent c0fee7a commit 3662eae
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Mbstring/bootstrap80.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ function mb_strrpos(?string $haystack, ?string $needle, ?int $offset = 0, ?strin
function mb_strstr(?string $haystack, ?string $needle, ?bool $before_needle = false, ?string $encoding = null): string|false { return p\Mbstring::mb_strstr((string) $haystack, (string) $needle, (bool) $before_needle, $encoding); }
}
if (!function_exists('mb_get_info')) {
function mb_get_info(?string $type = 'all'): array|string|int|false { return p\Mbstring::mb_get_info((string) $type); }
function mb_get_info(?string $type = 'all'): array|string|int|false|null { return p\Mbstring::mb_get_info((string) $type); }
}
if (!function_exists('mb_http_output')) {
function mb_http_output(?string $encoding = null): string|bool { return p\Mbstring::mb_http_output($encoding); }
Expand Down
9 changes: 8 additions & 1 deletion src/Util/TestListenerTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,17 @@ function {$f['name']}{$f['signature']}
'array|string|null $string' => 'array|string $string',
'array|string|null $from_encoding = null' => 'array|string|null $from_encoding = null',
'array|string|null $from_encoding' => 'array|string $from_encoding',
'string $characters = null' => '?string $characters = null',
'string $charset = null' => '?string $charset = null',
'string $encoding = null' => '?string $encoding = null',
'string $language = null' => '?string $language = null',
'string $type = null' => '?string $type = null',
'int $length = null' => '?int $length = null',
];

if (strtr($polyfillSignature, $map) !== $originalSignature) {
$warnings[] = TestListener::warning("Incompatible signature for PHP >= 8:\n- {$f['name']}$originalSignature\n+ {$f['name']}$polyfillSignature");
$mapped = strtr($polyfillSignature, $map);
$warnings[] = TestListener::warning("Incompatible signature for PHP >= 8:\n- {$f['name']}$originalSignature\n+ {$f['name']}$polyfillSignature\nmap: $mapped");
}
}
}
Expand Down

0 comments on commit 3662eae

Please sign in to comment.