Skip to content

Remove "Wrapper" abstract class#1655

Merged
henriquemoody merged 1 commit into
Respect:mainfrom
henriquemoody:core/wrapper
Jan 31, 2026
Merged

Remove "Wrapper" abstract class#1655
henriquemoody merged 1 commit into
Respect:mainfrom
henriquemoody:core/wrapper

Conversation

@henriquemoody

Copy link
Copy Markdown
Member

With PHP's promoted properties, there is little reason to have an abstract class that only provides a constructor and a proxy method. The greater part of the classes that extended Wrapper had their own implementation of evaluate(), hence it made very little sense to keep Wrapper in the codebase.

Assisted-by: Claude Code (Opus 4.5)

Copilot AI left a comment

Copy link
Copy Markdown

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 removes the Wrapper abstract class from the codebase, replacing it with direct implementations in the validators that previously extended it. With PHP's promoted properties, the minimal functionality provided by Wrapper (constructor and evaluate() proxy) is no longer necessary, especially since most extending classes had their own evaluate() implementations.

Changes:

  • Removed the Wrapper abstract class and its test files
  • Updated 13 validator classes to implement Validator interface directly instead of extending Wrapper
  • Updated migration documentation to remove Wrapper from the list of available base classes

Reviewed changes

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

Show a summary per file
File Description
src/Validators/Core/Wrapper.php Deleted abstract class that provided constructor and evaluate() method
tests/unit/Validators/Core/WrapperTest.php Deleted test file for Wrapper class
tests/src/Validators/Core/ConcreteWrapper.php Deleted test stub for Wrapper class
src/Validators/UndefOr.php Now implements Validator directly with promoted properties
src/Validators/Templated.php Now implements Validator directly with promoted properties
src/Validators/Size.php Now implements Validator directly with promoted properties
src/Validators/PropertyOptional.php Now implements Validator directly with promoted properties
src/Validators/Property.php Now implements Validator directly with promoted properties
src/Validators/NullOr.php Now implements Validator directly with promoted properties
src/Validators/Not.php Now implements Validator directly with promoted properties
src/Validators/Named.php Now implements Validator directly with promoted properties
src/Validators/Length.php Now implements Validator directly with promoted properties
src/Validators/KeyOptional.php Now implements KeyRelated (extends Validator) directly
src/Validators/Key.php Now implements KeyRelated (extends Validator) directly
src/Validators/Core/Reducer.php Now implements Validator directly with custom logic
src/Validators/Core/FilteredNonEmptyArray.php Abstract class now implements Validator directly with protected property
docs/migrating-from-v2-to-v3.md Removed Wrapper from list of available base classes

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

Comment thread src/Validators/Key.php Outdated
@henriquemoody henriquemoody force-pushed the core/wrapper branch 2 times, most recently from 99d5a90 to 5122e4f Compare January 30, 2026 23:34
@codecov

codecov Bot commented Jan 30, 2026

Copy link
Copy Markdown

Codecov Report

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

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #1655      +/-   ##
============================================
+ Coverage     99.20%   99.29%   +0.09%     
- Complexity      917      920       +3     
============================================
  Files           191      190       -1     
  Lines          2146     2141       -5     
============================================
- Hits           2129     2126       -3     
+ Misses           17       15       -2     

☔ 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.

With PHP's promoted properties, there is little reason to have an
abstract class that only provides a constructor and a proxy method.
The greater part of the classes that extended Wrapper had their own
implementation of evaluate(), hence it made very little sense to keep
Wrapper in the codebase.

Assisted-by: Claude Code (Opus 4.5)
@henriquemoody henriquemoody merged commit b352f17 into Respect:main Jan 31, 2026
7 checks passed
@henriquemoody henriquemoody deleted the core/wrapper branch January 31, 2026 01:34
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.

3 participants