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

Question regarding NoConstructorParameterWithDefaultValueRule #461

Open
daniplaninc opened this issue Jul 22, 2022 · 3 comments
Open

Question regarding NoConstructorParameterWithDefaultValueRule #461

daniplaninc opened this issue Jul 22, 2022 · 3 comments
Assignees
Labels

Comments

@daniplaninc
Copy link

Hi,

Sorry if this is very basic question. I only recently started using phpstan and I came across this rule. I don't understand what is the proper way to do this? Why is a constructor parameter with default value bad?

I tried to research this, but I could not find anything..

Excerpt from my code that triggers this rule:

final class Client
{

public function __construct(
    protected string $endpoint,
    protected string $access_key,
    protected string $secret_key,
    protected int $timeout = 10,
    protected null|int $retryTimes = null,
    protected null|int $retryMilliseconds = null,
) {
}
@localheinz localheinz self-assigned this Jul 22, 2022
@localheinz
Copy link
Member

@daniplaninc

Thank you for coming here to ask your question - I will answer it as soon as I’m back from vacation!

@ergebnis-bot
Copy link
Member

Since this issue has not had any activity within the last 180 days, I have marked it as stale.

I will close it if no further activity occurs within the next 14 days.

@ergebnis-bot ergebnis-bot closed this as not planned Won't fix, can't repro, duplicate, stale Feb 2, 2023
@localheinz localheinz reopened this Mar 14, 2023
@settings settings bot removed the stale label Mar 14, 2023
@TravisCarden
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants