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

FormElements: Fix return type of createElement() method and related code #138

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

sukhwinder33445
Copy link
Contributor

This fixes the confusion of phpstan. Since the createElement() element returns an instance of FormElement, phpstan cannot find an addHtml() method for it, for example. The return type must therefore be FormElement & BaseHtmlElement.

@sukhwinder33445 sukhwinder33445 self-assigned this May 3, 2024
@cla-bot cla-bot bot added the cla/signed label May 3, 2024
@sukhwinder33445 sukhwinder33445 marked this pull request as draft May 3, 2024 08:23
@sukhwinder33445 sukhwinder33445 force-pushed the fix-return-type branch 2 times, most recently from 53da7c1 to 828ccf0 Compare May 3, 2024 13:01
… code

This fixes the confusion of phpstan. Since the `createElement()` element returns an instance
of `FormElement`, phpstan cannot find an `addHtml()` method for it, for example.
The return type must therefore be `FormElement & BaseHtmlElement`.
Since `ValidatorChain::addValidators($param)` requires $param of the type `Traversable<int|string, mixed>`, this class should reflect it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant