-
-
Notifications
You must be signed in to change notification settings - Fork 150
Support typed autowiring of two parameters in form handlers #345
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
Open
mildabre
wants to merge
15
commits into
nette:master
Choose a base branch
from
mildabre:handler-typed-autowiring
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
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
…dClass (BC break)
a992748 to
0e1918f
Compare
8742d20 to
01f8ed8
Compare
1af95b3 to
aa035fb
Compare
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.
Purpose
The goal of this PR is to replace the existing hybrid autowiring logic for form handler parameters, which currently autowires by type (for a single parameter) or by position (for two parameters), with fully typed autowiring, where parameter order is irrelevant.
Implementation
The proposed changes introduce a parallel autowiring path that complements the existing logic without modifying it directly.
Unexpected behavior occurs with the following handler method signatures:
In these cases, the provided parameter types consistently result in an Error, and the handler method is never invoked, regardless of the code of the handler itself.
By handling these three parameter combinations within the newly introduced parallel logic path, this change remains 100% backward compatible.
Benefits
Nette developers are accustomed to type-based autowiring through DI, where parameter order doesn't matter. This proposal extends that principle to form handlers in a safe and modern way, aligning with the conventions of contemporary frameworks by enabling full type-based autowiring without relying on parameter sequence.
The proposed solution is currently being discussedon: nette forum