feat(Domain): add allowEmpty constructor option#8
Conversation
Agent-Logs-Url: https://github.com/utopia-php/validators/sessions/c7c6148a-382c-495e-89ca-96ed85804048 Co-authored-by: Meldiron <19310830+Meldiron@users.noreply.github.com>
Greptile SummaryThis PR adds an opt-in Confidence Score: 5/5Safe to merge — no logic errors, security concerns, or regressions identified. The change is a small, isolated, additive feature with correct strict-equality guards and a default of No files require special attention. Important Files Changed
Reviews (2): Last reviewed commit: "Apply suggestions from code review" | Re-trigger Greptile |
|
@copilot I dont see your last fixes. are you sure you commited and pushed changes? |
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Domain::isValid()unconditionally rejected empty strings. This adds an opt-inallowEmptyflag (defaultfalse) that permits empty strings while still rejectingnulland all other invalid values.Changes
Domain.php— addedbool $allowEmpty = falseas third constructor parameter; early-returnstruefor''when the flag is set, using strict equality sonullis not implicitly allowedDomainTest.php— addedtestAllowEmpty()covering default rejection, opt-in acceptance of'', continued rejection ofnull, and that normal valid/invalid domain rules are unaffectedUsage
Follows the same pattern already established in the
URLvalidator.