Skip to content

Named arguments when used with interfaces cannot be trusted #7434

@mad-briller

Description

@mad-briller

Feature Request

Since php8 we have gained the ability to use named arguments. However, named arguments and interfaces don't work very well together, due to the fact that interfaces do not enforce argument names and the implementation is free to change them.

This behaviour can be seen in the following playground:
https://phpstan.org/r/3938b4fd-1921-4bd2-8bc6-6139aedfe310

It would be great if phpstan could enforce the argument naming for contract implementations when the @no-named-parameters or no-named-arguments annotation is not present.

Did PHPStan help you today? Did it make you happy in any way?

phpstan helps me and my organization every day!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions