Skip to content

Fluent setters/functions #24

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

Open
jolelievre opened this issue Mar 17, 2021 · 0 comments
Open

Fluent setters/functions #24

jolelievre opened this issue Mar 17, 2021 · 0 comments

Comments

@jolelievre
Copy link

Add a rule for fluent setter, the rule is to be defined But I believe we expect the return type to be self instead of the class name

public function setValue($value): self
{
    $this->value = $value;

    return $this;
}

The idea is not to force all setters to be fluent, however when a function returns $this I guess we can consider it as a "fluent functions" so in this case we can expect its return type to be self

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

No branches or pull requests

1 participant