> Of course this ": $this" could be added later in the future.
> But this would have the risk that people start adding ": static" on methods
> that really return $this.
>

I second $this. I also would like to be able to declare `function foo():
$this` at the same time as `function foo(): static` so that we can use the
most accurate description right away.

Although I'm not into the C part of the proposal, if I may have a
suggestion here, it would be to implement the check *at compile time*. Like
nullable return types check at compile time that `return null;` is used
instead of just `return;`, I think a `$this` return type could and should
enforce `return $this;` on all return point of such methods. That would
also make the check free at runtime.

Cheers,
Nicolas

Reply via email to