Open robert-abram opened 2 years ago
Hi, When we have 2 different enums and 1 rule EnumRule(EmailScopeEnum::class
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; } }
Hi,
is this issue is close or not. can I work on it.
Hi, When we have 2 different enums and 1 rule
EnumRule(EmailScopeEnum::class
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