Fix skipOnEmpty default value in comparison rules to null#789
Open
Fix skipOnEmpty default value in comparison rules to null#789
skipOnEmpty default value in comparison rules to null#789Conversation
…n rules Co-authored-by: samdark <47294+samdark@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Update skipOnEmpty parameter to be null by default
Fix Mar 10, 2026
skipOnEmpty default value in comparison rules to null
Member
|
@copilot add a line for CHANGELOG.md referencing original issue number. |
Co-authored-by: samdark <47294+samdark@users.noreply.github.com>
Author
There was a problem hiding this comment.
Pull request overview
This PR fixes issue #788 by aligning comparison “shortcut” rules’ $skipOnEmpty default with the library-wide convention (null), allowing Validator::withDefaultSkipOnEmptyCondition() to take effect for these rules.
Changes:
- Update
$skipOnEmptydefault fromfalsetonullinEqual,NotEqual,GreaterThan,GreaterThanOrEqual,LessThan, andLessThanOrEqual. - Add a changelog entry for the bugfix in the upcoming
2.5.2release.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/Rule/Equal.php | Changes $skipOnEmpty default to null so validator default skip condition can be applied. |
| src/Rule/NotEqual.php | Same default change for NotEqual. |
| src/Rule/GreaterThan.php | Same default change for GreaterThan. |
| src/Rule/GreaterThanOrEqual.php | Same default change for GreaterThanOrEqual. |
| src/Rule/LessThan.php | Same default change for LessThan. |
| src/Rule/LessThanOrEqual.php | Same default change for LessThanOrEqual. |
| CHANGELOG.md | Documents the bugfix under 2.5.2 under development. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…le tests Co-authored-by: samdark <47294+samdark@users.noreply.github.com>
Author
|
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Six comparison rules hardcoded
$skipOnEmpty = false, making them ignore any global default set viaValidator::withDefaultSkipOnEmptyCondition(). The parameter should default tonullso the validator-level default can take effect, consistent with all other rules and theAbstractComparebase class (which already usednull).Changes
src/Rule/Equal.php,GreaterThan.php,GreaterThanOrEqual.php,LessThan.php,LessThanOrEqual.php,NotEqual.php: change$skipOnEmpty = false→$skipOnEmpty = nullCHANGELOG.md: addBug #788entry for the upcoming2.5.2releasetestDefaultSkipOnEmptyConditionregression test to each of the 6 comparison rule test classes, verifying that aValidatorconfigured withwithDefaultSkipOnEmptyCondition(true)correctly skips validation of an empty string when no explicit$skipOnEmptyis passed to the ruleBehaviour note
SkipOnEmptyTrait::getSkipOnEmptyOption()normalizesnulltofalsefor serialization, so the dumped rule options are unchanged — this fix only affects whether the validator-level default is respected at runtime when no explicit value is passed:Original prompt
skipOnEmptyin some rules is not null by default #788💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.