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

Improve type inference for FormElementManager #190

Merged
merged 2 commits into from
Oct 14, 2022

Conversation

gsteel
Copy link
Member

@gsteel gsteel commented Oct 14, 2022

Q A
Documentation yes
New Feature yes

@gsteel gsteel added this to the 3.5.0 milestone Oct 14, 2022
@Slamdunk Slamdunk self-assigned this Oct 14, 2022
Copy link
Member

@Ocramius Ocramius left a 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>
Copy link
Contributor

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>

?

Copy link
Member Author

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.

@Slamdunk Slamdunk merged commit 31f7575 into laminas:3.5.x Oct 14, 2022
@Slamdunk
Copy link
Contributor

Thank you @gsteel

@gsteel gsteel deleted the plugin-manager branch October 14, 2022 08:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

3 participants