Skip to content

Commit

Permalink
fix class check
Browse files Browse the repository at this point in the history
  • Loading branch information
smhg committed Dec 10, 2024
1 parent 289ca29 commit 25ed618
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Propel/Runtime/Util/PropelDateTime.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,9 @@ protected static function isTimestamp($value): bool
*/
public static function createHighPrecision(?string $time = null, string $dateTimeClass = 'DateTime'): DateTimeInterface
{
if (!is_subclass_of($dateTimeClass, DateTime::class) && !is_subclass_of($dateTimeClass, DateTimeImmutable::class)) {
$allowStringIsA = true;

if (!is_a($dateTimeClass, DateTime::class, $allowStringIsA) && !is_a($dateTimeClass, DateTimeImmutable::class, $allowStringIsA)) {
throw new InvalidArgumentException('`' . $dateTimeClass . '` needs to be an instance of DateTime or DateTimeImmutable');
}

Expand Down

0 comments on commit 25ed618

Please sign in to comment.