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

BUG: Property mapping fails for partial param annotation coverage #3423

Open
1 task done
bwaidelich opened this issue Dec 19, 2024 · 0 comments
Open
1 task done

BUG: Property mapping fails for partial param annotation coverage #3423

bwaidelich opened this issue Dec 19, 2024 · 0 comments
Assignees
Labels

Comments

@bwaidelich
Copy link
Member

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

An exception

SomeController::someAction(): Argument #1 ($a) must be of type TypeA, TypeB given, called in ActionController.php on line 123

is thrown when trying to map arguments

Expected Behavior

no exception should be thrown :)

Steps To Reproduce

  1. Create an MVC action that expects two params and only add a @param annotation for the second argument:
class SomeController extends ActionController
{
    /**
     * @param TypeB $b foo
     */
    public function someAction(TypeA $a, TypeB $b): string
    {
        return '...';
    }
}
  1. Invoke the action with valid arguments

e.g. a HTTP request to http://127.0.0.1:8081/?a=valueA&b=valueB

Environment

- Flow: 8.3+
- PHP: all

Anything else?

The issue lies in our ReflectionService that extends the parameter information based on the index of the corresponding @param annotation instead of the name.

@bwaidelich bwaidelich added the Bug label Dec 19, 2024
@bwaidelich bwaidelich self-assigned this Dec 19, 2024
bwaidelich added a commit that referenced this issue Dec 19, 2024
Adjusts the behavior of `ReflectionService::getMethodParameters()` such that `@param` annotations are mapped to the corresponding method argument based in their _name_ instead of the _index_.

Fixes: #3423
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant