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

Fixing minor PHPDoc error causing static analysis to fail #4253

Merged
merged 1 commit into from
Mar 18, 2021

Conversation

liarco
Copy link
Contributor

@liarco liarco commented Mar 14, 2021

Hi,
I'm getting errors from PHPStan when I use the setMenuItems(...) method from EasyCorp\Bundle\EasyAdminBundle\Config\UserMenu like this:

// My dashboard controller
// ...
    public function configureUserMenu(UserInterface $user): UserMenu
    {
        return parent::configureUserMenu($user)
            ->setName($user->getUsername())
            ->setGravatarEmail($user->getUsername())
            ->setMenuItems([MenuItem::linkToLogout('__ea__user.sign_out', 'fa fa-sign-out')])
        ;
    }
// ...

The analysis output says:

Parameter #1 $items of method EasyCorp\Bundle\EasyAdminBundle\Config\UserMenu::setMenuItems() expects array<EasyCorp\Bundle\EasyAdminBundle\Config\MenuItem>, array<int, EasyCorp\Bundle\EasyAdminBundle\Config\Menu\LogoutMenuItem> given.

I think that this minor PHPDoc change should fix that.

What do you think?

@javiereguiluz javiereguiluz added this to the 3.x milestone Mar 18, 2021
@javiereguiluz
Copy link
Collaborator

Yes, this is better. Thanks Marco!

@javiereguiluz javiereguiluz merged commit d1a73cf into EasyCorp:master Mar 18, 2021
@liarco liarco deleted the patch-1 branch March 18, 2021 18:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants