Skip to content

Using static::addTo results in unexpected behavior when called from child classes #1015

@georgehristov

Description

@georgehristov

As example in Menu methods addMenu, addGroup, addMenuRight use static::addTo.
I had defined a child class NavMenu extending Menu.
When calling the addMenu method within the new class the expected behavior is that a Menu is added (as original behavior) and not NavMenu (as happens now).

Using self instead of static in Menu methods does not solve the issue. Only using Menu::addTo results in expected behavior. That is because static is used in addTo method as well.

All classes using addTo must be checked for this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions