Skip to content

Incomplete PHPDoc for EasyCorp\Bundle\EasyAdminBundle\Config\Action::setHtmlAttributes #7456

@FoxCie

Description

@FoxCie

Describe the bug
PHPStan gives errors when doing things like :

public function configureActions(Actions $actions): Actions
{
    $actions->update(Crud::PAGE_EDIT, Action::SAVE_AND_RETURN, function (Action $action) {
        return $action->setHtmlAttributes(array_merge(
            $action->getAsDto()->getHtmlAttributes(), [
                'data-attr' => 'attr_value',
            ]
        ));
    });

    return $actions;
}

The error is :
Parameter #1 $attributes of method EasyCorp\Bundle\EasyAdminBundle\Config\Action::setHtmlAttributes() expects array<string, string>, array<string, string|Symfony\Contracts\Translation\TranslatableInterface> given.

This comes from the fact that on ActionDto, the method takes and returns array<string, string|TranslatableInterface>, whereas on Action it takes and returns array<string, string>.

To Reproduce
Run PHPStan on an example similar to the one given.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions