Re: [RFC] $this return type
| From: | Michał Marcin Brzuchalski | Date: | Tue, 07 Sep 2021 11:38:40 +0000 |
| Subject: | Re: [RFC] $this return type | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-115991@lists.php.net to get a copy of this message | ||
Hi Nikita,
wt., 7 wrz 2021 o 12:29 Nikita Popov <nikita.ppv@gmail.com> napisał(a):
> Hi internals,
>
> I'd like to pick up a loose thread from the future scope of the
> https://wiki.php.net/rfc/static_return_type RFC, the $this
> return type for
> fluent APIs:
>
> https://wiki.php.net/rfc/this_return_type
>
> I have some reservations about this (which basically come down to $this not
> being a proper "type", so should it be in the type system?) but I can see
> the practical usefulness, so I think it's worth discussing this.
If the aim of $this return type is to force and check the return $this why
would we still need/require return statement to be obligatory?
Does that make sense to assume at the end of function flow the return
$this; statement to be present by default if the return type is not an
union etc.?
Cheers,
--
Michał Marcin Brzuchalski