Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extract rule name and options to separate collector #682

Open
vjik opened this issue Apr 2, 2024 · 4 comments
Open

Extract rule name and options to separate collector #682

vjik opened this issue Apr 2, 2024 · 4 comments

Comments

@vjik
Copy link
Member

vjik commented Apr 2, 2024

My suggestion:

  1. Remove method RuleInterface::getName().
  2. Remove interface RuleWithOptionsInterface.
  3. Remove RulesDumper.
  4. Create new RulesConvertor that would can be configured for usage with custom rules also.

Benefits:

  • more clear rule classes
  • allows move all default values to rule handlers, that allow override default values globally.
@vjik vjik added this to the 2.0 milestone Apr 2, 2024
@samdark
Copy link
Member

samdark commented Apr 2, 2024

  1. As an author of the custom rule, what would be different for me to implement / use the rule?
  2. What if I want to ship it in a Composer package?
  3. As a rule user, what would be different for me?

@vjik
Copy link
Member Author

vjik commented Apr 3, 2024

  1. As an author of the custom rule, what would be different for me to implement / use the rule?

Implementation:

  • method RuleInterface::getName() need to implement only when user used convertation rules to array
  • if options needed, then yet another class for convert rule to array will be required (also user can implement new interface in rule).

Usage:

  • add ability to change converatation to array for any rule.
  1. What if I want to ship it in a Composer package?

It can be configured via Yii Config or manually.

  1. As a rule user, what would be different for me?

See 1.

@samdark
Copy link
Member

samdark commented Apr 3, 2024

I like the ability to configure it, but I don't think we need to separate this information, since it logically belongs to rule itself.

@vjik
Copy link
Member Author

vjik commented Apr 3, 2024

In some cases need ability to configure converter rule to array. For example date format in date rule. In this case need to use separate converter.

@vjik vjik removed this from the 2.0 milestone Jul 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants