Re: Re: [RFC][Discussion] Harmonise "untyped" and "typed" properties

From: Date: Wed, 22 Nov 2023 13:53:21 +0000
Subject: Re: Re: [RFC][Discussion] Harmonise "untyped" and "typed" properties
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to internals+get-121756@lists.php.net to get a copy of this message
On Tue, Nov 21, 2023 at 12:41 AM Larry Garfield <larry@garfieldtech..com> wrote: > > On Mon, Nov 20, 2023, at 11:08 PM, Rowan Tommins wrote: > > On 16/11/2023 20:41, Rowan Tommins wrote: > >> Hi all, > >> > >> I have finally written up an RFC I have been considering for some > >> time: Harmonise "untyped" and "typed" properties > >> > >> RFC URL: > >> https://wiki.php.net/rfc/mixed_vs_untyped_properties > > > > > > I've revised the RFC; it now proposes to keep the implicit "= null" for > > untyped properties, although I'm still interested in suggestions for > > other strategies around that. I have also added discussion of variance > > checks (thanks Claude for the tips on that). > > Thanks. It's looking pretty good, and should simplify things considerably. > > > While doing so, I checked Reflection, and am unsure how to proceed. > > Currently ReflectionParameter shows a difference between "function > > foo($bar)" and "function foo(mixed $bar)", even though these are > > analysed as equivalent in inheritance checks. Should ReflectionProperty > > also retain this distinction? Was the possibility discussed when "mixed" > > was introduced of using a ReflectionType of mixed for both cases? > > I don't recall any discussion of ReflectionType when mixed was added, no. > > My initial gut reaction is that both ReflectionParameter and ReflectionProperty should treat > "omitted" as "mixed", and just evaluate their type to "mixed". It is > in practice a distinction without meaning, or will be after this RFC. That said, I also have an > itch telling me that there are a few small-but-important edge cases where you would care about the > difference between mixed and none in reflection, and that I'd be the one to run into them, but > I cannot think of what they would be. > > --Larry Garfield > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: https://www.php.net/unsub.php > Hmmm, > That said, I also have an itch telling me that there are a few small-but-important edge cases > where you would care about the difference between mixed and none in reflection, I'd also probably run into them, and the only one I can think of will be moot after this RFC: - unset($this->var) to use magic methods instead of the properties in some older proxies Other than that, I can't think of anything, though that isn't really important for reflection... Robert Landers Software Engineer Utrecht NL

« previous php.internals (#121756) next »