Skip to content

Commit

Permalink
Switch strncmp to starts_with_str
Browse files Browse the repository at this point in the history
Marginally faster, better readability, and matches similar functions
  • Loading branch information
serpentblade committed Aug 4, 2022
1 parent d71dfdf commit c156e13
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php
Expand Up @@ -882,8 +882,8 @@ protected function isCustomDateTimeCast($cast)
*/
protected function isImmutableCustomDateTimeCast($cast)
{
return strncmp($cast, 'immutable_date:', 15) === 0 ||
strncmp($cast, 'immutable_datetime:', 19) === 0;
return str_starts_with($cast, 'immutable_date:') ||
str_starts_with($cast, 'immutable_datetime:');
}

/**
Expand Down

0 comments on commit c156e13

Please sign in to comment.