Skip to content

Calling class method with unnecessary parameters does not throw exception #17690

@fazliddin

Description

@fazliddin

Description

The following code:

final class Actions
{
...
    public function add(string $pageName, Action|string $actionNameOrObject): self
    {
        return $this->doAddAction($pageName, $actionNameOrObject);
    }
...
}

$obj = new Actions;
$obj->add(Crud::PAGE_EDIT, Action::SAVE_AND_CONTINUE, function (Action $action)
{
    return $action->setIcon(false)->setLabel(false);
})

Resulted in this output:

No error is shown

But I expected this output instead:

Method add does not have third parameter

PHP Version

PHP 8.2.27

Operating System

Ubuntu 22.04

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions