Skip to content

2.3.11 breaks isLinkCurrent and {ifCurrent} macro #124

@ondrejmirtes

Description

@ondrejmirtes

Following-up on my bug report about typehinted scalar parameters. The fix that resolved this bug also introduced a rather inconvenient BC break.

With non-typehinted scalar parameters, it's not necessary to pass all parameters to isLinkCurrent method:

$presenter->isLinkCurrent(':Homepage:default', []);

In this example, calling the method works even if the requested action has required arguments. By calling it without the arguments, I simply mean to ask "Is the current page at Homepage:default?" without checking exact parameters.

If the action has PHP-7-scalar typehints, I cannot longer call isLinkCurrent without its arguments:

public function renderDefault(int $id)
{
}
...
$presenter->isLinkCurrent(':Homepage:default', []); // fails on PHP-7

BC break aside, I think it also reduces the scope where isLinkCurrent is usable. Before PHP 7, I could use it for checking whether am I in a concrete Presenter:action pair without caring about exact arguments.

For example if I want to always render a template block when I am at Article:default, in the past I could have used {ifCurrent Article:default}. Now, I have to pass the arguments to the macro.

Ideally, the isLinkCurrent/ifCurrent functionality should not depend on generating links because it should behave independently of each other because of different requirements for these functionalities.

If this issue is a logical conclusion of the suggested behaviour in #112 and the current behaviour is fine for everyone, feel free to close this issue.

Thanks!

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