Re: Union type casts

From: Date: Wed, 05 Oct 2022 18:00:56 +0000
Subject: Re: Union type casts
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to internals+get-118760@lists.php.net to get a copy of this message
On 5 October 2022 14:42:57 BST, juan carlos morales <dev.juan.morales@gmail.com> wrote: >Are you facing a situation where manual union type cast is needed? I can't think of any examples for full union types off the top of my head, but nullable casts would frequently be useful, e.g. when you have a value that is either a numeric string or null, and you want an integer, but for null to stay null, not become zero. There's also a slightly different case, where you want values which aren't numeric to also become null. As I commented on another thread, this is a space I've been thinking about recently, and it gets complicated quickly. Regards, -- Rowan Tommins [IMSoP]

« previous php.internals (#118760) next »