-
-
Notifications
You must be signed in to change notification settings - Fork 36
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Hi,
When we have 2 different enums and 1 rule EnumRule(EmailScopeEnum::class
/**
@method static self DEFAULT()
**/
EmailScopeEnum {
}
/**
@method static self DEFAULT()
**/
PhoneScopeEnum {
}
When we try to check rule against PhoneScopeEnum::DEFAULT() it's working, because DEFAULT can be resolved also in EmailScopeEnum
I fix this by changing passes function in EnumRule
public function passes($attribute, $value): bool
{
$this->attribute = $attribute;
$this->value = $value;
if ($value instanceof $this->enum) {
return true;
}
if ($value instanceof Enum && !$value instanceof $this->enum) {
return false;
}
try {
$this->asEnum($value);
return true;
} catch (Throwable $ex) {
return false;
}
}
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request