Skip to content

Fix filter class name resolution & add full unit tests for FilterResolver#14

Merged
kettasoft merged 5 commits intomasterfrom
2.2.2
Sep 1, 2025
Merged

Fix filter class name resolution & add full unit tests for FilterResolver#14
kettasoft merged 5 commits intomasterfrom
2.2.2

Conversation

@kettasoft
Copy link
Copy Markdown
Owner

🔀 This PR: Core improvements & bug fixes

🔧 Fixes

  • Fixed an issue where calling User::filter(UserFilter::class) was not recognized.

🛠️ Refactor

  • Renamed FilterRegisteratorFilterResolver for clearer semantics.
  • Extracted apply() method to handle instantiation and applying of filters.

📖 Docs

  • Improved PHPDoc in HasFilterable trait to properly recognize the filter() method in IDEs (better autocompletion & static analysis).

✅ Tests

  • Added full PHPUnit test coverage for FilterResolver, including:

    • Resolving FilterableContext instances directly.
    • Passing filter class names as strings.
    • Using default filter defined on the model.
    • Handling invalid or undefined filters (throws FilterIsNotDefinedException).

🔍 Why

  • Ensures a smoother DX: developers can now pass UserFilter::class directly to filter().
  • Improves maintainability by renaming to a more descriptive class name.
  • Increases reliability with comprehensive test coverage.

🚀 Impact

  • No breaking changes.
  • Bug fix + internal refactor + new tests → qualifies as patch release (2.2.2).

Abdalrhman Emad Saad added 5 commits September 1, 2025 20:42
…c in the protected method to reduce repetition.
- covered resolve logic for Filterable instances
- covered passing filter class name directly
- covered using model `$filterable` property
- covered using filter alias
- covered exception thrown when filter is not defined
@kettasoft kettasoft merged commit f559b11 into master Sep 1, 2025
1 check passed
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