refactor(NutritionalValue): improve value validation logic
Refactored the constructor to use strict comparison for value validation.
This commit is contained in:
parent
bb454c3684
commit
b4b1dd21ac
1 changed files with 1 additions and 1 deletions
|
|
@ -16,7 +16,7 @@ final readonly class NutritionalValue implements Arrayable, JsonSerializable
|
|||
public string $value,
|
||||
public NutritionnalUnit $unit
|
||||
) {
|
||||
if (empty(mb_trim($value))) {
|
||||
if (mb_trim($value) === '') {
|
||||
throw new \DomainException('Value cannot be empty.');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue