Skip to content

Commit ab5fd4b

Browse files
authored
update php8 string function (#38071)
1 parent 3ec5bdc commit ab5fd4b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -702,8 +702,8 @@ protected function serializeClassCastableAttribute($key, $value)
702702
*/
703703
protected function isCustomDateTimeCast($cast)
704704
{
705-
return strncmp($cast, 'date:', 5) === 0 ||
706-
strncmp($cast, 'datetime:', 9) === 0;
705+
return str_starts_with($cast, 'date:') ||
706+
str_starts_with($cast, 'datetime:');
707707
}
708708

709709
/**
@@ -714,7 +714,7 @@ protected function isCustomDateTimeCast($cast)
714714
*/
715715
protected function isDecimalCast($cast)
716716
{
717-
return strncmp($cast, 'decimal:', 8) === 0;
717+
return str_starts_with($cast, 'decimal:');
718718
}
719719

720720
/**

0 commit comments

Comments
 (0)