Skip to content

Commit

Permalink
fix: check php version before accessing isEnum
Browse files Browse the repository at this point in the history
  • Loading branch information
calebdw committed Mar 15, 2024
1 parent 2ac6033 commit 400757f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Properties/ModelCastHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public function getReadableType(string $cast, Type $originalType): Type

$classReflection = $this->reflectionProvider->getClass($cast);

if ($classReflection->isEnum()) {
if (version_compare(PHP_VERSION, '8.1', '>=') && $classReflection->isEnum()) {
return new ObjectType($cast);
}

Expand Down Expand Up @@ -124,7 +124,7 @@ public function getWriteableType(string $cast, Type $originalType): Type

$classReflection = $this->reflectionProvider->getClass($cast);

if ($classReflection->isEnum()) {
if (version_compare(PHP_VERSION, '8.1', '>=') && $classReflection->isEnum()) {
return new ObjectType($cast);
}

Expand Down

0 comments on commit 400757f

Please sign in to comment.