-
-
Notifications
You must be signed in to change notification settings - Fork 52
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
Improve type inference for FormElementManager #190
Conversation
gsteel
commented
Oct 14, 2022
Q | A |
---|---|
Documentation | yes |
New Feature | yes |
Signed-off-by: George Steel <[email protected]>
Signed-off-by: George Steel <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
@@ -22,6 +22,8 @@ | |||
* laminas-servicemanager v3-compatible plugin manager implementation for form elements. | |||
* | |||
* Enforces that elements retrieved are instances of ElementInterface. | |||
* | |||
* @extends AbstractPluginManager<ElementInterface> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May I ask you why here the @extends
is simple, while on laminas-validator
you opted for
* @template InstanceType of ValidatorInterface
* @extends AbstractPluginManager<InstanceType>
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think validator should have taken the same approach, i.e. not define a custom type. Custom types are useful, for example, in View and Filter where the type can be HelperInterface|callable()|SomethingElse
- in this case it's only ever going to be an ElementInterface so the custom type was unnecessary.
Thank you @gsteel |