Skip to content

Commit beb436a

Browse files
committed
up: fix some error for run in php8.4
1 parent 1f06a0f commit beb436a

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

Diff for: .github/workflows/php.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
strategy:
1111
fail-fast: true
1212
matrix:
13-
php: [8.1, 8.2, 8.3]
13+
php: [8.1, 8.2, 8.3, 8.4]
1414
# os: [ubuntu-latest, macOS-latest] # windows-latest,
1515

1616
steps:

Diff for: composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
}
2121
],
2222
"require": {
23-
"php": ">=8.0",
23+
"php": ">=8.1",
2424
"ext-mbstring": "*"
2525
},
2626
"require-dev": {

Diff for: src/Str/Traits/StringTruncateHelperTrait.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ public static function after(string $s, string $sub, string $fallback = ''): str
128128
*
129129
* @return bool|string
130130
*/
131-
public static function substr(string $str, int $start, int $length = null, string $encoding = 'utf-8'): bool|string
131+
public static function substr(string $str, int $start, int|null $length = null, string $encoding = 'utf-8'): bool|string
132132
{
133133
if (function_exists('mb_substr')) {
134134
return mb_substr($str, $start, $length ?? self::strlen($str), $encoding);
@@ -147,7 +147,7 @@ public static function substr(string $str, int $start, int $length = null, strin
147147
*
148148
* @return string
149149
*/
150-
public static function utf8SubStr(string $str, int $start = 0, int $length = null): string
150+
public static function utf8SubStr(string $str, int $start = 0, int|null $length = null): string
151151
{
152152
if (empty($str)) {
153153
return '';
@@ -241,7 +241,7 @@ public static function truncate(string $str, int $maxLength, string $suffix = '.
241241
*
242242
* @return string
243243
*/
244-
public static function truncate2(string $str, int $start, int $length = null): string
244+
public static function truncate2(string $str, int $start, ?int $length = null): string
245245
{
246246
if (!$length) {
247247
$length = $start;

0 commit comments

Comments
 (0)