fix: prevent state mutation in PersonalData validator#12266
Conversation
Greptile SummaryThis PR fixes an unintended side effect in
Confidence Score: 5/5Safe to merge — the change is a clean, narrowly scoped fix with no impact on the validation logic itself. The diff is a straightforward refactor of four $this->property = strtolower(...) assignments into local variable assignments, with all downstream comparisons updated to match. The fix is correct: local variables are initialized before the strict-mode branch so both code paths work identically to the original, and no validation rule is altered. No new conditional paths, no changes to error handling, and no risk of introducing a regression. No files require special attention — the single changed file has a well-contained, mechanical fix. Important Files Changed
Reviews (1): Last reviewed commit: "fix: prevent state mutation in PersonalD..." | Re-trigger Greptile |
What does this PR do?
Fixes unintended internal state mutation in
PersonalData::isValid().Previously,
isValid()wrote lowercase-transformed values back to instance properties such as:$this->userId$this->emailThis caused repeated calls on the same validator instance to operate on already-mutated state, which could break strict case-sensitive validation behavior.
This PR avoids mutating validator state by using local lowercase variables during comparison instead of overwriting instance properties.
Test Plan
isValid()calls now behave consistentlyRelated PRs and Issues
Checklist