Skip to content

redirect() typehints at v3.0.0. #220

@BigOHenry

Description

@BigOHenry

Version: 3.0.0

Bug Description

Getting phpstan lvl5 error on $this->redirect('Home:', ['name' => 'test']); - Parameter #2 $destination of method Nette\Application\UI\Component::redirect() expects string|null, array<string, string> given.

Steps To Reproduce

$this->redirect('Home:'); // this is OK $this->redirect('Home:', ['name' => 'test']); // there is the phpstan error $this->redirect(200, 'Home:', ['name' => 'test']); // first parameter $code is deprecated; use redirectPermanent() for 301 redirect. 

Expected Behavior

  • there should not be phpstan errors

Possible Solution

  1. Fix type hints for $destination parameter to string|array|null.
    or
  2. Remove $code parameter from method completely. Dont know if there is any usage of it.

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