Skip to content

Conversation

@henriquemoody
Copy link
Member

Since we have the ability to use not as a prefix, having rules that validate negative behavior makes them a bit inflexible, verbose, and harder to understand.

This commit will refactor the NoWhitespace rule by inverting its behaviour and renaming it to Spaced. Although this is a breaking change, users will still be able to have a similar behavior with the prefix not + Spaced.

Since we have the ability to use `not` as a prefix, having rules that
validate negative behavior makes them a bit inflexible, verbose, and
harder to understand.

This commit will refactor the `NoWhitespace` rule by inverting its
behaviour and renaming it to `Spaced`. Although this is a breaking
change, users will still be able to have a similar behavior with the
prefix `not` + `Spaced`.
@codecov
Copy link

codecov bot commented Dec 29, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.49%. Comparing base (7046560) to head (a37cac7).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #1575      +/-   ##
============================================
- Coverage     97.49%   97.49%   -0.01%     
+ Complexity      988      987       -1     
============================================
  Files           205      205              
  Lines          2237     2235       -2     
============================================
- Hits           2181     2179       -2     
  Misses           56       56              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors the NoWhitespace validation rule by inverting its behavior and renaming it to Spaced. The new Spaced rule validates that input contains at least one whitespace character, while the old behavior (no whitespace) can be achieved using notSpaced() or not(spaced()). This is a breaking change that makes the validation rules more intuitive and flexible when combined with the not prefix.

Key Changes:

  • Renamed NoWhitespace to Spaced with inverted validation logic
  • Updated all usages across tests and documentation to use notSpaced() for the old behavior
  • Updated mixin interfaces to remove noWhitespace() methods and add spaced() methods

Reviewed changes

Copilot reviewed 34 out of 34 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
library/Rules/Spaced.php Renamed class from NoWhitespace to Spaced, inverted validation logic to check for presence of whitespace, swapped template messages
library/Rules/Domain.php Updated to use Spaced (contains bug - should use Not(Spaced))
library/Mixins/*.php Removed noWhitespace() methods and added spaced() methods across all mixin interfaces
tests/unit/Rules/SpacedTest.php Renamed test class and swapped valid/invalid test case providers to match inverted behavior
tests/feature/Rules/SpacedTest.php New feature test demonstrating both default and inverted template messages
tests/feature/Rules/NoWhitespaceTest.php Deleted old feature test file
tests/feature/**/*.php Updated all feature test usages from noWhitespace() to notSpaced()
docs/rules/Spaced.md New documentation explaining the inverted behavior with examples
docs/rules/NoWhitespace.md Deleted old documentation file
docs/**/*.md Updated all documentation references from NoWhitespace to Spaced with appropriate usage changes

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@henriquemoody henriquemoody merged commit a37cac7 into Respect:main Dec 29, 2025
5 checks passed
@henriquemoody henriquemoody deleted the rule/spaced branch December 29, 2025 09:08
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.

1 participant