Skip to content

Commit 61b5cab

Browse files
authored
Merge pull request #221 from Alanaktion/php84
PHP 8.4 compatibility
2 parents a1333ac + 48c3623 commit 61b5cab

File tree

1 file changed

+36
-36
lines changed

1 file changed

+36
-36
lines changed

src/voku/helper/UTF8.php

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1621,7 +1621,7 @@ public static function encode_mimeheader(
16211621
public static function extract_text(
16221622
string $str,
16231623
string $search = '',
1624-
int $length = null,
1624+
?int $length = null,
16251625
string $replacer_for_skipped_text = '',
16261626
string $encoding = 'UTF-8'
16271627
): string {
@@ -1842,8 +1842,8 @@ public static function file_get_contents(
18421842
string $filename,
18431843
bool $use_include_path = false,
18441844
$context = null,
1845-
int $offset = null,
1846-
int $max_length = null,
1845+
?int $offset = null,
1846+
?int $max_length = null,
18471847
int $timeout = 10,
18481848
bool $convert_to_utf8 = true,
18491849
string $from_encoding = ''
@@ -2576,7 +2576,7 @@ public static function getCharDirection(string $char): string
25762576
* return bool-value, if $key is used and available<br>
25772577
* otherwise return <strong>null</strong>
25782578
*/
2579-
public static function getSupportInfo(string $key = null)
2579+
public static function getSupportInfo(?string $key = null)
25802580
{
25812581
if ($key === null) {
25822582
return self::$SUPPORT;
@@ -3027,7 +3027,7 @@ static function (string $chr) use ($keep_ascii_chars, $encoding): string {
30273027
*/
30283028
public static function html_entity_decode(
30293029
string $str,
3030-
int $flags = null,
3030+
?int $flags = null,
30313031
string $encoding = 'UTF-8'
30323032
): string {
30333033
if (
@@ -4301,7 +4301,7 @@ public static function lcfirst(
43014301
string $str,
43024302
string $encoding = 'UTF-8',
43034303
bool $clean_utf8 = false,
4304-
string $lang = null,
4304+
?string $lang = null,
43054305
bool $try_to_keep_the_string_length = false
43064306
): string {
43074307
if ($clean_utf8) {
@@ -4367,7 +4367,7 @@ public static function lcwords(
43674367
string $char_list = '',
43684368
string $encoding = 'UTF-8',
43694369
bool $clean_utf8 = false,
4370-
string $lang = null,
4370+
?string $lang = null,
43714371
bool $try_to_keep_the_string_length = false
43724372
): string {
43734373
if (!$str) {
@@ -4440,7 +4440,7 @@ public static function levenshtein(
44404440
*
44414441
* @return string the string with unwanted characters stripped from the left
44424442
*/
4443-
public static function ltrim(string $str = '', string $chars = null): string
4443+
public static function ltrim(string $str = '', ?string $chars = null): string
44444444
{
44454445
if ($str === '') {
44464446
return '';
@@ -5621,7 +5621,7 @@ public static function replace_diamond_question_mark(
56215621
* @return string
56225622
* <p>A string with unwanted characters stripped from the right.</p>
56235623
*/
5624-
public static function rtrim(string $str = '', string $chars = null): string
5624+
public static function rtrim(string $str = '', ?string $chars = null): string
56255625
{
56265626
if ($str === '') {
56275627
return '';
@@ -5762,7 +5762,7 @@ public static function str_camelize(
57625762
string $str,
57635763
string $encoding = 'UTF-8',
57645764
bool $clean_utf8 = false,
5765-
string $lang = null,
5765+
?string $lang = null,
57665766
bool $try_to_keep_the_string_length = false
57675767
): string {
57685768
if ($clean_utf8) {
@@ -6023,7 +6023,7 @@ public static function str_delimit(
60236023
string $delimiter,
60246024
string $encoding = 'UTF-8',
60256025
bool $clean_utf8 = false,
6026-
string $lang = null,
6026+
?string $lang = null,
60276027
bool $try_to_keep_the_string_length = false
60286028
): string {
60296029
if (self::$SUPPORT['mbstring'] === true) {
@@ -7678,7 +7678,7 @@ public static function str_replace(
76787678
$search,
76797679
$replace,
76807680
$subject,
7681-
int &$count = null
7681+
?int &$count = null
76827682
) {
76837683
/**
76847684
* @psalm-suppress PossiblyNullArgument
@@ -7912,7 +7912,7 @@ public static function str_shuffle(string $str, string $encoding = 'UTF-8'): str
79127912
public static function str_slice(
79137913
string $str,
79147914
int $start,
7915-
int $end = null,
7915+
?int $end = null,
79167916
string $encoding = 'UTF-8'
79177917
) {
79187918
if ($encoding === 'UTF-8') {
@@ -8701,13 +8701,13 @@ public static function str_surround(string $str, string $substring): string
87018701
*/
87028702
public static function str_titleize(
87038703
string $str,
8704-
array $ignore = null,
8704+
?array $ignore = null,
87058705
string $encoding = 'UTF-8',
87068706
bool $clean_utf8 = false,
8707-
string $lang = null,
8707+
?string $lang = null,
87088708
bool $try_to_keep_the_string_length = false,
87098709
bool $use_trim_first = true,
8710-
string $word_define_chars = null
8710+
?string $word_define_chars = null
87118711
): string {
87128712
if ($str === '') {
87138713
return '';
@@ -9059,7 +9059,7 @@ public static function str_to_binary(string $str)
90599059
*
90609060
* @return string[]
90619061
*/
9062-
public static function str_to_lines(string $str, bool $remove_empty_values = false, int $remove_short_values = null): array
9062+
public static function str_to_lines(string $str, bool $remove_empty_values = false, ?int $remove_short_values = null): array
90639063
{
90649064
if ($str === '') {
90659065
return $remove_empty_values ? [] : [''];
@@ -9110,7 +9110,7 @@ public static function str_to_words(
91109110
string $str,
91119111
string $char_list = '',
91129112
bool $remove_empty_values = false,
9113-
int $remove_short_values = null
9113+
?int $remove_short_values = null
91149114
): array {
91159115
if ($str === '') {
91169116
return $remove_empty_values ? [] : [''];
@@ -9351,7 +9351,7 @@ public static function str_upper_camelize(
93519351
string $str,
93529352
string $encoding = 'UTF-8',
93539353
bool $clean_utf8 = false,
9354-
string $lang = null,
9354+
?string $lang = null,
93559355
bool $try_to_keep_the_string_length = false
93569356
): string {
93579357
return self::ucfirst(self::str_camelize($str, $encoding), $encoding, $clean_utf8, $lang, $try_to_keep_the_string_length);
@@ -9514,8 +9514,8 @@ public static function strcspn(
95149514
string $str,
95159515
string $char_list,
95169516
int $offset = 0,
9517-
int $length = null,
9518-
string $encoding = 'UTF-8'
9517+
?int $length = null,
9518+
?string $encoding = 'UTF-8'
95199519
): int {
95209520
if ($encoding !== 'UTF-8' && $encoding !== 'CP850') {
95219521
$encoding = self::normalize_encoding($encoding, 'UTF-8');
@@ -9649,7 +9649,7 @@ public static function string_has_bom(string $str): bool
96499649
*/
96509650
public static function strip_tags(
96519651
string $str,
9652-
string $allowable_tags = null,
9652+
?string $allowable_tags = null,
96539653
bool $clean_utf8 = false
96549654
): string {
96559655
if ($str === '') {
@@ -11117,7 +11117,7 @@ public static function strspn(
1111711117
string $str,
1111811118
string $mask,
1111911119
int $offset = 0,
11120-
int $length = null,
11120+
?int $length = null,
1112111121
string $encoding = 'UTF-8'
1112211122
) {
1112311123
if ($encoding !== 'UTF-8' && $encoding !== 'CP850') {
@@ -11348,7 +11348,7 @@ public static function strtocasefold(
1134811348
bool $full = true,
1134911349
bool $clean_utf8 = false,
1135011350
string $encoding = 'UTF-8',
11351-
string $lang = null,
11351+
?string $lang = null,
1135211352
bool $lower = true
1135311353
): string {
1135411354
if ($str === '') {
@@ -11402,7 +11402,7 @@ public static function strtolower(
1140211402
$str,
1140311403
string $encoding = 'UTF-8',
1140411404
bool $clean_utf8 = false,
11405-
string $lang = null,
11405+
?string $lang = null,
1140611406
bool $try_to_keep_the_string_length = false
1140711407
): string {
1140811408
// init
@@ -11482,7 +11482,7 @@ public static function strtoupper(
1148211482
$str,
1148311483
string $encoding = 'UTF-8',
1148411484
bool $clean_utf8 = false,
11485-
string $lang = null,
11485+
?string $lang = null,
1148611486
bool $try_to_keep_the_string_length = false
1148711487
): string {
1148811488
// init
@@ -11696,7 +11696,7 @@ public static function strwidth(
1169611696
public static function substr(
1169711697
string $str,
1169811698
int $offset = 0,
11699-
int $length = null,
11699+
?int $length = null,
1170011700
string $encoding = 'UTF-8',
1170111701
bool $clean_utf8 = false
1170211702
) {
@@ -11867,7 +11867,7 @@ public static function substr_compare(
1186711867
string $str1,
1186811868
string $str2,
1186911869
int $offset = 0,
11870-
int $length = null,
11870+
?int $length = null,
1187111871
bool $case_insensitivity = false,
1187211872
string $encoding = 'UTF-8'
1187311873
): int {
@@ -11925,7 +11925,7 @@ public static function substr_count(
1192511925
string $haystack,
1192611926
string $needle,
1192711927
int $offset = 0,
11928-
int $length = null,
11928+
?int $length = null,
1192911929
string $encoding = 'UTF-8',
1193011930
bool $clean_utf8 = false
1193111931
) {
@@ -12017,7 +12017,7 @@ public static function substr_count_in_byte(
1201712017
string $haystack,
1201812018
string $needle,
1201912019
int $offset = 0,
12020-
int $length = null
12020+
?int $length = null
1202112021
) {
1202212022
if ($haystack === '' || $needle === '') {
1202312023
return 0;
@@ -12167,7 +12167,7 @@ public static function substr_ileft(string $haystack, string $needle): string
1216712167
* <i>length</i> parameters.</p><p>If <i>str</i> is shorter than <i>offset</i>
1216812168
* characters long, <b>FALSE</b> will be returned.</p>
1216912169
*/
12170-
public static function substr_in_byte(string $str, int $offset = 0, int $length = null)
12170+
public static function substr_in_byte(string $str, int $offset = 0, ?int $length = null)
1217112171
{
1217212172
// empty string
1217312173
if ($str === '' || $length === 0) {
@@ -12565,7 +12565,7 @@ public static function titlecase(
1256512565
string $str,
1256612566
string $encoding = 'UTF-8',
1256712567
bool $clean_utf8 = false,
12568-
string $lang = null,
12568+
?string $lang = null,
1256912569
bool $try_to_keep_the_string_length = false
1257012570
): string {
1257112571
if ($clean_utf8) {
@@ -12972,7 +12972,7 @@ public static function to_string($input)
1297212972
* @return string
1297312973
* <p>The trimmed string.</p>
1297412974
*/
12975-
public static function trim(string $str = '', string $chars = null): string
12975+
public static function trim(string $str = '', ?string $chars = null): string
1297612976
{
1297712977
if ($str === '') {
1297812978
return '';
@@ -13022,7 +13022,7 @@ public static function ucfirst(
1302213022
string $str,
1302313023
string $encoding = 'UTF-8',
1302413024
bool $clean_utf8 = false,
13025-
string $lang = null,
13025+
?string $lang = null,
1302613026
bool $try_to_keep_the_string_length = false
1302713027
): string {
1302813028
if ($str === '') {
@@ -13490,7 +13490,7 @@ public static function wordwrap_per_line(
1349013490
string $break = "\n",
1349113491
bool $cut = false,
1349213492
bool $add_final_break = true,
13493-
string $delimiter = null
13493+
?string $delimiter = null
1349413494
): string {
1349513495
if ($delimiter === null) {
1349613496
$strings = \preg_split('/\\r\\n|\\r|\\n/', $str);
@@ -13817,7 +13817,7 @@ private static function mbstring_overloaded(): bool
1381713817
private static function reduce_string_array(
1381813818
array $strings,
1381913819
bool $remove_empty_values,
13820-
int $remove_short_values = null
13820+
?int $remove_short_values = null
1382113821
) {
1382213822
// init
1382313823
$return = [];

0 commit comments

Comments
 (0)