Skip to content

Code Quality in service definition for filters #441

@loic425

Description

@loic425

Type: Suggestion

💡 Code Quality: There's a lot of repetition in the filter definitions (lines 35-110). Each filter follows the same pattern:

  1. Define the filter service with a tag
  2. Create an alias
  3. Define the form type
  4. Create another alias

Consider extracting this into a helper function or loop to reduce duplication:

$filters = [
    'string' => ['filter' => StringFilter::class, 'form' => StringFilterType::class],
    'boolean' => ['filter' => BooleanFilter::class, 'form' => BooleanFilterType::class],
    // ...
];

foreach ($filters as $type => $classes) {
    // Register filter and form type
}

This would make the code more maintainable and less error-prone.

Originally posted by @Prometee in #436 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions