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

Clarify return $this #1468

Merged
merged 2 commits into from Jul 8, 2014
Merged

Clarify return $this #1468

merged 2 commits into from Jul 8, 2014

Conversation

dereuromark
Copy link
Member

Removed the arguable sentence We only typehint public methods, though, as typehinting is not cost-free. It now just reads: Arguments that expect objects or arrays can be typehinted.

Moved the part about types to the right place (Commenting Code).

Also added a section about cakephp/cakephp#3792

When returning the object itself, e.g. for chaining, one should use ``$this`` instead::

    /**
     * Foo function.
     *
     * @return $this
     */
    public function foo() {
        return $this;
    }

markstory added a commit that referenced this pull request Jul 8, 2014
@markstory markstory merged commit 0e3d2c4 into cakephp:master Jul 8, 2014
@dereuromark dereuromark deleted the master-return-this branch July 8, 2014 14:14
cake17 added a commit that referenced this pull request Jul 13, 2014
Clarify return $this
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

Successfully merging this pull request may close these issues.

None yet

2 participants