Open czim opened 7 years ago
Can u describe the issue more. I0 want to try resolve the issue
A docblock that has @return self
when what it does is return $this
tends to lie. For instance (in pseudocode):
class A
// return self?
function something
return $this
Class B extends A
Now, calling A::something
returns A, which is self. This is fine.
But calling B::something
returns B, which is not self in the context of the definition 'something', because that would be A.
This is not wrong per se, but it does break things, for instance:
class A
// return self?
function something
return $this
Class B extends A
function nextFluentCall
Now something like (new B())->something()->nextFluentCall()
will make your IDE warn that there is no nextFluentCall
method on A, which is correct, but also wrong, since that method does exist on what something()
returns in that context.
That's the thing that annoyed me when I made this issue.
This is a blatant lie for a non-final class, so it needs to be addressed.