FormElements: Fix return type of createElement() method and related code#138
Draft
sukhwinder33445 wants to merge 3 commits into
Draft
FormElements: Fix return type of createElement() method and related code#138sukhwinder33445 wants to merge 3 commits into
createElement() method and related code#138sukhwinder33445 wants to merge 3 commits into
Conversation
sukhwinder33445
marked this pull request as draft
May 3, 2024 08:23
sukhwinder33445
force-pushed
the
fix-return-type
branch
2 times, most recently
from
May 3, 2024 13:01
53da7c1 to
828ccf0
Compare
… 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.
sukhwinder33445
force-pushed
the
fix-return-type
branch
from
May 3, 2024 13:10
828ccf0 to
a0c22b2
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This fixes the confusion of phpstan. Since the
createElement()element returns an instance ofFormElement, phpstan cannot find anaddHtml()method for it, for example. The return type must therefore beFormElement & BaseHtmlElement.