diff --git a/src/Actions/ResolveForPropertyValueAction.php b/src/Actions/ResolveForPropertyValueAction.php index c4cc91c9..836e0a9b 100644 --- a/src/Actions/ResolveForPropertyValueAction.php +++ b/src/Actions/ResolveForPropertyValueAction.php @@ -34,6 +34,6 @@ protected function isValueAnEnum($value): bool $enumNamespace = is_object($value) ? get_class($value) : $value; - return ! is_array($value) && enum_exists($enumNamespace); + return ! is_array($value) && is_string($enumNamespace) && enum_exists($enumNamespace); } } diff --git a/tests/ActivityLoggerTest.php b/tests/ActivityLoggerTest.php index b38e607b..e8aa426c 100644 --- a/tests/ActivityLoggerTest.php +++ b/tests/ActivityLoggerTest.php @@ -148,6 +148,21 @@ expect($firstActivity->getExtraProperty('property.subProperty'))->toEqual('value'); }); +it('can log activity with null properties', function () { + $properties = [ + 'property' => null, + ]; + + activity() + ->withProperties($properties) + ->log($this->activityDescription); + + $firstActivity = Activity::first(); + + expect($firstActivity->properties)->toBeInstanceOf(Collection::class); + expect($firstActivity->getExtraProperty('property'))->toBeNull(); +}); + it('can log activity with a single properties', function () { activity() ->withProperty('key', 'value')