Skip to content

Drop misleading @internal annotation on TextFilterType#7592

Merged
javiereguiluz merged 1 commit intoEasyCorp:5.xfrom
lacatoire:fix-text-filter-type-internal-7393
May 4, 2026
Merged

Drop misleading @internal annotation on TextFilterType#7592
javiereguiluz merged 1 commit intoEasyCorp:5.xfrom
lacatoire:fix-text-filter-type-internal-7393

Conversation

@lacatoire
Copy link
Copy Markdown
Contributor

TextFilterType carried @internal Don't use this to define a text filter. Use Filter\\TextFilter instead., but Filter\\TextFilter::new() itself does ->setFormType(TextFilterType::class): any custom filter that wants to reuse the text-filter form (e.g. an OR-flavored text filter) must reference TextFilterType. The annotation made phpstan flag every legitimate external reference and steered users toward Filter\\TextFilter instead, which is not a FormTypeInterface and crashes the form registry.

Removing the annotation aligns TextFilterType with the 8 sibling *FilterType classes (ArrayFilterType, BooleanFilterType, ChoiceFilterType, ComparisonFilterType, DateTimeFilterType, EntityFilterType, NullFilterType, NumericFilterType) which carry no such annotation. No behavior change.

Closes #7393

The annotation said 'Don't use this to define a text filter. Use Filter\TextFilter instead.',
but custom filters that need to reuse TextFilterType's form (e.g. an OR-flavored text filter) MUST pass
TextFilterType::class to setFormType() — it's exactly what Filter\TextFilter::new() does internally.
The @internal annotation made phpstan flag every legitimate external reference and steered users
toward the wrong class (Filter\TextFilter, which is not a FormType and crashes the form registry).

Aligns TextFilterType with the 8 sibling FilterType classes (ArrayFilterType, BooleanFilterType, etc.)
which carry no such annotation. No behavior change.

Closes EasyCorp#7393
@javiereguiluz javiereguiluz added this to the 5.x milestone May 4, 2026
@javiereguiluz
Copy link
Copy Markdown
Collaborator

Thanks Louis-Arnaud.

@javiereguiluz javiereguiluz merged commit 31e50c7 into EasyCorp:5.x May 4, 2026
16 checks passed
@lacatoire lacatoire deleted the fix-text-filter-type-internal-7393 branch May 4, 2026 18:25
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.

Custom filter throws "Could not load type "EasyCorp\Bundle\EasyAdminBundle\Filter\TextFilter""

2 participants