Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow rejecting certain phone number types #238

Merged
merged 2 commits into from
Dec 22, 2023

Conversation

dwightwatson
Copy link
Contributor

This extends the custom validation rule to allow you to specifically block certain phone number types, instead of just allowing certain types.

(new Phone)->type(PhoneNumberType::MOBILE);
(new Phone)->notType(PhoneNumberType::MOBILE);

In some scenarios it makes more sense to block incompatible types rather than allow all the other possibilities.

@Propaganistas
Copy link
Owner

I like the idea of adding this - it makes sense. I'm wondering though if we should warn the developer if both are used, because only one will actually take effect (the whitelisted ones).

(new Phone)->type(...)->notType(...)

@dwightwatson
Copy link
Contributor Author

Fair call - I've added a custom exception. See if you're happy with the naming/implementation.

@Propaganistas
Copy link
Owner

Thanks!

@Propaganistas Propaganistas merged commit 1083634 into Propaganistas:master Dec 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants