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

Bug: __construct @return assumption of self #18

Closed
alexrussell opened this issue Sep 9, 2013 · 4 comments
Closed

Bug: __construct @return assumption of self #18

alexrussell opened this issue Sep 9, 2013 · 4 comments

Comments

@alexrussell
Copy link

Going on the definitions in Appendix A, Subsection Keyword (bottom of document), shouldn't the assumed @return of a __construct method as mentioned in the exceptions to Section 8.15 be assumed @return static rather than the stated @return self?

@samdark
Copy link

samdark commented Oct 9, 2013

Yes, it should be static, not self.

@lisachenko
Copy link

I think it will be better to use $this to reflect that returned object is an instance of that class. BTW, phpStorm supports this construction for phpDocs: @return $this

@samdark
Copy link

samdark commented Oct 10, 2013

Yeah, even better.

@alexrussell
Copy link
Author

Yeah that makes sense to me. I suppose by the time the constructor runs the instance exists (as the constructor can use $this, so the constructor is not a factory (@return static) but an initialiser, and so @return $this is a much better fit.

@mvriel mvriel closed this as completed in 8556da6 Nov 1, 2013
mvriel added a commit that referenced this issue Nov 1, 2013
Update @return tag exceptions for constructors, fixes #18
ashnazg pushed a commit that referenced this issue Oct 2, 2018
ashnazg pushed a commit that referenced this issue Oct 2, 2018
Rename PSR-13 interfaces to not be http specific
ashnazg pushed a commit that referenced this issue Oct 2, 2018
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

3 participants