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

redirect() typehints at v3.0.0. #220

Closed
BigOHenry opened this issue Jun 7, 2019 · 3 comments
Closed

redirect() typehints at v3.0.0. #220

BigOHenry opened this issue Jun 7, 2019 · 3 comments

Comments

@BigOHenry
Copy link

@BigOHenry BigOHenry commented Jun 7, 2019

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.
@dg

This comment has been minimized.

Copy link
Member

@dg dg commented Jun 18, 2019

Remove $code parameter from method completely.

Seems like good solution. Can you send PR?

@mabar

This comment has been minimized.

Copy link
Contributor

@mabar mabar commented Jun 18, 2019

Related to #212 and #221 (alternative solutions)

@BigOHenry

This comment has been minimized.

Copy link
Author

@BigOHenry BigOHenry commented Jun 18, 2019

Remove $code parameter from method completely.

Seems like good solution. Can you send PR?

PR ready. Its ok like this?

@dg dg closed this in 24ead35 Jul 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.