[5.4] Revert breaking changes in ControllerDispatcher::resolveMethodDependencies #18644
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 all known (so far) breaking changes mentioned in issue #18593. It also includes tests for these cases to avoid a regression in the future.
It has one change of existing behavior back to the 5.4.12 ways; a certain type will only be resolved once. One test introduced with the breaking 5.4.13 changes, testClassesAndVariablesCanBeInjectedIntoRoutes, has to be updated to reflect this: In this case it still works because the second parameter of type stdClass also has a default value, and the default value is passed into the method instead.
I believe that this is the correct behavior based on a comment in RouteDependencyResolverTrait::transformDependency and the way that pre-5.4.13 ensured that a specific type was only resolved once.
Assuming I understand this change correctly; this only affects people that uses the same interface twice (or more) in the same action signature. The test now fails because it has two parameters of the same type, and no model binding involved. I believe the test to be odd and have updated it to verify the null value instead.