Skip to content

Commit

Permalink
Fix DeviceFactory stats property
Browse files Browse the repository at this point in the history
- Passing a null value to an enums "tryFrom" method is deprecated
- Default "stats" property to DeviceAnalytics::OFF if "stats" is not set in data. This is the default ControlD behaviour
  • Loading branch information
rapkis committed Jan 10, 2024
1 parent 03a5563 commit 3c1f843
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Factories/DeviceFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public function make(array $data): Device
profile: (new ProfileFactory())->make($data['profile']),
profile2: ! empty($data['profile2']) ? (new ProfileFactory())->make($data['profile2']) : null,
description: $data['description'] ?? '',
stats: DeviceAnalytics::tryFrom($data['stats'] ?? null),
stats: ! empty($data['stats']) ? DeviceAnalytics::tryFrom($data['stats']) : DeviceAnalytics::OFF,
icon: $data['icon'] ?? null,
dynamicDns: $dynamicDns ?? null,
dynamicDnsExternal: $externalDns ?? null,
Expand Down

0 comments on commit 3c1f843

Please sign in to comment.