Re: Proposal: AS assertions
| From: | Larry Garfield | Date: | Thu, 21 Mar 2024 16:07:31 +0000 |
| Subject: | Re: Proposal: AS assertions | ||
| References: | 1 2 3 4 5 6 7 8 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-122709@lists.php.net to get a copy of this message | ||
On Thu, Mar 21, 2024, at 3:02 PM, Robert Landers wrote:
> I don't think you are getting what I am saying.
>
> $a as int|float
>
> would be an int, float, or thrown exception.
>
> $a as int|float|null
>
> would be an int, float, or null.
>
> Robert Landers
> Software Engineer
> Utrecht NL
Hi Rob. I really do encourage you to read the RFC that Ilija linked to already. What you're
proposing is already mostly written (though for performance reasons may be rewritten soon), and the
edge cases already largely resolved.
https://wiki.php.net/rfc/pattern-matching
--Larry Garfield