Replace generic parameters by typed options #7979
Replies: 3 comments
-
Do you have some examples of code that could use this? A big part of the refactor from Service/QueryBuilder to Repo/Collector was to implement typed method parameters for exactly this reason. I'd prefer if this issue identified one or more sub-systems to be refactored, rather than just a generic recommendation. If it's a generic recommendation, it's probably something we should add to a contributor's guide. |
Beta Was this translation helpful? Give feedback.
-
Excluding the "grids" (which we're probably not going to touch), I've seen some cases here and there. |
Beta Was this translation helpful? Give feedback.
-
Thanks, the hooks sound like a promising use case. Can you put some brief code samples here to show how they might work with typed options? |
Beta Was this translation helpful? Give feedback.
-
Describe the problem you would like to solve
Generic parameters, passed through arrays are complex to deal with through a maintenance perspective, one also will have to dig into the documentation/code to see what are the possibilities/requirements (e.g. one argument depends on another).
Describe the solution you'd like
Given the PHP requirement was bumped to 8.0, perhaps we can adopt something like the code below. Which isn't very verbose and would allows us to:
Who is asking for this feature?
Developer
Beta Was this translation helpful? Give feedback.
All reactions