Skip to content

Fluent setters/functions #24

Open
Open

Description

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

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